diff mbox series

[kvm-unit-tests] runtime: SKIP if required sysfs file is missing

Message ID 20200929122317.889256-1-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show
Series [kvm-unit-tests] runtime: SKIP if required sysfs file is missing | expand

Commit Message

Paolo Bonzini Sept. 29, 2020, 12:23 p.m. UTC
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>
---
 scripts/runtime.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrew Jones Sept. 29, 2020, 1:06 p.m. UTC | #1
On Tue, Sep 29, 2020 at 08:23:17AM -0400, Paolo Bonzini wrote:
> 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>
> ---
>  scripts/runtime.bash | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/runtime.bash b/scripts/runtime.bash
> index 3121c1f..f070e14 100644
> --- a/scripts/runtime.bash
> +++ b/scripts/runtime.bash
> @@ -118,7 +118,7 @@ function run()
>      for check_param in "${check[@]}"; do
>          path=${check_param%%=*}
>          value=${check_param#*=}
> -        if [ -f "$path" ] && [ "$(cat $path)" != "$value" ]; then
> +        if ! [ -f "$path" ] || [ "$(cat $path)" != "$value" ]; then
>              print_result "SKIP" $testname "" "$path not equal to $value"
>              return 2
>          fi
> -- 
> 2.26.2
>
 
Reviewed-by: Andrew Jones <drjones@redhat.com>
diff mbox series

Patch

diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index 3121c1f..f070e14 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -118,7 +118,7 @@  function run()
     for check_param in "${check[@]}"; do
         path=${check_param%%=*}
         value=${check_param#*=}
-        if [ -f "$path" ] && [ "$(cat $path)" != "$value" ]; then
+        if ! [ -f "$path" ] || [ "$(cat $path)" != "$value" ]; then
             print_result "SKIP" $testname "" "$path not equal to $value"
             return 2
         fi