diff --git a/tests/advanced_test.sh b/tests/advanced_test.sh index c601f5b85bb44445750d174089277ede554216ba..640598c3f34036ae40fff4243d1f4472cbc7c197 100755 --- a/tests/advanced_test.sh +++ b/tests/advanced_test.sh @@ -13,7 +13,7 @@ TEST_OUTPUT_FILES="unwanted_logs/advanced_tests/${BSN_PRE}" GREEN='\033[0;32m' NC='\033[0m' -# if the directory does not exist, we create it +# If the directory does not exist, we create it if [ ! -d "unwanted_logs/advanced_tests/" ]; then mkdir 'unwanted_logs/advanced_tests/' 2>/dev/null fi @@ -28,7 +28,7 @@ touch "${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_received_file.${BSN_EXT}" \ ./linksimulator/link_sim -p 65027 -P 65139 -l 70 -d 1500 -e 20 -c 10 -R \ &>${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_link.log & link_pid=$! -# On lance le receiver et capture sa sortie standard +# We launch the receiver and capture its output valgrind --leak-check=full --log-file=${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_valgrind_receiver.log \ ./receiver ::1 65139 1> ${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_received_file.${BSN_EXT} \ 2> ${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_receiver.log & receiver_pid=$! @@ -39,25 +39,25 @@ cleanup() kill -9 $link_pid exit 0 } -trap cleanup SIGINT # Kill les process en arrière plan en cas de ^-C +trap cleanup SIGINT # Kill the background procces in case of ^-C -# On démarre le transfert +# We start the transfer if ! valgrind --leak-check=full --log-file=${TEST_OUTPUT_FILES}/adv_valgrind_${BSN_PRE}_receiver.log \ ./sender -f ${FILENAME} ::1 65027 2> ${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_sender.log ; then echo "Crash du sender!" cat ${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_sender.log - err=1 # On enregistre l'erreur + err=1 # We record the error fi -sleep 5 # On attend 5 seconde que le receiver finisse +sleep 5 # We wait 5s for the receiver to finish up if kill -0 $receiver_pid &> /dev/null ; then - echo "Le receiver ne s'est pas arreté à la fin du transfert!" + echo "The receiver didn't stop at the end of the transfer!" kill -9 $receiver_pid err=1 -else # On teste la valeur de retour du receiver +else # We check the return value of the receiver if ! wait $receiver_pid ; then - echo "Crash du receiver!" + echo "Crash of the receiver!" cat ${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_receiver.log err=1 fi @@ -67,13 +67,13 @@ fi kill -9 $link_pid wait $link_pid 2>/dev/null -# On vérifie que le transfert s'est bien déroulé +# We verify that the transfer ran through properly if [[ "$(md5sum ${FILENAME} | awk '{print $1}')" != "$(md5sum ${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_received_file.${BSN_EXT} | awk '{print $1}')" ]]; then - echo "Le transfert a corrompu le fichier!" - echo "Diff binaire des deux fichiers: (attendu vs produit)" + echo "The transfer corrupted the file!" + echo "Binary difference between the 2 files: (expected vs actual)" diff -C 9 <(od -Ax -t x1z ${FILENAME}) <(od -Ax -t x1z ${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_received_file.${BSN_EXT}) exit 1 else echo -e "${GREEN}The transfer has succeeded!${NC}" - exit ${err:-0} # En cas d'erreurs avant, on renvoie le code d'erreur + exit ${err:-0} # In case of error, we return the error code fi \ No newline at end of file diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 72a9fb6632cab1df3aa06a1d90274c9cd7aaea7b..bec53854df003630b0a028585ed87d1ea54d9047 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -25,7 +25,7 @@ echo -e "Finished Simple tests." if [ -d linksimulator/ ]; then echo -e "\nStarting advanced tests ...\n" - # Now we ran advnced tests + # Now we ran the advanced tests for FILENAME in "$TEST_FILES_DIR"/* do FILESIZE=$(stat -c%s "$FILENAME") diff --git a/tests/simple_test.sh b/tests/simple_test.sh index 45849900319ef95b04759a8db66b16122cc4a1c1..f2f0e3ab9702c9a6135cfd7aee0fd67829c34ead 100755 --- a/tests/simple_test.sh +++ b/tests/simple_test.sh @@ -13,7 +13,7 @@ TEST_OUTPUT_FILES="unwanted_logs/simple_tests/${BSNM_PRE}" GREEN='\033[0;32m' NC='\033[0m' -# if the directory does not exist, we create it +# If the directory does not exist, we create it if [ ! -d "unwanted_logs/simple_tests/" ]; then mkdir 'unwanted_logs/simple_tests/' 2>/dev/null fi @@ -26,7 +26,7 @@ touch "${TEST_OUTPUT_FILES}/${BSNM_PRE}_received_file.${BSNM_EXT}" \ "${TEST_OUTPUT_FILES}/${BSNM_PRE}_receiver.log" -# On lance le receiver et capture sa sortie standard +# We launch the receiver and capture its output valgrind --leak-check=full --log-file=${TEST_OUTPUT_FILES}/valgrind_${BSNM_PRE}_receiver.log \ ./receiver ::1 65197 1> ${TEST_OUTPUT_FILES}/${BSNM_PRE}_received_file.${BSNM_EXT} \ 2> ${TEST_OUTPUT_FILES}/${BSNM_PRE}_receiver.log & receiver_pid=$! @@ -37,20 +37,20 @@ cleanup() kill -9 $link_pid exit 0 } -trap cleanup SIGINT # Kill les process en arrière plan en cas de ^-C +trap cleanup SIGINT # Kill the background procces in case of ^-C # We start the transfer if ! valgrind --leak-check=full --log-file=${TEST_OUTPUT_FILES}/valgrind_${BSNM_PRE}_sender.log \ ./sender -f ${FILENAME} ::1 65197 2> ${TEST_OUTPUT_FILES}/${BSNM_PRE}_sender.log ; then echo "The sender crashed!" cat ${TEST_OUTPUT_FILES}/${BSNM_PRE}_sender.log - err=1 # On enregistre l'erreur + err=1 # We record the error fi -sleep 5 # On attend 5 seconde que le receiver finisse +sleep 5 # We wait 5s for the receiver to finish up if kill -0 $receiver_pid &> /dev/null ; then - echo "Le receiver ne s'est pas arreté à la fin du transfert!" + echo "The receiver didn't stop at the end of the transfer!" kill -9 $receiver_pid err=1 else # We check the return value of the receiver @@ -64,7 +64,7 @@ fi # We check that the transfer ran through properly if [[ "$(md5sum ${FILENAME} | awk '{print $1}')" != "$(md5sum ${TEST_OUTPUT_FILES}/${BSNM_PRE}_received_file.${BSNM_EXT} | awk '{print $1}')" ]]; then echo "The transfer has corrupted the file!" - echo "Diff binaire des deux fichiers: (attendu vs produit)" + echo "Binary difference between the 2 files: (expected vs actual)" diff -C 9 <(od -Ax -t x1z ${FILENAME}) <(od -Ax -t x1z ${TEST_OUTPUT_FILES}/${BSNM_PRE}_received_file.${BSNM_EXT}) exit 1 else