Skip to content

Commit a189c01

Browse files
dileksingomolnar
authored andcommitted
tools/lib/lockdep: Fix unsupported 'basename -s' in run_tests.sh
Here on Ubuntu/precise I have GNU/coreutils v8.13 installed where 'basename -s' is not supported. The result is that run_tests.sh is not done properly. How to reproduce: $ cd $BUILD_DIR $ LC_ALL=C make -C tools/ liblockdep $ cd tools/lib/lockdep/ $ LC_ALL=C ./run_tests.sh basename: invalid option -- 's' Try `basename --help' for more information. ... timeout: failed to run command `./tests/': Permission denied FAILED! rm: cannot remove `tests/': Is a directory Due to unsupported basename the tests programs are not generated and cannot be removed. Fix this by doing a compatible basename invocation and check for the existence of generated tests programs. For more details see this LKML thread: http://marc.info/?t=145906667300001&r=1&w=2 Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com> Cc: Boqun Feng <boqun.feng@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sasha Levin <sasha.levin@oracle.com> (maintainer:LIBLOCKDEP) Cc: Shuah Khan <shuahkh@osg.samsung.com> Cc: Theodore Ts'o <tytso@mit.edu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org> Link: http://lkml.kernel.org/r/1459326169-7009-1-git-send-email-sedat.dilek@gmail.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 5529578 commit a189c01

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎tools/lib/lockdep/run_tests.sh‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,29 @@
33
make &> /dev/null
44

55
for i in `ls tests/*.c`; do
6-
testname=$(basename -s .c "$i")
6+
testname=$(basename "$i" .c)
77
gcc -o tests/$testname -pthread -lpthread $i liblockdep.a -Iinclude -D__USE_LIBLOCKDEP &> /dev/null
88
echo -ne "$testname... "
99
if [ $(timeout 1 ./tests/$testname | wc -l) -gt 0 ]; then
1010
echo "PASSED!"
1111
else
1212
echo "FAILED!"
1313
fi
14-
rm tests/$testname
14+
if [ -f "tests/$testname" ]; then
15+
rm tests/$testname
16+
fi
1517
done
1618

1719
for i in `ls tests/*.c`; do
18-
testname=$(basename -s .c "$i")
20+
testname=$(basename "$i" .c)
1921
gcc -o tests/$testname -pthread -lpthread -Iinclude $i &> /dev/null
2022
echo -ne "(PRELOAD) $testname... "
2123
if [ $(timeout 1 ./lockdep ./tests/$testname | wc -l) -gt 0 ]; then
2224
echo "PASSED!"
2325
else
2426
echo "FAILED!"
2527
fi
26-
rm tests/$testname
28+
if [ -f "tests/$testname" ]; then
29+
rm tests/$testname
30+
fi
2731
done

0 commit comments

Comments
 (0)