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

Radim Krčmář
2015-12-17T17:54:19Z

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 --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
--
2.6.4