Ugly helpers will get us yellow "SKIP" to stdout and 77 on exit.

Signed-off-by: Radim Krčmář <rkrc...@redhat.com>
---
 v2: new
 
 scripts/mkstandalone.sh |  6 +++---
 scripts/run.bash        | 25 ++++++++++++++++---------
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh
index c37f694398b8..adb11abf650c 100755
--- a/scripts/mkstandalone.sh
+++ b/scripts/mkstandalone.sh
@@ -66,7 +66,7 @@ cat scripts/run.bash >> $standalone
 
 if [ ! -f $kernel ]; then
        cat <<EOF >> $standalone
-echo "skip $testname (test kernel not present)" 1>&2
+echo "\$(SKIP) $testname (test kernel not present)"
 exit 1
 EOF
 else
@@ -89,8 +89,8 @@ echo \$qemu $cmdline -smp $smp $opts
 
 cmdline="\`echo '$cmdline' | sed s%$kernel%_NO_FILE_4Uhere_%\`"
 if \$qemu \$cmdline 2>&1 | grep 'No accelerator found' >/dev/null; then
-       echo "skip $testname (QEMU doesn't support KVM)"
-       exit 1
+       echo "\$(SKIP) $testname (QEMU doesn't support KVM)"
+       exit \$EXIT_SKIP
 fi
 
 __run()
diff --git a/scripts/run.bash b/scripts/run.bash
index d3e8d37d315d..06a13b9aaf1a 100644
--- a/scripts/run.bash
+++ b/scripts/run.bash
@@ -1,3 +1,10 @@
+PASS() { echo -ne "\e[32mPASS\e[0m"; }
+SKIP() { echo -ne "\e[33mSKIP\e[0m"; }
+FAIL() { echo -ne "\e[31mFAIL\e[0m"; }
+
+EXIT_SUCCESS=0
+EXIT_SKIP=77
+
 function run()
 {
     local testname="$1"
@@ -10,22 +17,22 @@ function run()
     local accel="$8"
 
     if [ -z "$testname" ]; then
-        return
+        return $EXIT_SKIP
     fi
 
     if [ -n "$only_group" ] && ! grep -q "$only_group" <<<$groups; then
-        return
+        return $EXIT_SKIP
     fi
 
     if [ -n "$arch" ] && [ "$arch" != "$ARCH" ]; then
-        echo "skip $1 ($arch only)"
-        return
+        echo "`SKIP` $testname ($arch only)"
+        return $EXIT_SKIP
     fi
 
     __eval_log "$check" || {
         __eval_log 'echo "skipped $testname (check returned $?)"'
-        echo "skip $testname (failed check)"
-        return
+        echo "`SKIP` $testname (failed check)"
+        return $EXIT_SKIP
     }
 
     cmdline="TESTNAME=$testname ACCEL=$accel __run $kernel -smp $smp $opts"
@@ -41,9 +48,9 @@ function run()
     ret=$(($? >> 1))
 
     case $ret in
-    0)  echo -ne "\e[32mPASS\e[0m" ;;
-    77) echo -ne "\e[33mSKIP\e[0m" ;;
-    *)  echo -ne "\e[31mFAIL\e[0m"
+    $EXIT_SUCCESS) PASS ;;
+    $EXIT_SKIP)    SKIP ;;
+    *)             FAIL
     esac
 
     echo -n " $testname"
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to