Re: [PATCH v2 kvm-unit-tests] runtime.bash: skip test when checked file doesn't exist

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

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.

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.

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
> 




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux