Skip to content

Commit 3464460

Browse files
committed
Fix the test_valgrind.sh script running tests under valgrind
The current script just checks if there is the "ERROR SUMMARY: 0 errors from 0 contexts" line in the output of a test. It turned out that there can be many lines starting with "ERROR SUMMARY:" in the output of one test - some with errors and some without, so the current approach is wrong. We have to check if there are no other lines starting with "ERROR SUMMARY:" than this: "ERROR SUMMARY: 0 errors from 0 contexts" instead. Signed-off-by: Lukasz Dorau <[email protected]>
1 parent d7a4bc5 commit 3464460

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

test/test_valgrind.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,20 @@ hwloc-gather-cpuid ./cpuid
5656

5757
echo "Running: \"valgrind $OPTION\" for the following tests:"
5858

59-
for tf in $(ls -1 ./test/umf_test-*); do
60-
[ ! -x $tf ] && continue
61-
echo -n "$tf "
62-
LOG=${tf}.log
63-
HWLOC_CPUID_PATH=./cpuid valgrind $OPTION $tf >$LOG 2>&1 || echo -n "(valgrind failed) "
64-
if grep -q -e "ERROR SUMMARY: 0 errors from 0 contexts" $LOG; then
59+
for test in $(ls -1 ./test/umf_test-*); do
60+
[ ! -x $test ] && continue
61+
echo -n "$test "
62+
LOG=${test}.log
63+
ERR=${test}.err
64+
HWLOC_CPUID_PATH=./cpuid valgrind $OPTION $test >$LOG 2>&1 || echo -n "(valgrind failed) "
65+
# grep for "ERROR SUMMARY" with errors (there can be many lines with "ERROR SUMMARY")
66+
grep -e "ERROR SUMMARY:" $LOG | grep -v -e "ERROR SUMMARY: 0 errors from 0 contexts" > $ERR || true
67+
if [ $(cat $ERR | wc -l) -eq 0 ]; then
6568
echo "- OK"
66-
rm $LOG
69+
rm -f $LOG $ERR
6770
else
68-
echo "- FAILED! : $(grep -e "ERROR SUMMARY:" $LOG | cut -d' ' -f2-)"
71+
echo "- FAILED!"
72+
cat $ERR | cut -d' ' -f2-
6973
FAIL=1
7074
fi || true
7175
done

0 commit comments

Comments
 (0)