From 75ca357b03f227fbae3b0a55a2d2928b975208d5 Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Wed, 18 Sep 2013 11:46:08 +0200 Subject: [PATCH] tests: do not skip installed shell tests When installed, the test scripts lose their ".sh" suffix, causing them to be skipped by the "run" script. With this patch, the tests are no longer specified with ".sh" suffix in the run script, and the suffix is added automatically as necessary. Change-Id: I0b72312e79992b9818559c6546a0e52cd95184c2 --- test/run | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/test/run b/test/run index bc242c6bc..5c57cb966 100755 --- a/test/run +++ b/test/run @@ -17,6 +17,8 @@ skipped=`expr 0` # count number of tests that were skipped total=`expr 0` # total number of tests tried badones= # list of tests that failed +# In the lists below, shell scripts should be listed without ".sh" suffix + # Tests which require setuid setuids="test11 test33 test43 test44 test46 test56 test60 test61 test65 \ test69 test76 test77" # test73" @@ -25,7 +27,7 @@ alltests=" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \ 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 \ 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 \ 61 62 63 64 65 66 67 68 69 70 71 72 75 76 77 \ - sh1.sh sh2.sh interp.sh" + sh1 sh2 interp" tests_no=`expr 0` # test mmap only if enabled in sysenv @@ -71,7 +73,7 @@ done # Count tests for i in `echo $tests`; do - if [ -x ./test$i ]; then + if [ -x ./test$i -o -x ./test${i}.sh ]; then tests_no=`expr $tests_no + 1` fi done @@ -103,9 +105,14 @@ ARGS_63=`pwd`/mod runtest() { i=$1 ARG=$2 + # depending on where we are, scripts might have a .sh suffix or not + if [ -x test${i}.sh ] + then NAME=./test${i}.sh + else NAME=./test$i + fi if [ "$ROOT" ] - then su - bin -c "cd `pwd`; ./test$i $ARG" || return 1 - else ./test$i $ARG || return 1 + then su - bin -c "cd `pwd`; $NAME $ARG" || return 1 + else $NAME $ARG || return 1 fi return 0 } @@ -113,13 +120,11 @@ runtest() { # Run all the tests, keeping track of who failed. for i in `echo $tests` do - if [ -x ./test$i ] + if [ -x ./test$i -o -x ./test${i}.sh ] then total=`expr $total + 1` FAIL=0 - unset ARG - testid="`echo $i | sed 's/\..*//'`" - ARG=`eval echo "\\${ARGS_$testid}"` + ARG=`eval echo "\\${ARGS_$i}"` if [ "$tapmode" ] then out=out.$$