Skip to content

Commit 7e97988

Browse files
bvanasscheingomolnar
authored andcommitted
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>
1 parent da087b2 commit 7e97988

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

‎tools/lib/lockdep/run_tests.sh‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if ! make >/dev/null; then
77
exit 1
88
fi
99

10-
for i in `ls tests/*.c`; do
10+
find tests -name '*.c' | sort | while read -r i; do
1111
testname=$(basename "$i" .c)
1212
echo -ne "$testname... "
1313
if gcc -o "tests/$testname" -pthread "$i" liblockdep.a -Iinclude -D__USE_LIBLOCKDEP &&
@@ -16,12 +16,10 @@ for i in `ls tests/*.c`; do
1616
else
1717
echo "FAILED!"
1818
fi
19-
if [ -f "tests/$testname" ]; then
20-
rm tests/$testname
21-
fi
19+
rm -f "tests/$testname"
2220
done
2321

24-
for i in `ls tests/*.c`; do
22+
find tests -name '*.c' | sort | while read -r i; do
2523
testname=$(basename "$i" .c)
2624
echo -ne "(PRELOAD) $testname... "
2725
if gcc -o "tests/$testname" -pthread -Iinclude "$i" &&
@@ -30,7 +28,5 @@ for i in `ls tests/*.c`; do
3028
else
3129
echo "FAILED!"
3230
fi
33-
if [ -f "tests/$testname" ]; then
34-
rm tests/$testname
35-
fi
31+
rm -f "tests/$testname"
3632
done

0 commit comments

Comments
 (0)