hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/tools/lib/lockdep/run_tests.sh
....@@ -1,32 +1,47 @@
11 #! /bin/bash
22 # SPDX-License-Identifier: GPL-2.0
33
4
-make &> /dev/null
4
+if ! make >/dev/null; then
5
+ echo "Building liblockdep failed."
6
+ echo "FAILED!"
7
+ exit 1
8
+fi
59
6
-for i in `ls tests/*.c`; do
10
+find tests -name '*.c' | sort | while read -r i; do
711 testname=$(basename "$i" .c)
8
- gcc -o tests/$testname -pthread $i liblockdep.a -Iinclude -D__USE_LIBLOCKDEP &> /dev/null
912 echo -ne "$testname... "
10
- if [ $(timeout 1 ./tests/$testname 2>&1 | wc -l) -gt 0 ]; then
13
+ if gcc -o "tests/$testname" -pthread "$i" liblockdep.a -Iinclude -D__USE_LIBLOCKDEP &&
14
+ timeout 1 "tests/$testname" 2>&1 | /bin/bash "tests/${testname}.sh"; then
1115 echo "PASSED!"
1216 else
1317 echo "FAILED!"
1418 fi
15
- if [ -f "tests/$testname" ]; then
16
- rm tests/$testname
17
- fi
19
+ rm -f "tests/$testname"
1820 done
1921
20
-for i in `ls tests/*.c`; do
22
+find tests -name '*.c' | sort | while read -r i; do
2123 testname=$(basename "$i" .c)
22
- gcc -o tests/$testname -pthread -Iinclude $i &> /dev/null
2324 echo -ne "(PRELOAD) $testname... "
24
- if [ $(timeout 1 ./lockdep ./tests/$testname 2>&1 | wc -l) -gt 0 ]; then
25
+ if gcc -o "tests/$testname" -pthread -Iinclude "$i" &&
26
+ timeout 1 ./lockdep "tests/$testname" 2>&1 |
27
+ /bin/bash "tests/${testname}.sh"; then
2528 echo "PASSED!"
2629 else
2730 echo "FAILED!"
2831 fi
29
- if [ -f "tests/$testname" ]; then
30
- rm tests/$testname
32
+ rm -f "tests/$testname"
33
+done
34
+
35
+find tests -name '*.c' | sort | while read -r i; do
36
+ testname=$(basename "$i" .c)
37
+ echo -ne "(PRELOAD + Valgrind) $testname... "
38
+ if gcc -o "tests/$testname" -pthread -Iinclude "$i" &&
39
+ { timeout 10 valgrind --read-var-info=yes ./lockdep "./tests/$testname" >& "tests/${testname}.vg.out"; true; } &&
40
+ /bin/bash "tests/${testname}.sh" < "tests/${testname}.vg.out" &&
41
+ ! grep -Eq '(^==[0-9]*== (Invalid |Uninitialised ))|Mismatched free|Source and destination overlap| UME ' "tests/${testname}.vg.out"; then
42
+ echo "PASSED!"
43
+ else
44
+ echo "FAILED!"
3145 fi
46
+ rm -f "tests/$testname"
3247 done