aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2018-12-06 20:11:26 -0500
committerIngo Molnar <mingo@kernel.org>2018-12-11 08:54:48 -0500
commit7e9798871a9186cb831cf693d7ff58085384ccbd (patch)
tree0acedfaaff5e24b5ac63152074787760ece4634f
parentda087b2229618f78ecea5c203fed8ba2245de636 (diff)
tools/lib/lockdep/tests: Fix shellcheck warnings
Use find instead of ls to avoid splitting filenames that contain spaces. Use rm -f instead of if ... then rm ...; fi. This patch addresses all shellcheck complaints about the run_tests.sh shell script. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Johannes Berg <johannes@sipsolutions.net> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sasha Levin <sasha.levin@oracle.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Waiman Long <longman@redhat.com> Cc: johannes.berg@intel.com Cc: tj@kernel.org Link: https://lkml.kernel.org/r/20181207011148.251812-3-bvanassche@acm.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rwxr-xr-xtools/lib/lockdep/run_tests.sh12
1 files changed, 4 insertions, 8 deletions
diff --git a/tools/lib/lockdep/run_tests.sh b/tools/lib/lockdep/run_tests.sh
index 9f31f84e7fac..253719ee6377 100755
--- a/tools/lib/lockdep/run_tests.sh
+++ b/tools/lib/lockdep/run_tests.sh
@@ -7,7 +7,7 @@ if ! make >/dev/null; then
7 exit 1 7 exit 1
8fi 8fi
9 9
10for i in `ls tests/*.c`; do 10find tests -name '*.c' | sort | while read -r i; do
11 testname=$(basename "$i" .c) 11 testname=$(basename "$i" .c)
12 echo -ne "$testname... " 12 echo -ne "$testname... "
13 if gcc -o "tests/$testname" -pthread "$i" liblockdep.a -Iinclude -D__USE_LIBLOCKDEP && 13 if gcc -o "tests/$testname" -pthread "$i" liblockdep.a -Iinclude -D__USE_LIBLOCKDEP &&
@@ -16,12 +16,10 @@ for i in `ls tests/*.c`; do
16 else 16 else
17 echo "FAILED!" 17 echo "FAILED!"
18 fi 18 fi
19 if [ -f "tests/$testname" ]; then 19 rm -f "tests/$testname"
20 rm tests/$testname
21 fi
22done 20done
23 21
24for i in `ls tests/*.c`; do 22find tests -name '*.c' | sort | while read -r i; do
25 testname=$(basename "$i" .c) 23 testname=$(basename "$i" .c)
26 echo -ne "(PRELOAD) $testname... " 24 echo -ne "(PRELOAD) $testname... "
27 if gcc -o "tests/$testname" -pthread -Iinclude "$i" && 25 if gcc -o "tests/$testname" -pthread -Iinclude "$i" &&
@@ -30,7 +28,5 @@ for i in `ls tests/*.c`; do
30 else 28 else
31 echo "FAILED!" 29 echo "FAILED!"
32 fi 30 fi
33 if [ -f "tests/$testname" ]; then 31 rm -f "tests/$testname"
34 rm tests/$testname
35 fi
36done 32done