Skip to content
Extraits de code Groupes Projets
Valider e4547a1c rédigé par Samuel de Meester de Ravestein's avatar Samuel de Meester de Ravestein
Parcourir les fichiers

we're sure we use unsued port

parent b5744fab
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
.vscode/ .vscode/
unwanted_logs/ unwanted_logs/
log_files/ log_files/
feedback_ingi.zip *.zip
linksimulator/ linksimulator/
demo.* demo.*
interpo/ interpo/
\ No newline at end of file
...@@ -24,13 +24,18 @@ touch "${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_received_file.${BSN_EXT}" \ ...@@ -24,13 +24,18 @@ touch "${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_received_file.${BSN_EXT}" \
"${TEST_OUTPUT_FILES}/adv_valgrind_${BSN_PRE}_sender.log" "${TEST_OUTPUT_FILES}/adv_valgrind_${BSN_PRE}_sender.log"
# 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
port1=$(comm -23 <(seq 49152 65535 | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1)
port2=$(comm -23 <(seq 49152 65535 | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1)
# We first launch the link simulator # We first launch the link simulator
./linksimulator/link_sim -p 65027 -P 65139 -l 70 -d 1500 -e 20 -c 10 -R \ ./linksimulator/link_sim -p $port2 -P $port1 -l 70 -d 1500 -e 20 -c 10 -R \
&>${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_link.log & link_pid=$! &>${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_link.log & link_pid=$!
# We launch the receiver and capture its output # We launch the receiver and capture its output
valgrind --leak-check=full --log-file=${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_valgrind_receiver.log \ 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} \ ./receiver ::1 $port1 1> ${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_received_file.${BSN_EXT} \
2> ${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_receiver.log & receiver_pid=$! 2> ${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_receiver.log & receiver_pid=$!
cleanup() cleanup()
...@@ -43,7 +48,7 @@ trap cleanup SIGINT # Kill the background procces in case of ^-C ...@@ -43,7 +48,7 @@ trap cleanup SIGINT # Kill the background procces in case of ^-C
# We start the transfer # We start the transfer
if ! valgrind --leak-check=full --log-file=${TEST_OUTPUT_FILES}/adv_valgrind_${BSN_PRE}_receiver.log \ 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 ./sender -f ${FILENAME} ::1 $port2 2> ${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_sender.log ; then
echo "Crash du sender!" echo "Crash du sender!"
cat ${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_sender.log cat ${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_sender.log
err=1 # We record the error err=1 # We record the error
......
...@@ -26,9 +26,13 @@ touch "${TEST_OUTPUT_FILES}/${BSNM_PRE}_received_file.${BSNM_EXT}" \ ...@@ -26,9 +26,13 @@ touch "${TEST_OUTPUT_FILES}/${BSNM_PRE}_received_file.${BSNM_EXT}" \
"${TEST_OUTPUT_FILES}/${BSNM_PRE}_receiver.log" "${TEST_OUTPUT_FILES}/${BSNM_PRE}_receiver.log"
# The next line 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
port=$(comm -23 <(seq 49152 65535 | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1)
# We launch the receiver and capture its output # We launch the receiver and capture its output
valgrind --leak-check=full --log-file=${TEST_OUTPUT_FILES}/valgrind_${BSNM_PRE}_receiver.log \ 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} \ ./receiver ::1 $port 1> ${TEST_OUTPUT_FILES}/${BSNM_PRE}_received_file.${BSNM_EXT} \
2> ${TEST_OUTPUT_FILES}/${BSNM_PRE}_receiver.log & receiver_pid=$! 2> ${TEST_OUTPUT_FILES}/${BSNM_PRE}_receiver.log & receiver_pid=$!
cleanup() cleanup()
...@@ -41,7 +45,7 @@ trap cleanup SIGINT # Kill the background procces in case of ^-C ...@@ -41,7 +45,7 @@ trap cleanup SIGINT # Kill the background procces in case of ^-C
# We start the transfer # We start the transfer
if ! valgrind --leak-check=full --log-file=${TEST_OUTPUT_FILES}/valgrind_${BSNM_PRE}_sender.log \ 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 ./sender -f ${FILENAME} ::1 $port 2> ${TEST_OUTPUT_FILES}/${BSNM_PRE}_sender.log ; then
echo "The sender crashed!" echo "The sender crashed!"
cat ${TEST_OUTPUT_FILES}/${BSNM_PRE}_sender.log cat ${TEST_OUTPUT_FILES}/${BSNM_PRE}_sender.log
err=1 # We record the error err=1 # We record the error
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter