Skip to content

Commit d270b52

Browse files
authored
Merge pull request #756 from ldorau/Fix_test_valgrind.sh
Fix test_valgrind.sh
2 parents a0fb36a + 49a6a3f commit d270b52

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

test/test_valgrind.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ echo
6868
echo "Working directory: $(pwd)"
6969
echo "Running: \"valgrind $OPTION\" for the following tests:"
7070

71-
FAIL=0
71+
ANY_TEST_FAILED=0
7272
rm -f umf_test-*.log umf_test-*.err
7373

7474
for test in $(ls -1 umf_test-*); do
@@ -121,8 +121,11 @@ for test in $(ls -1 umf_test-*); do
121121

122122
[ "$FILTER" != "" ] && echo -n "($FILTER) "
123123

124+
LAST_TEST_FAILED=0
125+
124126
if ! HWLOC_CPUID_PATH=./cpuid valgrind $OPTION $OPT_SUP --gen-suppressions=all ./$test $FILTER >$LOG 2>&1; then
125-
FAIL=1
127+
LAST_TEST_FAILED=1
128+
ANY_TEST_FAILED=1
126129
echo "(valgrind FAILED) "
127130
echo "Command: HWLOC_CPUID_PATH=./cpuid valgrind $OPTION $OPT_SUP --gen-suppressions=all ./$test $FILTER >$LOG 2>&1"
128131
echo "Output:"
@@ -132,17 +135,17 @@ for test in $(ls -1 umf_test-*); do
132135
fi || true
133136
# grep for "ERROR SUMMARY" with errors (there can be many lines with "ERROR SUMMARY")
134137
grep -e "ERROR SUMMARY:" $LOG | grep -v -e "ERROR SUMMARY: 0 errors from 0 contexts" > $ERR || true
135-
if [ $(cat $ERR | wc -l) -eq 0 ]; then
138+
if [ $LAST_TEST_FAILED -eq 0 -a $(cat $ERR | wc -l) -eq 0 ]; then
136139
echo "- OK"
137140
rm -f $LOG $ERR
138141
else
139142
echo "- FAILED!"
140143
cat $ERR | cut -d' ' -f2-
141-
FAIL=1
144+
ANY_TEST_FAILED=1
142145
fi || true
143146
done
144147

145-
[ $FAIL -eq 0 ] && echo PASSED && exit 0
148+
[ $ANY_TEST_FAILED -eq 0 ] && echo PASSED && exit 0
146149

147150
echo
148151
echo "======================================================================"

0 commit comments

Comments
 (0)