Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
P
project_TRTP
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Conditions générales et politique de confidentialité
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Samuel de Meester de Ravestein
project_TRTP
Validations
3ab6ae6b
Valider
3ab6ae6b
rédigé
3 years ago
par
Samuel de Meester de Ravestein
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
general function to generate tests is working
parent
00672c0c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
3
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
src/sender_utils.c
+9
-6
9 ajouts, 6 suppressions
src/sender_utils.c
tests/run_sender_receiver.sh
+5
-1
5 ajouts, 1 suppression
tests/run_sender_receiver.sh
tests/run_tests.sh
+29
-10
29 ajouts, 10 suppressions
tests/run_tests.sh
avec
43 ajouts
et
17 suppressions
src/sender_utils.c
+
9
−
6
Voir le fichier @
3ab6ae6b
...
...
@@ -58,16 +58,15 @@ bool can_send(sender_state_t *state)
}
else
if
(
state
->
last_pkt_sent
==
LAST_DATA_PKT
)
{
// I want to be sure all the
data pkt
ha
s
been received before letting know the receiver
// I want to be sure
that
all the
PTYPE_DATA
ha
ve
been received before letting know the receiver
// it was the end of the file (so that I can set a timer for timeout)
return
state
->
s_window_size
==
MAX_WINDOW_SIZE
;
}
// Case: we're in FEC mode, the closing pkt has been sent but we
will
still send a last FEC if
possible
else
if
((
state
->
fec_enabled
)
&&
(
state
->
last_pkt_sent
==
CLOSING_PKT
)
&&
(
state
->
FEC_nbr
>
0
))
// Case: we're in FEC mode, the closing pkt has been sent but we still
want to
send a last FEC if
4 PTYPE_DATA have been stacked
else
if
((
state
->
fec_enabled
)
&&
(
state
->
last_pkt_sent
==
CLOSING_PKT
)
&&
(
state
->
FEC_nbr
==
4
))
{
return
true
;
}
// Case last FEC has been sended
else
{
return
false
;
...
...
@@ -269,10 +268,14 @@ void construct_FEC(sender_state_t *state, pkt_t *pkt)
uint8_t
payload
[
MAX_PAYLOAD_SIZE
];
uint8_t
*
p1
=
(
uint8_t
*
)
pkt_get_payload
(
state
->
FEC
);
uint8_t
*
p2
=
(
uint8_t
*
)
pkt_get_payload
(
pkt
);
for
(
int
i
=
0
;
i
<
MAX_PAYLOAD_SIZE
;
i
++
)
for
(
int
i
=
0
;
i
<
pkt_get_length
(
pkt
)
;
i
++
)
{
payload
[
i
]
=
p1
[
i
]
^
p2
[
i
];
}
for
(
int
i
=
pkt_get_length
(
pkt
);
i
<
MAX_PAYLOAD_SIZE
;
i
++
)
{
payload
[
i
]
=
p1
[
i
];
}
pkt_set_payload
(
state
->
FEC
,
(
const
char
*
)
payload
,
MAX_PAYLOAD_SIZE
);
state
->
FEC_nbr
++
;
...
...
@@ -313,7 +316,7 @@ int send_FEC(sender_state_t *state, int socket_fd)
int
read_and_send
(
sender_state_t
*
state
,
int
sending_fd
,
int
socket_fd
)
{
// Checking whether I need to send a PTYPE_FEC or PTYPE_DATA
if
(
(
state
->
fec_enabled
)
&&
(
(
state
->
FEC_nbr
==
4
)
||
((
state
->
last_pkt_sent
==
CLOSING_PKT
)
&&
(
state
->
FEC_nbr
>
0
)))
)
if
(
state
->
fec_enabled
&&
(
state
->
FEC_nbr
==
4
))
{
return
send_FEC
(
state
,
socket_fd
);
}
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
tests/run_sender_receiver.sh
+
5
−
1
Voir le fichier @
3ab6ae6b
...
...
@@ -47,6 +47,8 @@ if [ -d "${DIR}" ]; then
fi
mkdir
"
${
DIR
}
"
2>/dev/null
echo
-e
"
\n
Simulation
${
mode
}
"
# Checking if we're using the linksimulator or not
if
[
"$#"
-gt
6
]
;
then
...
...
@@ -59,7 +61,7 @@ if [ "$#" -gt 6 ]; then
echo
-e
"The linksimulator paramateres are:
\t\t
-ERROR RATE:
${
ERROR_RATE
}
%
\t
-DELAY:
${
DELAY
}
ms
\t\t
-CUT RATE:
${
CUT_RATE
}
%
\t
-JITTER:
${
JITTER
}
ms
\t\t
-LOSS RATE:
${
LOSS_RATE
}
%
\n
"
\t\t
-LOSS RATE:
${
LOSS_RATE
}
%"
# The next 2 lines come from: https://unix.stackexchange.com/questions/55913/whats-the-easiest-way-to-find-an-unused-local-port
# We use this to be sure we're using unused port
...
...
@@ -140,6 +142,8 @@ else # We check the return value of the receiver
echo
-e
"
${
RED
}
Crash of the receiver!
${
NC
}
"
cat
${
receiver_logs
}
err
=
1
else
err
=
0
fi
fi
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
tests/run_tests.sh
+
29
−
10
Voir le fichier @
3ab6ae6b
...
...
@@ -3,6 +3,10 @@
BROWN
=
'\033[0;33m'
NC
=
'\033[0m'
my_sender
=
"sender"
my_receiver
=
"receiver"
# Note that this assumes to be called from the Makefile, you may want to adapt it.
FILESIZE
=
""
TEST_FILES_DIR
=
./tests_files/
...
...
@@ -44,21 +48,36 @@ advanced_test_files=(
# let i++
# done
echo
-e
"Finished Simple tests."
# echo -e "Finished Simple tests."
modes
=(
'with_FEC'
'without_FEC'
)
ERROR_RATE
=
5
CUT_RATE
=
5
DELAY
=
100
JITTER
=
100
LOSS_RATE
=
1
dir
=
"tests_logs/advanced_tests/"
if
[
-d
linksimulator/
]
;
then
echo
-e
"
\n
Starting advanced tests ...
\n
"
# Now we ran the advanced tests
i
=
1
for
FILENAME
in
"
${
advanced_test_files
[@]
}
"
;
do
FILESIZE
=
$(
stat
-c
%s
"
$FILENAME
"
)
echo
-e
"
\n
${
BROWN
}
(
$i
/
${#
advanced_test_files
[@]
}
) Sending the file
\"
$FILENAME
\"
\t
[
$FILESIZE
bytes] with linksimulator and Valgrind
${
NC
}
"
./tests/advanced_test.sh
$FILENAME
if
[
$?
-ne
0
]
;
then
echo
"Tests terminated cause of a failed test"
exit
0
fi
for
file
in
"
${
advanced_test_files
[@]
}
"
;
do
filesize
=
$(
stat
-c
%s
"
$file
"
)
echo
-e
"
\n
${
BROWN
}
(
$i
/
${#
advanced_test_files
[@]
}
) Sending the file
\"
$file
\"
\t
[
$filesize
bytes] with linksimulator and Valgrind
${
NC
}
"
for
mode
in
"
${
modes
[@]
}
"
;
do
./tests/run_sender_receiver.sh
$my_sender
$my_receiver
$file
$dir
$mode
\
$ERROR_RATE
$CUT_RATE
$DELAY
$JITTER
$LOSS_RATE
if
[
$?
-ne
0
]
;
then
echo
"Tests terminated cause of a failed test"
exit
0
fi
done
let
i++
done
echo
"Finished Advanced tests."
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter