runtime: SKIP if required sysfs file is missing
This fixes the test once more, so that we correctly skip for
example access-reduced-maxphyaddr on AMD processors.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index 3121c1f..132389c 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -115,14 +115,16 @@
# 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 [ -f "$path" ] && [ "$(cat $path)" != "$value" ]; then
- print_result "SKIP" $testname "" "$path not equal to $value"
- return 2
- fi
- done
+ if [ "$check" ]; then
+ for check_param in "${check[@]}"; do
+ path=${check_param%%=*}
+ value=${check_param#*=}
+ if ! [ -f "$path" ] || [ "$(cat $path)" != "$value" ]; then
+ print_result "SKIP" $testname "" "$path not equal to $value"
+ return 2
+ fi
+ done
+ fi
last_line=$(premature_failure > >(tail -1)) && {
print_result "SKIP" $testname "" "$last_line"