diff mbox series

[PATCH-for-8.0] tests/vm: Update get_default_jobs() to work on non-x86_64 non-KVM hosts

Message ID 20221209164743.70836-1-philmd@linaro.org
State New
Headers show
Series [PATCH-for-8.0] tests/vm: Update get_default_jobs() to work on non-x86_64 non-KVM hosts | expand

Commit Message

Philippe Mathieu-Daudé Dec. 9, 2022, 4:47 p.m. UTC
On non-x86_64 host, if KVM is not available we get:

  Traceback (most recent call last):
    File "tests/vm/basevm.py", line 634, in main
      vm = vmcls(args, config=config)
    File "tests/vm/basevm.py", line 104, in __init__
      mem = max(4, args.jobs)
  TypeError: '>' not supported between instances of 'NoneType' and 'int'

Fix by always returning a -- not ideal but safe -- '1' value.

Fixes: b09539444a ("tests/vm: allow us to take advantage of MTTCG")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 tests/vm/basevm.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Thomas Huth Dec. 15, 2022, 10:12 a.m. UTC | #1
On 09/12/2022 17.47, Philippe Mathieu-Daudé wrote:
> On non-x86_64 host, if KVM is not available we get:
> 
>    Traceback (most recent call last):
>      File "tests/vm/basevm.py", line 634, in main
>        vm = vmcls(args, config=config)
>      File "tests/vm/basevm.py", line 104, in __init__
>        mem = max(4, args.jobs)
>    TypeError: '>' not supported between instances of 'NoneType' and 'int'
> 
> Fix by always returning a -- not ideal but safe -- '1' value.
> 
> Fixes: b09539444a ("tests/vm: allow us to take advantage of MTTCG")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   tests/vm/basevm.py | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
> index 2276364c42..23229e23d1 100644
> --- a/tests/vm/basevm.py
> +++ b/tests/vm/basevm.py
> @@ -569,8 +569,7 @@ def get_default_jobs():
>                   # more cores. but only up to a reasonable limit. User
>                   # can always override these limits with --jobs.
>                   return min(multiprocessing.cpu_count() // 2, 8)
> -        else:
> -            return 1
> +        return 1
>   
>       parser = argparse.ArgumentParser(
>           formatter_class=argparse.ArgumentDefaultsHelpFormatter,

Reviewed-by: Thomas Huth <thuth@redhat.com>
John Snow Jan. 6, 2023, 9:58 p.m. UTC | #2
On Fri, Dec 9, 2022 at 11:47 AM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> On non-x86_64 host, if KVM is not available we get:
>
>   Traceback (most recent call last):
>     File "tests/vm/basevm.py", line 634, in main
>       vm = vmcls(args, config=config)
>     File "tests/vm/basevm.py", line 104, in __init__
>       mem = max(4, args.jobs)
>   TypeError: '>' not supported between instances of 'NoneType' and 'int'
>
> Fix by always returning a -- not ideal but safe -- '1' value.
>
> Fixes: b09539444a ("tests/vm: allow us to take advantage of MTTCG")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: John Snow <jsnow@redhat.com>


> ---
>  tests/vm/basevm.py | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
> index 2276364c42..23229e23d1 100644
> --- a/tests/vm/basevm.py
> +++ b/tests/vm/basevm.py
> @@ -569,8 +569,7 @@ def get_default_jobs():
>                  # more cores. but only up to a reasonable limit. User
>                  # can always override these limits with --jobs.
>                  return min(multiprocessing.cpu_count() // 2, 8)
> -        else:
> -            return 1
> +        return 1
>
>      parser = argparse.ArgumentParser(
>          formatter_class=argparse.ArgumentDefaultsHelpFormatter,
> --
> 2.38.1
>
Alex Bennée Jan. 7, 2023, 3:13 p.m. UTC | #3
Philippe Mathieu-Daudé <philmd@linaro.org> writes:

> On non-x86_64 host, if KVM is not available we get:
>
>   Traceback (most recent call last):
>     File "tests/vm/basevm.py", line 634, in main
>       vm = vmcls(args, config=config)
>     File "tests/vm/basevm.py", line 104, in __init__
>       mem = max(4, args.jobs)
>   TypeError: '>' not supported between instances of 'NoneType' and 'int'
>
> Fix by always returning a -- not ideal but safe -- '1' value.
>
> Fixes: b09539444a ("tests/vm: allow us to take advantage of MTTCG")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Queued to testing/next, thanks.
diff mbox series

Patch

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 2276364c42..23229e23d1 100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -569,8 +569,7 @@  def get_default_jobs():
                 # more cores. but only up to a reasonable limit. User
                 # can always override these limits with --jobs.
                 return min(multiprocessing.cpu_count() // 2, 8)
-        else:
-            return 1
+        return 1
 
     parser = argparse.ArgumentParser(
         formatter_class=argparse.ArgumentDefaultsHelpFormatter,