Skip to contentSkip to conversation

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

PATCH-for-8.0 Philippe Mathieu-Daudé 4 participants 4 messages Dec 9, 2022 – Jan 7, 2023

lore
Share & tools
lore
#0 lore raw

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")
---
 tests/vm/basevm.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tests/vm/basevm.py +1 -2
index 2276364c42..23229e23d1 100644
@@ -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,
Signature · 1 line
2.38.1
Reviewed-by
#1 lore raw
Quoted 22 lines · Philippe Mathieu-Daudé

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")
---
  tests/vm/basevm.py | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
tests/vm/basevm.py +0 -0
index 2276364c42..23229e23d1 100644

tests/vm/basevm.py def get_default_jobs(): · line 575

Quoted 9 lines
tests/vm/basevm.py +1 -2
@@ -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
#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé

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'

Quoted 4 lines

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

Fixes b09539444a ("tests/vm: allow us to take advantage of MTTCG")
Quoted 21 lines
---
 tests/vm/basevm.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tests/vm/basevm.py +1 -3
index 2276364c42..23229e23d1 100644
@@ -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

#3 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 9 lines · Philippe Mathieu-Daudé

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'

Quoted 4 lines

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

Fixes b09539444a ("tests/vm: allow us to take advantage of MTTCG")

Queued to testing/next, thanks.

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro