From 5554fbef46710c1317dc7f35889bc7e888026a25 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 21 Dec 2014 22:04:54 +0200 Subject: [PATCH] tests: Make parallel VM start a bit more resource friendly Wait one second between each kvm start to avoid hitting large number of processes trying to start in parallel. This allows the VMs to be started more efficiently for parallel-vm.py runs with large number of VMs. Signed-off-by: Jouni Malinen --- tests/hwsim/vm/parallel-vm.py | 2 +- tests/hwsim/vm/vm-run.sh | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/vm/parallel-vm.py b/tests/hwsim/vm/parallel-vm.py index a1e253c45..4ab2eede6 100755 --- a/tests/hwsim/vm/parallel-vm.py +++ b/tests/hwsim/vm/parallel-vm.py @@ -192,7 +192,7 @@ def main(): vm = {} for i in range(0, num_servers): print("\rStarting virtual machine {}/{}".format(i + 1, num_servers)), - cmd = ['./vm-run.sh', '--timestamp', str(timestamp), + cmd = ['./vm-run.sh', '--delay', str(i), '--timestamp', str(timestamp), '--ext', 'srv.%d' % (i + 1), '-i'] + codecov_args + extra_args vm[i] = {} diff --git a/tests/hwsim/vm/vm-run.sh b/tests/hwsim/vm/vm-run.sh index e6d99d354..77703bf58 100755 --- a/tests/hwsim/vm/vm-run.sh +++ b/tests/hwsim/vm/vm-run.sh @@ -47,6 +47,7 @@ TIMESTAMP=$(date +%s) DATE=$TIMESTAMP CODECOV=no TIMEWARP=0 +DELAY=0 CODECOV_DIR= while [ "$1" != "" ]; do case $1 in @@ -68,6 +69,10 @@ while [ "$1" != "" ]; do --timewrap ) shift TIMEWARP=1 ;; + --delay ) shift + DELAY=$1 + shift + ;; * ) RUN_TEST_ARGS="$RUN_TEST_ARGS$1 " shift @@ -89,6 +94,11 @@ else CODECOV=no fi +if [ $DELAY -gt 0 ]; then + echo "Wait $DELAY seconds before starting VM" + sleep $DELAY +fi + echo "Starting test run in a virtual machine" kvm \