From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, kvm@vger.kernel.org
Cc: Thomas Huth <thuth@redhat.com>, Andrew Jones <drjones@redhat.com>
Subject: Re: [PATCH v2 kvm-unit-tests] runtime.bash: skip test when checked file doesn't exist
Date: Thu, 15 Oct 2020 15:51:16 +0200 [thread overview]
Message-ID: <87ft6f61ij.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <ff61058b-0960-a61b-d35b-af059c1a23bf@redhat.com>
Paolo Bonzini <pbonzini@redhat.com> writes:
> On 15/10/20 10:38, 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>
>
> Hi Vitaly, I had already posted a fix for this but I pushed it only to
> my repo and not to upstream (still getting used to CI!). I pushed it
> now.
Hm, I still don't see it on gitlab but as long as the bug is fixed I'm
fine ;-)
>
> My fix actually checked whether ${check} was not empty at all. That
> said, the usage of ${check[@]} is wrong because $check is not an array.
> So it would break if we wanted to have more than one check.
Oh, yes, I see.
>
> Paolo
>
>> ---
>> Changes since v1:
>> - tabs -> spaces [Thomas]
>> ---
>> scripts/runtime.bash | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/scripts/runtime.bash b/scripts/runtime.bash
>> index 3121c1ffdae8..99d242d5cf8c 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
>>
>
--
Vitaly
prev parent reply other threads:[~2020-10-15 13:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-15 8:38 [PATCH v2 kvm-unit-tests] runtime.bash: skip test when checked file doesn't exist Vitaly Kuznetsov
2020-10-15 8:43 ` Andrew Jones
2020-10-15 12:03 ` Paolo Bonzini
2020-10-15 13:51 ` Vitaly Kuznetsov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ft6f61ij.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.