Skip to contentSkip to conversation

runtime.bash: skip test when checked file doesn't exist

PATCH Superseded Vitaly Kuznetsov 2 participants 3 messages Oct 14, 2020 – Oct 15, 2020 KVM

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 runtime.bash: skip test when checked file doesn't exist

Currently, we have the following check condition in x86/unittests.cfg:

check = /sys/module/kvm_intel/parameters/allow_smaller_maxphyaddr=Y

the check, however, passes successfully on AMD because the checked file is just missing. This doesn't sound right, reverse the check: fail if the content of the file doesn't match the expectation or if the file is not there.

---
 scripts/runtime.bash | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/runtime.bash +4 -1
index 3121c1ffdae8..f94c094de03b 100644
@@ -118,7 +118,10 @@ function run()
     for check_param in "${check[@]}"; do
         path=${check_param%%=*}
         value=${check_param#*=}
-        if [ -f "$path" ] && [ "$(cat $path)" != "$value" ]; then
+	if [ -z "$path" ]; then
+            continue
+	fi
+        if [ ! -f "$path" ] || [ "$(cat $path)" != "$value" ]; then
             print_result "SKIP" $testname "" "$path not equal to $value"
             return 2
         fi
Signature · 1 line
2.25.4
#1 lore raw
Quoted 19 lines · Vitaly Kuznetsov

Currently, we have the following check condition in x86/unittests.cfg:

check = /sys/module/kvm_intel/parameters/allow_smaller_maxphyaddr=Y

the check, however, passes successfully on AMD because the checked file is just missing. This doesn't sound right, reverse the check: fail if the content of the file doesn't match the expectation or if the file is not there.

---
 scripts/runtime.bash | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/runtime.bash +0 -0
index 3121c1ffdae8..f94c094de03b 100644

scripts/runtime.bash function run() · line 123

Quoted 7 lines
scripts/runtime.bash +3 -1
@@ -118,7 +118,10 @@ function run()
     for check_param in "${check[@]}"; do
         path=${check_param%%=*}
         value=${check_param#*=}
-        if [ -f "$path" ] && [ "$(cat $path)" != "$value" ]; then
+	if [ -z "$path" ]; then
+            continue
+	fi

That runtime.bash script seems to use spaces for indentation, not tabs ... so could you please use spaces for your patch, too?

Thanks,
Thomas

#2 lore raw
Quoted 15 lines · Thomas Huth
Quoted 14 lines · Vitaly Kuznetsov

Currently, we have the following check condition in x86/unittests.cfg:

check = /sys/module/kvm_intel/parameters/allow_smaller_maxphyaddr=Y

the check, however, passes successfully on AMD because the checked file is just missing. This doesn't sound right, reverse the check: fail if the content of the file doesn't match the expectation or if the file is not there.

---
 scripts/runtime.bash | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 16 lines

scripts/runtime.bash function run() · line 123

Quoted 12 lines
scripts/runtime.bash +3 -1
index 3121c1ffdae8..f94c094de03b 100644
@@ -118,7 +118,10 @@ function run()
     for check_param in "${check[@]}"; do
         path=${check_param%%=*}
         value=${check_param#*=}
-        if [ -f "$path" ] && [ "$(cat $path)" != "$value" ]; then
+	if [ -z "$path" ]; then
+            continue
+	fi

That runtime.bash script seems to use spaces for indentation, not tabs ... so could you please use spaces for your patch, too?

Yea, trusted my editior to do the right thing and it let me down... v2 is coming!

Signature · 1 line
Vitaly