summaryrefslogtreecommitdiff
path: root/tests/vm/basevm.py
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2018-10-13 02:40:27 +0200
committerFam Zheng <famz@redhat.com>2018-10-26 22:03:21 +0800
commit8a6e007e784b1a878474cd1d86f576a4c40f99e1 (patch)
tree98a11a57cecca18e7953bbd1774a3f7b6d41ffa6 /tests/vm/basevm.py
parentb59b82ededdde6ec3e63a666f5c0cfb5a3f22e2e (diff)
downloadqemu-8a6e007e784b1a878474cd1d86f576a4c40f99e1.zip
tests/vm: Do not abuse parallelism when KVM is not available
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20181013004034.6968-3-f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com>
Diffstat (limited to 'tests/vm/basevm.py')
-rwxr-xr-xtests/vm/basevm.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 834bc90cc1..2bd32dc6ce 100755
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -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")