]> Git Repo - qemu.git/commitdiff
tests/vm: Do not abuse parallelism when KVM is not available
authorPhilippe Mathieu-Daudé <[email protected]>
Sat, 13 Oct 2018 00:40:27 +0000 (02:40 +0200)
committerFam Zheng <[email protected]>
Fri, 26 Oct 2018 14:03:21 +0000 (22:03 +0800)
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20181013004034[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Fam Zheng <[email protected]>
tests/vm/basevm.py

index 834bc90cc1fe0dd35f5a240b126271fe996aa585..2bd32dc6cefeffefe118ce4963c89c7a43aff219 100755 (executable)
@@ -196,6 +196,13 @@ class BaseVM(object):
         return self._guest.qmp(*args, **kwargs)
 
 def parse_args(vm_name):
+
+    def get_default_jobs():
+        if kvm_available():
+            return multiprocessing.cpu_count() / 2
+        else:
+            return 1
+
     parser = optparse.OptionParser(
         description="VM test utility.  Exit codes: "
                     "0 = success, "
@@ -208,7 +215,7 @@ def parse_args(vm_name):
                       help="image file name")
     parser.add_option("--force", "-f", action="store_true",
                       help="force build image even if image exists")
-    parser.add_option("--jobs", type=int, default=multiprocessing.cpu_count() / 2,
+    parser.add_option("--jobs", type=int, default=get_default_jobs(),
                       help="number of virtual CPUs")
     parser.add_option("--verbose", "-V", action="store_true",
                       help="Pass V=1 to builds within the guest")
This page took 0.024 seconds and 4 git commands to generate.