diff mbox

[kvm-unit-tests,v2,08/12] scripts/run: generalize check

Message ID 1450374823-7648-9-git-send-email-rkrcmar@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Radim Krčmář Dec. 17, 2015, 5:53 p.m. UTC
config attribute "check" is currently unused.
Provide a simple implementation instead of removing it.

Signed-off-by: Radim Kr?má? <rkrcmar@redhat.com>
---
 v2:
 - update scripts/mkstandalone.sh [Drew]
 - don't print too much [Drew]
 - log the output of check command
 - use $testname
 
 scripts/run.bash | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
diff mbox

Patch

diff --git a/scripts/run.bash b/scripts/run.bash
index b92611c29fbb..f532cb9e8b1c 100644
--- a/scripts/run.bash
+++ b/scripts/run.bash
@@ -22,17 +22,11 @@  function run()
         return
     fi
 
-    # check a file for a particular value before running a test
-    # the check line can contain multiple files to check separated by a space
-    # but each check parameter needs to be of the form <path>=<value>
-    for check_param in ${check[@]}; do
-        path=${check_param%%=*}
-        value=${check_param#*=}
-        if [ "$path" ] && [ "$(cat $path)" != "$value" ]; then
-            echo "skip $1 ($path not equal to $value)"
-            return
-        fi
-    done
+    __eval_log "$check" || {
+        __eval_log 'echo "skipped $testname (check returned $?)"'
+        echo "skip $testname (failed check)"
+        return
+    }
 
     cmdline="TESTNAME=$testname ACCEL=$accel __run $kernel -smp $smp $opts"
     if [ "$verbose" -a "$verbose" != 0 ]; then