Commit a189c017 authored by Sedat Dilek's avatar Sedat Dilek Committed by Ingo Molnar

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=2Signed-off-by: default avatarSedat 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.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 5529578a
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
make &> /dev/null make &> /dev/null
for i in `ls tests/*.c`; do for i in `ls tests/*.c`; do
testname=$(basename -s .c "$i") testname=$(basename "$i" .c)
gcc -o tests/$testname -pthread -lpthread $i liblockdep.a -Iinclude -D__USE_LIBLOCKDEP &> /dev/null gcc -o tests/$testname -pthread -lpthread $i liblockdep.a -Iinclude -D__USE_LIBLOCKDEP &> /dev/null
echo -ne "$testname... " echo -ne "$testname... "
if [ $(timeout 1 ./tests/$testname | wc -l) -gt 0 ]; then if [ $(timeout 1 ./tests/$testname | wc -l) -gt 0 ]; then
...@@ -11,11 +11,13 @@ for i in `ls tests/*.c`; do ...@@ -11,11 +11,13 @@ for i in `ls tests/*.c`; do
else else
echo "FAILED!" echo "FAILED!"
fi fi
rm tests/$testname if [ -f "tests/$testname" ]; then
rm tests/$testname
fi
done done
for i in `ls tests/*.c`; do for i in `ls tests/*.c`; do
testname=$(basename -s .c "$i") testname=$(basename "$i" .c)
gcc -o tests/$testname -pthread -lpthread -Iinclude $i &> /dev/null gcc -o tests/$testname -pthread -lpthread -Iinclude $i &> /dev/null
echo -ne "(PRELOAD) $testname... " echo -ne "(PRELOAD) $testname... "
if [ $(timeout 1 ./lockdep ./tests/$testname | wc -l) -gt 0 ]; then if [ $(timeout 1 ./lockdep ./tests/$testname | wc -l) -gt 0 ]; then
...@@ -23,5 +25,7 @@ for i in `ls tests/*.c`; do ...@@ -23,5 +25,7 @@ for i in `ls tests/*.c`; do
else else
echo "FAILED!" echo "FAILED!"
fi fi
rm tests/$testname if [ -f "tests/$testname" ]; then
rm tests/$testname
fi
done done
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment