kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH kvm-unit-tests] runtime.bash: skip test when checked file doesn't exist
@ 2020-10-14 15:42 Vitaly Kuznetsov
  2020-10-14 15:54 ` Thomas Huth
  0 siblings, 1 reply; 3+ messages in thread
From: Vitaly Kuznetsov @ 2020-10-14 15:42 UTC (permalink / raw)
  To: kvm, Paolo Bonzini; +Cc: Thomas Huth, Andrew Jones

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.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 scripts/runtime.bash | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index 3121c1ffdae8..f94c094de03b 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -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
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH kvm-unit-tests] runtime.bash: skip test when checked file doesn't exist
  2020-10-14 15:42 [PATCH kvm-unit-tests] runtime.bash: skip test when checked file doesn't exist Vitaly Kuznetsov
@ 2020-10-14 15:54 ` Thomas Huth
  2020-10-15  8:36   ` Vitaly Kuznetsov
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Huth @ 2020-10-14 15:54 UTC (permalink / raw)
  To: Vitaly Kuznetsov, kvm, Paolo Bonzini; +Cc: Andrew Jones

On 14/10/2020 17.42, Vitaly Kuznetsov wrote:
> 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.
> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
>  scripts/runtime.bash | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/runtime.bash b/scripts/runtime.bash
> index 3121c1ffdae8..f94c094de03b 100644
> --- a/scripts/runtime.bash
> +++ b/scripts/runtime.bash
> @@ -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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH kvm-unit-tests] runtime.bash: skip test when checked file doesn't exist
  2020-10-14 15:54 ` Thomas Huth
@ 2020-10-15  8:36   ` Vitaly Kuznetsov
  0 siblings, 0 replies; 3+ messages in thread
From: Vitaly Kuznetsov @ 2020-10-15  8:36 UTC (permalink / raw)
  To: Thomas Huth; +Cc: Andrew Jones, kvm, Paolo Bonzini

Thomas Huth <thuth@redhat.com> writes:

> On 14/10/2020 17.42, Vitaly Kuznetsov wrote:
>> 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.
>> 
>> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
>> ---
>>  scripts/runtime.bash | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>> 
>> diff --git a/scripts/runtime.bash b/scripts/runtime.bash
>> index 3121c1ffdae8..f94c094de03b 100644
>> --- a/scripts/runtime.bash
>> +++ b/scripts/runtime.bash
>> @@ -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!

-- 
Vitaly


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-15  8:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14 15:42 [PATCH kvm-unit-tests] runtime.bash: skip test when checked file doesn't exist Vitaly Kuznetsov
2020-10-14 15:54 ` Thomas Huth
2020-10-15  8:36   ` Vitaly Kuznetsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).