From 613d8097d7c45e8817381966d0652c1d33c03ec6 Mon Sep 17 00:00:00 2001 From: sdemeesterde <samuel.demeester@student.uclouvain.be> Date: Fri, 15 Apr 2022 23:47:18 +0200 Subject: [PATCH] cleaner display of the tests output ? --- tests/advanced_test.sh | 18 +++++++++++++++--- tests/run_tests.sh | 7 +++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/tests/advanced_test.sh b/tests/advanced_test.sh index 2138e32..e7e6ae8 100755 --- a/tests/advanced_test.sh +++ b/tests/advanced_test.sh @@ -27,6 +27,17 @@ MODES=( 'without_FEC' ) +ERROR_RATE=20 +CUT_RATE=30 +DELAY=0 +JITTER=0 +LOSS_RATE=25 + +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" + for MODE in "${MODES[@]}"; do mkdir "${TEST_OUTPUT_FILES}/${MODE}/" 2>/dev/null @@ -45,11 +56,12 @@ for MODE in "${MODES[@]}"; do port1=$(comm -23 <(seq 65000 65200 | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1) port2=$(comm -23 <(seq 65000 65200 | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1) - # We first launch the link simulator - ./linksimulator/link_sim -p $port2 -P $port1 -l 25 -d 0 -e 20 -c 30 \ + + ##### Launching the link simulator ##### + ./linksimulator/link_sim -p $port2 -P $port1 -l $LOSS_RATE -d $DELAY -e $ERROR_RATE -c $CUT_RATE -j $JITTER \ &>${DIR}/adv_${BSN_PRE}_link.log & link_pid=$! - # We launch the receiver and capture its output + ##### Launching the receiver and capturinig its output ##### valgrind --leak-check=full --log-file=${DIR}/adv_valgrind_${BSN_PRE}_receiver.log \ ./receiver ::1 $port1 -s ${DIR}/${BSN_PRE}_receiver_stats.csv 1> ${DIR}/adv_${BSN_PRE}_received_file.${BSN_EXT} \ 2> ${DIR}/adv_${BSN_PRE}_receiver.log & receiver_pid=$! diff --git a/tests/run_tests.sh b/tests/run_tests.sh index ca2d764..cd2aee5 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -1,5 +1,8 @@ #!/bin/bash +BROWN='\033[0;33m' +NC='\033[0m' + # Note that this assumes to be called from the Makefile, you may want to adapt it. FILESIZE="" TEST_FILES_DIR=./tests_files/ @@ -19,7 +22,7 @@ fi #for FILENAME in "$TEST_FILES_DIR"/* #do # FILESIZE=$(stat -c%s "$FILENAME") -# echo -e "Sending $FILENAME \t\t [$FILESIZE bytes], \t\t with Valgrind" +# echo -e "${BROWN}Sending \"$FILENAME\" \t[$FILESIZE bytes] with Valgrind${NC}" # ./tests/simple_test.sh $FILENAME # if [ $? -ne 0 ]; then @@ -36,7 +39,7 @@ if [ -d linksimulator/ ]; then for FILENAME in "$TEST_FILES_DIR"/* do FILESIZE=$(stat -c%s "$FILENAME") - echo -e "Sending $FILENAME \t\t [$FILESIZE bytes], \t\t with linksimulator and Valgrind" + echo -e "\n${BROWN}Sending the file \"$FILENAME\" \t[$FILESIZE bytes] with linksimulator and Valgrind${NC}" ./tests/advanced_test.sh $FILENAME if [ $? -ne 0 ]; then -- GitLab