Skip to content

Commit c2093df

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 6939892 commit c2093df

File tree

3 files changed

+136
-8
lines changed

3 files changed

+136
-8
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
[default]
22
# Don't correct the following words:
33
extend-ignore-words-re = ["ASSER", "Tne", "ba", "BA"]
4+
5+
[files]
6+
# completely exclude those files from consideration:
7+
extend-exclude = ["test/*.supp"]

test/test_valgrind.sh

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,23 @@ 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+
SUP=".${test}.supp"
65+
OPT_SUP=""
66+
[ -f ${SUP} ] && OPT_SUP="--suppressions=${SUP}"
67+
HWLOC_CPUID_PATH=./cpuid valgrind $OPTION $OPT_SUP --gen-suppressions=all $test >$LOG 2>&1 || echo -n "(valgrind failed) "
68+
# grep for "ERROR SUMMARY" with errors (there can be many lines with "ERROR SUMMARY")
69+
grep -e "ERROR SUMMARY:" $LOG | grep -v -e "ERROR SUMMARY: 0 errors from 0 contexts" > $ERR || true
70+
if [ $(cat $ERR | wc -l) -eq 0 ]; then
6571
echo "- OK"
66-
rm $LOG
72+
rm -f $LOG $ERR
6773
else
68-
echo "- FAILED! : $(grep -e "ERROR SUMMARY:" $LOG | cut -d' ' -f2-)"
74+
echo "- FAILED!"
75+
cat $ERR | cut -d' ' -f2-
6976
FAIL=1
7077
fi || true
7178
done
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
{
2+
Invalid read of size 8
3+
Memcheck:Addr8
4+
fun:memmove
5+
fun:_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_mutateEmmPKcm
6+
fun:_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEmmPKcm
7+
fun:_ZN18providerConfigTest11read_memoryEv
8+
fun:_ZN44providerConfigTest_protection_flag_none_Test8TestBodyEv
9+
fun:_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
10+
fun:_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
11+
fun:_ZN7testing4Test3RunEv
12+
fun:_ZN7testing8TestInfo3RunEv
13+
fun:_ZN7testing9TestSuite3RunEv
14+
fun:_ZN7testing8internal12UnitTestImpl11RunAllTestsEv
15+
fun:_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc
16+
}
17+
18+
{
19+
Bad permissions for mapped region
20+
Memcheck:Leak
21+
match-leak-kinds: definite
22+
fun:_Znwm
23+
fun:_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_mutateEmmPKcm
24+
fun:_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEmmPKcm
25+
fun:_ZN18providerConfigTest11read_memoryEv
26+
fun:_ZN44providerConfigTest_protection_flag_none_Test8TestBodyEv
27+
fun:_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
28+
fun:_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
29+
fun:_ZN7testing4Test3RunEv
30+
fun:_ZN7testing8TestInfo3RunEv
31+
fun:_ZN7testing9TestSuite3RunEv
32+
fun:_ZN7testing8internal12UnitTestImpl11RunAllTestsEv
33+
fun:_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc
34+
}
35+
36+
{
37+
4,608 bytes in 2 blocks are possibly lost in loss record 342 of 346
38+
Memcheck:Leak
39+
match-leak-kinds: possible
40+
fun:malloc
41+
fun:malloc
42+
fun:_dlfo_mappings_segment_allocate
43+
fun:_dl_find_object_update_1
44+
fun:_dl_find_object_update
45+
fun:dl_open_worker_begin
46+
fun:_dl_catch_exception
47+
fun:dl_open_worker
48+
fun:_dl_catch_exception
49+
fun:_dl_open
50+
fun:dlopen_doit
51+
fun:_dl_catch_exception
52+
fun:_dl_catch_error
53+
fun:_dlerror_run
54+
fun:dlopen_implementation
55+
fun:dlopen@@GLIBC_*
56+
}
57+
58+
{
59+
Invalid write of size 8
60+
Memcheck:Addr8
61+
fun:memset
62+
fun:_ZN18providerConfigTest12write_memoryESt17basic_string_viewIcSt11char_traitsIcEE
63+
fun:_ZN44providerConfigTest_protection_flag_none_Test8TestBodyEv
64+
fun:_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
65+
fun:_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
66+
fun:_ZN7testing4Test3RunEv
67+
fun:_ZN7testing8TestInfo3RunEv
68+
fun:_ZN7testing9TestSuite3RunEv
69+
fun:_ZN7testing8internal12UnitTestImpl11RunAllTestsEv
70+
fun:_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc
71+
fun:_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc
72+
fun:_ZN7testing8UnitTest3RunEv
73+
}
74+
75+
{
76+
4,608 bytes in 2 blocks are possibly lost in loss record 342 of 346
77+
Memcheck:Leak
78+
match-leak-kinds: possible
79+
fun:malloc
80+
fun:malloc
81+
fun:_dlfo_mappings_segment_allocate
82+
fun:_dl_find_object_update_1
83+
fun:_dl_find_object_update
84+
fun:dl_open_worker_begin
85+
fun:_dl_catch_exception
86+
fun:dl_open_worker
87+
fun:_dl_catch_exception
88+
fun:_dl_open
89+
fun:dlopen_doit
90+
fun:_dl_catch_exception
91+
fun:_dl_catch_error
92+
fun:_dlerror_run
93+
fun:dlopen_implementation
94+
fun:dlopen@@GLIBC_*
95+
}
96+
97+
{
98+
4,608 bytes in 2 blocks are possibly lost in loss record 343 of 347
99+
Memcheck:Leak
100+
match-leak-kinds: possible
101+
fun:malloc
102+
fun:malloc
103+
fun:_dlfo_mappings_segment_allocate
104+
fun:_dl_find_object_update_1
105+
fun:_dl_find_object_update
106+
fun:dl_open_worker_begin
107+
fun:_dl_catch_exception
108+
fun:dl_open_worker
109+
fun:_dl_catch_exception
110+
fun:_dl_open
111+
fun:dlopen_doit
112+
fun:_dl_catch_exception
113+
fun:_dl_catch_error
114+
fun:_dlerror_run
115+
fun:dlopen_implementation
116+
fun:dlopen@@GLIBC_*
117+
}

0 commit comments

Comments
 (0)