[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181128234325.110011-3-bvanassche@acm.org>
Date: Wed, 28 Nov 2018 15:43:00 -0800
From: Bart Van Assche <bvanassche@....org>
To: mingo@...hat.com
Cc: peterz@...radead.org, tj@...nel.org, johannes.berg@...el.com,
linux-kernel@...r.kernel.org, Bart Van Assche <bvanassche@....org>
Subject: [PATCH 02/27] 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@....org>
---
tools/lib/lockdep/run_tests.sh | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/tools/lib/lockdep/run_tests.sh b/tools/lib/lockdep/run_tests.sh
index eef3fe4a24fe..e4f41318aa79 100755
--- a/tools/lib/lockdep/run_tests.sh
+++ b/tools/lib/lockdep/run_tests.sh
@@ -6,7 +6,7 @@ if ! make >/dev/null; then
echo "FAILED!"
fi
-for i in `ls tests/*.c`; do
+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 &&
@@ -15,12 +15,10 @@ for i in `ls tests/*.c`; do
else
echo "FAILED!"
fi
- if [ -f "tests/$testname" ]; then
- rm tests/$testname
- fi
+ rm -f "tests/$testname"
done
-for i in `ls tests/*.c`; do
+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" &&
@@ -29,7 +27,5 @@ for i in `ls tests/*.c`; do
else
echo "FAILED!"
fi
- if [ -f "tests/$testname" ]; then
- rm tests/$testname
- fi
+ rm -f "tests/$testname"
done
--
2.20.0.rc0.387.gc7a69e6b6c-goog
Powered by blists - more mailing lists