parser.add_argument('--shuffle-tests', action='store_true',
dest='shuffle_tests',
help='Shuffle test cases to randomize order')
+ parser.add_argument('--split', help='split tests for parallel execution (<server number>/<total servers>)')
parser.add_argument('--no-reset', action='store_true', dest='no_reset',
help='Do not reset devices at the end of the test')
parser.add_argument('-f', dest='testmodules', metavar='<test module>',
report(conn, False, args.build, args.commit, run, name, 'NOTRUN', 0,
args.logdir)
+ if args.split:
+ vals = args.split.split('/')
+ split_server = int(vals[0])
+ split_total = int(vals[1])
+ logger.info("Parallel execution - %d/%d" % (split_server, split_total))
+ split_server -= 1
+ tests_to_run.sort(key=lambda t: t.__name__)
+ tests_to_run = [x for i,x in enumerate(tests_to_run) if i % split_total == split_server]
+
if args.shuffle_tests:
from random import shuffle
shuffle(tests_to_run)
your system's root filesystem (read-only) inside the VM. The options you
give it are passed through to run-all.sh, see there.
+To speed up testing, it is possible to run multiple VMs concurrently and
+split the test cases between all the VMs. If the host system has enough
+memory and CPU resources, this can significantly speed up the full test
+cycle. For example, a 4 core system with 4 GB of RAM can easily run 8
+parallel VMs (assuming valgrind is not used with its higher memory
+requirements). This can be run with:
+
+./parallel-vm.sh <number of VMs> [arguments..]
+
--------------------------------------------------------------------------------
--- /dev/null
+#!/bin/sh
+
+cd "$(dirname $0)"
+
+NUM=$1
+if [ -z "$NUM" ]; then
+ echo "usage: $0 <num servers> [params..]"
+ exit 1
+fi
+shift
+
+LOGS=/tmp/hwsim-test-logs
+mkdir -p $LOGS
+DATE=$(date +%s)
+
+for i in `seq 1 $NUM`; do
+ echo "Starting virtual machine $i/$NUM"
+ ./vm-run.sh --ext srv.$i --split $i/$NUM $* >> $LOGS/parallel-$DATE.srv.$i 2>&1 &
+done
+
+echo "Waiting for virtual machines to complete testing"
+wait
+echo "Testing completed"
+
+echo -n "PASS count: "
+grep ^PASS $LOGS/parallel-$DATE.srv.* | wc -l
+cat $LOGS/parallel-$DATE.srv.* | grep FAIL | sort