Skip to content

Commit

Permalink
tools/lib/lockdep/tests: Improve testing accuracy
Browse files Browse the repository at this point in the history
Instead of checking whether the tests produced any output, check the
output itself. This patch avoids that e.g. debug output causes the
message "PASSED!" to be reported for failed tests.

Signed-off-by: Bart Van Assche <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Johannes Berg <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Sasha Levin <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Waiman Long <[email protected]>
Cc: [email protected]
Cc: [email protected]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
bvanassche authored and Ingo Molnar committed Dec 11, 2018
1 parent 7e97988 commit 5ecb8e9
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/lib/lockdep/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ find tests -name '*.c' | sort | while read -r i; do
testname=$(basename "$i" .c)
echo -ne "$testname... "
if gcc -o "tests/$testname" -pthread "$i" liblockdep.a -Iinclude -D__USE_LIBLOCKDEP &&
[ "$(timeout 1 "./tests/$testname" 2>&1 | wc -l)" -gt 0 ]; then
timeout 1 "tests/$testname" 2>&1 | "tests/${testname}.sh"; then
echo "PASSED!"
else
echo "FAILED!"
Expand All @@ -23,7 +23,8 @@ find tests -name '*.c' | sort | while read -r i; do
testname=$(basename "$i" .c)
echo -ne "(PRELOAD) $testname... "
if gcc -o "tests/$testname" -pthread -Iinclude "$i" &&
[ "$(timeout 1 ./lockdep "./tests/$testname" 2>&1 | wc -l)" -gt 0 ]; then
timeout 1 ./lockdep "tests/$testname" 2>&1 |
"tests/${testname}.sh"; then
echo "PASSED!"
else
echo "FAILED!"
Expand Down
2 changes: 2 additions & 0 deletions tools/lib/lockdep/tests/AA.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
grep -q 'WARNING: possible recursive locking detected'
2 changes: 2 additions & 0 deletions tools/lib/lockdep/tests/ABA.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
grep -q 'WARNING: possible recursive locking detected'
2 changes: 2 additions & 0 deletions tools/lib/lockdep/tests/ABBA.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
grep -q 'WARNING: possible circular locking dependency detected'
2 changes: 2 additions & 0 deletions tools/lib/lockdep/tests/ABBA_2threads.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
grep -q 'WARNING: possible circular locking dependency detected'
2 changes: 2 additions & 0 deletions tools/lib/lockdep/tests/ABBCCA.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
grep -q 'WARNING: possible circular locking dependency detected'
2 changes: 2 additions & 0 deletions tools/lib/lockdep/tests/ABBCCDDA.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
grep -q 'WARNING: possible circular locking dependency detected'
2 changes: 2 additions & 0 deletions tools/lib/lockdep/tests/ABCABC.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
grep -q 'WARNING: possible circular locking dependency detected'
2 changes: 2 additions & 0 deletions tools/lib/lockdep/tests/ABCDBCDA.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
grep -q 'WARNING: possible circular locking dependency detected'
2 changes: 2 additions & 0 deletions tools/lib/lockdep/tests/ABCDBDDA.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
grep -q 'WARNING: possible circular locking dependency detected'
2 changes: 2 additions & 0 deletions tools/lib/lockdep/tests/WW.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
grep -q 'WARNING: possible recursive locking detected'
2 changes: 2 additions & 0 deletions tools/lib/lockdep/tests/unlock_balance.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
grep -q 'WARNING: bad unlock balance detected'

0 comments on commit 5ecb8e9

Please sign in to comment.