From a3d2264b886ef732b31cade5a4e3e3a2593b6f9b Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 13 Jul 2021 23:23:23 +0200 Subject: [PATCH 1/6] Only run an unbridled parallel make (make -j) if MAKEFLAGS is unset Signed-off-by: Gilles Peskine --- tests/scripts/basic-build-test.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/scripts/basic-build-test.sh b/tests/scripts/basic-build-test.sh index 83aa87aa0..4b05d1b2f 100755 --- a/tests/scripts/basic-build-test.sh +++ b/tests/scripts/basic-build-test.sh @@ -62,6 +62,11 @@ fi : ${SEED:=1} export SEED +# if MAKEFLAGS is not set add the -j option to speed up invocations of make +if [ -z "${MAKEFLAGS+set}" ]; then + export MAKEFLAGS="-j" +fi + # To avoid setting OpenSSL and GnuTLS for each call to compat.sh and ssl-opt.sh # we just export the variables they require export OPENSSL_CMD="$OPENSSL" @@ -87,7 +92,7 @@ export LDFLAGS=' --coverage' make clean cp "$CONFIG_H" "$CONFIG_BAK" scripts/config.py full -make -j +make # Step 2 - Execute the tests From bbced87390b823ac5c6a8d28b0f7b4333f105d37 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 13 Jul 2021 23:26:00 +0200 Subject: [PATCH 2/6] Show the udp_proxy seed in the console log Signed-off-by: Gilles Peskine --- tests/scripts/basic-build-test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/scripts/basic-build-test.sh b/tests/scripts/basic-build-test.sh index 4b05d1b2f..aaf7cffa4 100755 --- a/tests/scripts/basic-build-test.sh +++ b/tests/scripts/basic-build-test.sh @@ -112,6 +112,7 @@ echo # Step 2b - System Tests (keep going even if some tests fail) echo echo '################ ssl-opt.sh ################' +echo "ssl-opt.sh will use SEED=$SEED for udp_proxy" sh ssl-opt.sh |tee sys-test-$TEST_OUTPUT echo '^^^^^^^^^^^^^^^^ ssl-opt.sh ^^^^^^^^^^^^^^^^' echo From fc70b5252b8cb089c7e5922cc7aa963831d40c17 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 13 Jul 2021 23:27:01 +0200 Subject: [PATCH 3/6] Save the coverage report to a file Save the "Test Report Summary" to a file. This can help both CI scripts and human readers who want the summary after the fact without having to copy the console output. Take care to exit with a nonzero status if there is a failure while generating the test report summary. Signed-off-by: Gilles Peskine --- .gitignore | 1 + tests/scripts/basic-build-test.sh | 192 ++++++++++++++++-------------- 2 files changed, 105 insertions(+), 88 deletions(-) diff --git a/.gitignore b/.gitignore index b209ffcd9..0792920a8 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ Testing Coverage *.gcno *.gcda +coverage-summary.txt # generated by scripts/memory.sh massif-* diff --git a/tests/scripts/basic-build-test.sh b/tests/scripts/basic-build-test.sh index aaf7cffa4..fd22f4dda 100755 --- a/tests/scripts/basic-build-test.sh +++ b/tests/scripts/basic-build-test.sh @@ -156,116 +156,125 @@ echo "=========================================================================" echo "Test Report Summary" echo -cd tests +{ -# Step 4a - Unit tests -echo "Unit tests - tests/scripts/run-test-suites.pl" + cd tests -PASSED_TESTS=$(tail -n6 unit-test-$TEST_OUTPUT|sed -n -e 's/test cases passed :[\t]*\([0-9]*\)/\1/p'| tr -d ' ') -SKIPPED_TESTS=$(tail -n6 unit-test-$TEST_OUTPUT|sed -n -e 's/skipped :[ \t]*\([0-9]*\)/\1/p'| tr -d ' ') -TOTAL_SUITES=$(tail -n6 unit-test-$TEST_OUTPUT|sed -n -e 's/.* (\([0-9]*\) .*, [0-9]* tests run)/\1/p'| tr -d ' ') -FAILED_TESTS=$(tail -n6 unit-test-$TEST_OUTPUT|sed -n -e 's/failed :[\t]*\([0-9]*\)/\1/p' |tr -d ' ') + # Step 4a - Unit tests + echo "Unit tests - tests/scripts/run-test-suites.pl" -echo "No test suites : $TOTAL_SUITES" -echo "Passed : $PASSED_TESTS" -echo "Failed : $FAILED_TESTS" -echo "Skipped : $SKIPPED_TESTS" -echo "Total exec'd tests : $(($PASSED_TESTS + $FAILED_TESTS))" -echo "Total avail tests : $(($PASSED_TESTS + $FAILED_TESTS + $SKIPPED_TESTS))" -echo + PASSED_TESTS=$(tail -n6 unit-test-$TEST_OUTPUT|sed -n -e 's/test cases passed :[\t]*\([0-9]*\)/\1/p'| tr -d ' ') + SKIPPED_TESTS=$(tail -n6 unit-test-$TEST_OUTPUT|sed -n -e 's/skipped :[ \t]*\([0-9]*\)/\1/p'| tr -d ' ') + TOTAL_SUITES=$(tail -n6 unit-test-$TEST_OUTPUT|sed -n -e 's/.* (\([0-9]*\) .*, [0-9]* tests run)/\1/p'| tr -d ' ') + FAILED_TESTS=$(tail -n6 unit-test-$TEST_OUTPUT|sed -n -e 's/failed :[\t]*\([0-9]*\)/\1/p' |tr -d ' ') -TOTAL_PASS=$PASSED_TESTS -TOTAL_FAIL=$FAILED_TESTS -TOTAL_SKIP=$SKIPPED_TESTS -TOTAL_AVAIL=$(($PASSED_TESTS + $FAILED_TESTS + $SKIPPED_TESTS)) -TOTAL_EXED=$(($PASSED_TESTS + $FAILED_TESTS)) + echo "No test suites : $TOTAL_SUITES" + echo "Passed : $PASSED_TESTS" + echo "Failed : $FAILED_TESTS" + echo "Skipped : $SKIPPED_TESTS" + echo "Total exec'd tests : $(($PASSED_TESTS + $FAILED_TESTS))" + echo "Total avail tests : $(($PASSED_TESTS + $FAILED_TESTS + $SKIPPED_TESTS))" + echo -# Step 4b - TLS Options tests -echo "TLS Options tests - tests/ssl-opt.sh" + TOTAL_PASS=$PASSED_TESTS + TOTAL_FAIL=$FAILED_TESTS + TOTAL_SKIP=$SKIPPED_TESTS + TOTAL_AVAIL=$(($PASSED_TESTS + $FAILED_TESTS + $SKIPPED_TESTS)) + TOTAL_EXED=$(($PASSED_TESTS + $FAILED_TESTS)) -PASSED_TESTS=$(tail -n5 sys-test-$TEST_OUTPUT|sed -n -e 's/.* (\([0-9]*\) \/ [0-9]* tests ([0-9]* skipped))$/\1/p') -SKIPPED_TESTS=$(tail -n5 sys-test-$TEST_OUTPUT|sed -n -e 's/.* ([0-9]* \/ [0-9]* tests (\([0-9]*\) skipped))$/\1/p') -TOTAL_TESTS=$(tail -n5 sys-test-$TEST_OUTPUT|sed -n -e 's/.* ([0-9]* \/ \([0-9]*\) tests ([0-9]* skipped))$/\1/p') -FAILED_TESTS=$(($TOTAL_TESTS - $PASSED_TESTS)) + # Step 4b - TLS Options tests + echo "TLS Options tests - tests/ssl-opt.sh" -echo "Passed : $PASSED_TESTS" -echo "Failed : $FAILED_TESTS" -echo "Skipped : $SKIPPED_TESTS" -echo "Total exec'd tests : $TOTAL_TESTS" -echo "Total avail tests : $(($TOTAL_TESTS + $SKIPPED_TESTS))" -echo + PASSED_TESTS=$(tail -n5 sys-test-$TEST_OUTPUT|sed -n -e 's/.* (\([0-9]*\) \/ [0-9]* tests ([0-9]* skipped))$/\1/p') + SKIPPED_TESTS=$(tail -n5 sys-test-$TEST_OUTPUT|sed -n -e 's/.* ([0-9]* \/ [0-9]* tests (\([0-9]*\) skipped))$/\1/p') + TOTAL_TESTS=$(tail -n5 sys-test-$TEST_OUTPUT|sed -n -e 's/.* ([0-9]* \/ \([0-9]*\) tests ([0-9]* skipped))$/\1/p') + FAILED_TESTS=$(($TOTAL_TESTS - $PASSED_TESTS)) -TOTAL_PASS=$(($TOTAL_PASS+$PASSED_TESTS)) -TOTAL_FAIL=$(($TOTAL_FAIL+$FAILED_TESTS)) -TOTAL_SKIP=$(($TOTAL_SKIP+$SKIPPED_TESTS)) -TOTAL_AVAIL=$(($TOTAL_AVAIL + $TOTAL_TESTS + $SKIPPED_TESTS)) -TOTAL_EXED=$(($TOTAL_EXED + $TOTAL_TESTS)) + echo "Passed : $PASSED_TESTS" + echo "Failed : $FAILED_TESTS" + echo "Skipped : $SKIPPED_TESTS" + echo "Total exec'd tests : $TOTAL_TESTS" + echo "Total avail tests : $(($TOTAL_TESTS + $SKIPPED_TESTS))" + echo + + TOTAL_PASS=$(($TOTAL_PASS+$PASSED_TESTS)) + TOTAL_FAIL=$(($TOTAL_FAIL+$FAILED_TESTS)) + TOTAL_SKIP=$(($TOTAL_SKIP+$SKIPPED_TESTS)) + TOTAL_AVAIL=$(($TOTAL_AVAIL + $TOTAL_TESTS + $SKIPPED_TESTS)) + TOTAL_EXED=$(($TOTAL_EXED + $TOTAL_TESTS)) -# Step 4c - System Compatibility tests -echo "System/Compatibility tests - tests/compat.sh" + # Step 4c - System Compatibility tests + echo "System/Compatibility tests - tests/compat.sh" -PASSED_TESTS=$(cat compat-test-$TEST_OUTPUT | sed -n -e 's/.* (\([0-9]*\) \/ [0-9]* tests ([0-9]* skipped))$/\1/p' | awk 'BEGIN{ s = 0 } { s += $1 } END{ print s }') -SKIPPED_TESTS=$(cat compat-test-$TEST_OUTPUT | sed -n -e 's/.* ([0-9]* \/ [0-9]* tests (\([0-9]*\) skipped))$/\1/p' | awk 'BEGIN{ s = 0 } { s += $1 } END{ print s }') -EXED_TESTS=$(cat compat-test-$TEST_OUTPUT | sed -n -e 's/.* ([0-9]* \/ \([0-9]*\) tests ([0-9]* skipped))$/\1/p' | awk 'BEGIN{ s = 0 } { s += $1 } END{ print s }') -FAILED_TESTS=$(($EXED_TESTS - $PASSED_TESTS)) + PASSED_TESTS=$(cat compat-test-$TEST_OUTPUT | sed -n -e 's/.* (\([0-9]*\) \/ [0-9]* tests ([0-9]* skipped))$/\1/p' | awk 'BEGIN{ s = 0 } { s += $1 } END{ print s }') + SKIPPED_TESTS=$(cat compat-test-$TEST_OUTPUT | sed -n -e 's/.* ([0-9]* \/ [0-9]* tests (\([0-9]*\) skipped))$/\1/p' | awk 'BEGIN{ s = 0 } { s += $1 } END{ print s }') + EXED_TESTS=$(cat compat-test-$TEST_OUTPUT | sed -n -e 's/.* ([0-9]* \/ \([0-9]*\) tests ([0-9]* skipped))$/\1/p' | awk 'BEGIN{ s = 0 } { s += $1 } END{ print s }') + FAILED_TESTS=$(($EXED_TESTS - $PASSED_TESTS)) -echo "Passed : $PASSED_TESTS" -echo "Failed : $FAILED_TESTS" -echo "Skipped : $SKIPPED_TESTS" -echo "Total exec'd tests : $EXED_TESTS" -echo "Total avail tests : $(($EXED_TESTS + $SKIPPED_TESTS))" -echo + echo "Passed : $PASSED_TESTS" + echo "Failed : $FAILED_TESTS" + echo "Skipped : $SKIPPED_TESTS" + echo "Total exec'd tests : $EXED_TESTS" + echo "Total avail tests : $(($EXED_TESTS + $SKIPPED_TESTS))" + echo -TOTAL_PASS=$(($TOTAL_PASS+$PASSED_TESTS)) -TOTAL_FAIL=$(($TOTAL_FAIL+$FAILED_TESTS)) -TOTAL_SKIP=$(($TOTAL_SKIP+$SKIPPED_TESTS)) -TOTAL_AVAIL=$(($TOTAL_AVAIL + $EXED_TESTS + $SKIPPED_TESTS)) -TOTAL_EXED=$(($TOTAL_EXED + $EXED_TESTS)) + TOTAL_PASS=$(($TOTAL_PASS+$PASSED_TESTS)) + TOTAL_FAIL=$(($TOTAL_FAIL+$FAILED_TESTS)) + TOTAL_SKIP=$(($TOTAL_SKIP+$SKIPPED_TESTS)) + TOTAL_AVAIL=$(($TOTAL_AVAIL + $EXED_TESTS + $SKIPPED_TESTS)) + TOTAL_EXED=$(($TOTAL_EXED + $EXED_TESTS)) -# Step 4d - Grand totals -echo "-------------------------------------------------------------------------" -echo "Total tests" + # Step 4d - Grand totals + echo "-------------------------------------------------------------------------" + echo "Total tests" -echo "Total Passed : $TOTAL_PASS" -echo "Total Failed : $TOTAL_FAIL" -echo "Total Skipped : $TOTAL_SKIP" -echo "Total exec'd tests : $TOTAL_EXED" -echo "Total avail tests : $TOTAL_AVAIL" -echo + echo "Total Passed : $TOTAL_PASS" + echo "Total Failed : $TOTAL_FAIL" + echo "Total Skipped : $TOTAL_SKIP" + echo "Total exec'd tests : $TOTAL_EXED" + echo "Total avail tests : $TOTAL_AVAIL" + echo -# Step 4e - Coverage -echo "Coverage" + # Step 4e - Coverage + echo "Coverage" -LINES_TESTED=$(tail -n4 cov-$TEST_OUTPUT|sed -n -e 's/ lines......: [0-9]*.[0-9]% (\([0-9]*\) of [0-9]* lines)/\1/p') -LINES_TOTAL=$(tail -n4 cov-$TEST_OUTPUT|sed -n -e 's/ lines......: [0-9]*.[0-9]% ([0-9]* of \([0-9]*\) lines)/\1/p') -FUNCS_TESTED=$(tail -n4 cov-$TEST_OUTPUT|sed -n -e 's/ functions..: [0-9]*.[0-9]% (\([0-9]*\) of [0-9]* functions)$/\1/p') -FUNCS_TOTAL=$(tail -n4 cov-$TEST_OUTPUT|sed -n -e 's/ functions..: [0-9]*.[0-9]% ([0-9]* of \([0-9]*\) functions)$/\1/p') -BRANCHES_TESTED=$(tail -n4 cov-$TEST_OUTPUT|sed -n -e 's/ branches...: [0-9]*.[0-9]% (\([0-9]*\) of [0-9]* branches)$/\1/p') -BRANCHES_TOTAL=$(tail -n4 cov-$TEST_OUTPUT|sed -n -e 's/ branches...: [0-9]*.[0-9]% ([0-9]* of \([0-9]*\) branches)$/\1/p') + LINES_TESTED=$(tail -n4 cov-$TEST_OUTPUT|sed -n -e 's/ lines......: [0-9]*.[0-9]% (\([0-9]*\) of [0-9]* lines)/\1/p') + LINES_TOTAL=$(tail -n4 cov-$TEST_OUTPUT|sed -n -e 's/ lines......: [0-9]*.[0-9]% ([0-9]* of \([0-9]*\) lines)/\1/p') + FUNCS_TESTED=$(tail -n4 cov-$TEST_OUTPUT|sed -n -e 's/ functions..: [0-9]*.[0-9]% (\([0-9]*\) of [0-9]* functions)$/\1/p') + FUNCS_TOTAL=$(tail -n4 cov-$TEST_OUTPUT|sed -n -e 's/ functions..: [0-9]*.[0-9]% ([0-9]* of \([0-9]*\) functions)$/\1/p') + BRANCHES_TESTED=$(tail -n4 cov-$TEST_OUTPUT|sed -n -e 's/ branches...: [0-9]*.[0-9]% (\([0-9]*\) of [0-9]* branches)$/\1/p') + BRANCHES_TOTAL=$(tail -n4 cov-$TEST_OUTPUT|sed -n -e 's/ branches...: [0-9]*.[0-9]% ([0-9]* of \([0-9]*\) branches)$/\1/p') -LINES_PERCENT=$((1000*$LINES_TESTED/$LINES_TOTAL)) -LINES_PERCENT="$(($LINES_PERCENT/10)).$(($LINES_PERCENT-($LINES_PERCENT/10)*10))" + LINES_PERCENT=$((1000*$LINES_TESTED/$LINES_TOTAL)) + LINES_PERCENT="$(($LINES_PERCENT/10)).$(($LINES_PERCENT-($LINES_PERCENT/10)*10))" -FUNCS_PERCENT=$((1000*$FUNCS_TESTED/$FUNCS_TOTAL)) -FUNCS_PERCENT="$(($FUNCS_PERCENT/10)).$(($FUNCS_PERCENT-($FUNCS_PERCENT/10)*10))" + FUNCS_PERCENT=$((1000*$FUNCS_TESTED/$FUNCS_TOTAL)) + FUNCS_PERCENT="$(($FUNCS_PERCENT/10)).$(($FUNCS_PERCENT-($FUNCS_PERCENT/10)*10))" -BRANCHES_PERCENT=$((1000*$BRANCHES_TESTED/$BRANCHES_TOTAL)) -BRANCHES_PERCENT="$(($BRANCHES_PERCENT/10)).$(($BRANCHES_PERCENT-($BRANCHES_PERCENT/10)*10))" + BRANCHES_PERCENT=$((1000*$BRANCHES_TESTED/$BRANCHES_TOTAL)) + BRANCHES_PERCENT="$(($BRANCHES_PERCENT/10)).$(($BRANCHES_PERCENT-($BRANCHES_PERCENT/10)*10))" -echo "Lines Tested : $LINES_TESTED of $LINES_TOTAL $LINES_PERCENT%" -echo "Functions Tested : $FUNCS_TESTED of $FUNCS_TOTAL $FUNCS_PERCENT%" -echo "Branches Tested : $BRANCHES_TESTED of $BRANCHES_TOTAL $BRANCHES_PERCENT%" -echo + rm unit-test-$TEST_OUTPUT + rm sys-test-$TEST_OUTPUT + rm compat-test-$TEST_OUTPUT + rm cov-$TEST_OUTPUT -rm unit-test-$TEST_OUTPUT -rm sys-test-$TEST_OUTPUT -rm compat-test-$TEST_OUTPUT -rm cov-$TEST_OUTPUT + echo "Lines Tested : $LINES_TESTED of $LINES_TOTAL $LINES_PERCENT%" + echo "Functions Tested : $FUNCS_TESTED of $FUNCS_TOTAL $FUNCS_PERCENT%" + echo "Branches Tested : $BRANCHES_TESTED of $BRANCHES_TOTAL $BRANCHES_PERCENT%" + echo -cd .. + # If there was a failure, remind the reader here. This also ensures that + # the coverage summary ends with a distinctive mark so that this script + # knows to exit with a failure status. + if [ $TOTAL_FAIL -ne 0 ]; then + echo "Note: $TOTAL_FAIL failures." + fi + +} | tee coverage-summary.txt make clean @@ -273,6 +282,13 @@ if [ -f "$CONFIG_BAK" ]; then mv "$CONFIG_BAK" "$CONFIG_H" fi -if [ $TOTAL_FAIL -ne 0 ]; then - exit 1 -fi +# If the coverage summary doesn't end with the expected last two lines +# ("Branches Tested" and a blank line), either there was an error while +# creating the coverage summary or the coverage summary reported failures. +newline=' +' +case "$(tail -n2 coverage-summary.txt)" in + *"$newline"*) exit 1;; + "Branches Tested"*) :;; + *) exit 1;; +esac From b96957065037cf81989fd6890d1bfa6e90837d5c Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 22 Jul 2021 10:56:39 +0200 Subject: [PATCH 4/6] Explain the final error checking Signed-off-by: Gilles Peskine --- tests/scripts/basic-build-test.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/scripts/basic-build-test.sh b/tests/scripts/basic-build-test.sh index fd22f4dda..96f9c47ad 100755 --- a/tests/scripts/basic-build-test.sh +++ b/tests/scripts/basic-build-test.sh @@ -285,10 +285,15 @@ fi # If the coverage summary doesn't end with the expected last two lines # ("Branches Tested" and a blank line), either there was an error while # creating the coverage summary or the coverage summary reported failures. +# The script runs under `set -e`, so most failures cause it to abort, +# but failures on the left-hand side of a pipe are not detected (this is +# a limitation of sh), so we check that the left-hand side of the pipe +# succeeded by checking that it took the last action that it was expected +# to take. newline=' ' case "$(tail -n2 coverage-summary.txt)" in - *"$newline"*) exit 1;; - "Branches Tested"*) :;; - *) exit 1;; + *"$newline"*) exit 1;; # last line was not blank + "Branches Tested"*) :;; # looks good + *) exit 1;; # next-to-last line had unexpected content esac From 6ee3b7ed1ff74c4d529d6eaabb237fe24810f4fa Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 22 Jul 2021 11:08:30 +0200 Subject: [PATCH 5/6] More robust failure detection for the coverage report generation The previous implementation was hard to understand and could in principle fail to notice if there was a test case failure and the writing of the line "Note: $TOTAL_FAIL failures." failed. KISS. Signed-off-by: Gilles Peskine --- tests/scripts/basic-build-test.sh | 32 ++++++++++--------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/tests/scripts/basic-build-test.sh b/tests/scripts/basic-build-test.sh index 96f9c47ad..2be62b43d 100755 --- a/tests/scripts/basic-build-test.sh +++ b/tests/scripts/basic-build-test.sh @@ -156,6 +156,11 @@ echo "=========================================================================" echo "Test Report Summary" echo +# A failure of the left-hand side of a pipe is ignored (this is a limitation +# of sh). We'll use the presence of this file as a marker that the generation +# of the report succeeded. +rm -f "basic-build-test-$$.ok" + { cd tests @@ -267,13 +272,7 @@ echo echo "Branches Tested : $BRANCHES_TESTED of $BRANCHES_TOTAL $BRANCHES_PERCENT%" echo - # If there was a failure, remind the reader here. This also ensures that - # the coverage summary ends with a distinctive mark so that this script - # knows to exit with a failure status. - if [ $TOTAL_FAIL -ne 0 ]; then - echo "Note: $TOTAL_FAIL failures." - fi - + touch "basic-build-test-$$.ok" } | tee coverage-summary.txt make clean @@ -282,18 +281,7 @@ if [ -f "$CONFIG_BAK" ]; then mv "$CONFIG_BAK" "$CONFIG_H" fi -# If the coverage summary doesn't end with the expected last two lines -# ("Branches Tested" and a blank line), either there was an error while -# creating the coverage summary or the coverage summary reported failures. -# The script runs under `set -e`, so most failures cause it to abort, -# but failures on the left-hand side of a pipe are not detected (this is -# a limitation of sh), so we check that the left-hand side of the pipe -# succeeded by checking that it took the last action that it was expected -# to take. -newline=' -' -case "$(tail -n2 coverage-summary.txt)" in - *"$newline"*) exit 1;; # last line was not blank - "Branches Tested"*) :;; # looks good - *) exit 1;; # next-to-last line had unexpected content -esac +# The file must exist, otherwise it means something went wrong while generating +# the coverage report. If something did go wrong, rm will complain so this +# script will exit with a failure status. +rm "basic-build-test-$$.ok" From d8d19327d5ad69e5d83f955318d4e55aca69cad1 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 22 Jul 2021 12:29:27 +0200 Subject: [PATCH 6/6] Fix mixup about the directory containing the success indicator file Signed-off-by: Gilles Peskine --- tests/scripts/basic-build-test.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/scripts/basic-build-test.sh b/tests/scripts/basic-build-test.sh index 2be62b43d..cf68b4ed4 100755 --- a/tests/scripts/basic-build-test.sh +++ b/tests/scripts/basic-build-test.sh @@ -159,7 +159,7 @@ echo # A failure of the left-hand side of a pipe is ignored (this is a limitation # of sh). We'll use the presence of this file as a marker that the generation # of the report succeeded. -rm -f "basic-build-test-$$.ok" +rm -f "tests/basic-build-test-$$.ok" { @@ -272,6 +272,8 @@ rm -f "basic-build-test-$$.ok" echo "Branches Tested : $BRANCHES_TESTED of $BRANCHES_TOTAL $BRANCHES_PERCENT%" echo + # Mark the report generation as having succeeded. This must be the + # last thing in the report generation. touch "basic-build-test-$$.ok" } | tee coverage-summary.txt @@ -284,4 +286,4 @@ fi # The file must exist, otherwise it means something went wrong while generating # the coverage report. If something did go wrong, rm will complain so this # script will exit with a failure status. -rm "basic-build-test-$$.ok" +rm "tests/basic-build-test-$$.ok"