tests/vm: Update get_default_jobs() to work on non-x86_64 non-KVM hosts

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>
Message-Id: <20221209164743.70836-1-philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Philippe Mathieu-Daudé 2022-12-09 17:47:43 +01:00 committed by Thomas Huth
parent ad302b21aa
commit 44c8a6ab45

View file

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