From 49a6a3f2c1604569f5af3317fd52caf5b7342017 Mon Sep 17 00:00:00 2001 From: Lukasz Dorau Date: Wed, 25 Sep 2024 17:17:40 +0200 Subject: [PATCH] Fix test_valgrind.sh If a test fails, but there is no "ERROR SUMMARY" string in the LOG, the LOG is removed and the whole test fails with the following error message: ls: cannot access 'umf_test-*.log': No such file or directory This patch fixes that. Signed-off-by: Lukasz Dorau --- test/test_valgrind.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/test_valgrind.sh b/test/test_valgrind.sh index bfe4275af..c52243b40 100755 --- a/test/test_valgrind.sh +++ b/test/test_valgrind.sh @@ -68,7 +68,7 @@ echo echo "Working directory: $(pwd)" echo "Running: \"valgrind $OPTION\" for the following tests:" -FAIL=0 +ANY_TEST_FAILED=0 rm -f umf_test-*.log umf_test-*.err for test in $(ls -1 umf_test-*); do @@ -121,8 +121,11 @@ for test in $(ls -1 umf_test-*); do [ "$FILTER" != "" ] && echo -n "($FILTER) " + LAST_TEST_FAILED=0 + if ! HWLOC_CPUID_PATH=./cpuid valgrind $OPTION $OPT_SUP --gen-suppressions=all ./$test $FILTER >$LOG 2>&1; then - FAIL=1 + LAST_TEST_FAILED=1 + ANY_TEST_FAILED=1 echo "(valgrind FAILED) " echo "Command: HWLOC_CPUID_PATH=./cpuid valgrind $OPTION $OPT_SUP --gen-suppressions=all ./$test $FILTER >$LOG 2>&1" echo "Output:" @@ -132,17 +135,17 @@ for test in $(ls -1 umf_test-*); do fi || true # grep for "ERROR SUMMARY" with errors (there can be many lines with "ERROR SUMMARY") grep -e "ERROR SUMMARY:" $LOG | grep -v -e "ERROR SUMMARY: 0 errors from 0 contexts" > $ERR || true - if [ $(cat $ERR | wc -l) -eq 0 ]; then + if [ $LAST_TEST_FAILED -eq 0 -a $(cat $ERR | wc -l) -eq 0 ]; then echo "- OK" rm -f $LOG $ERR else echo "- FAILED!" cat $ERR | cut -d' ' -f2- - FAIL=1 + ANY_TEST_FAILED=1 fi || true done -[ $FAIL -eq 0 ] && echo PASSED && exit 0 +[ $ANY_TEST_FAILED -eq 0 ] && echo PASSED && exit 0 echo echo "======================================================================"