From e1653fc399d9f8fec3cc11e2e85f7806125b3ffd Mon Sep 17 00:00:00 2001 From: Qiu Yu Date: Wed, 16 Oct 2013 09:31:45 +0800 Subject: [PATCH] Add testr concurrency option for run_tests.sh By exposing this testr concurrency option, run_tests.sh can now specify how many processes to run the tests. If not specified, default 0 utilize maximum CPUs available. Change-Id: I1a518ae67db32d9838e4a3584cfc3af14212be3c --- run_tests.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/run_tests.sh b/run_tests.sh index 590cacb679d5..bb4e72c002e6 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -23,6 +23,8 @@ function usage { echo " Default: .venv" echo " --tools-path Location of the tools directory" echo " Default: \$(pwd)" + echo " --concurrency How many processes to use when running the tests. A value of 0 autodetects concurrency from your CPU count" + echo " Default: 0" echo "" echo "Note: with no options specified, the script will try to run the tests in a virtual environment," echo " If no virtualenv is found, the script will ask if you would like to create one. If you " @@ -56,6 +58,10 @@ function process_options { (( i++ )) tools_path=${!i} ;; + --concurrency) + (( i++ )) + concurrency=${!i} + ;; -*) testropts="$testropts ${!i}";; *) testrargs="$testrargs ${!i}" esac @@ -80,6 +86,7 @@ no_pep8=0 coverage=0 debug=0 update=0 +concurrency=0 LANG=en_US.UTF-8 LANGUAGE=en_US:en @@ -124,7 +131,7 @@ function run_tests { # Just run the test suites in current environment set +e testrargs=`echo "$testrargs" | sed -e's/^\s*\(.*\)\s*$/\1/'` - TESTRTESTS="$TESTRTESTS --testr-args='--subunit $testropts $testrargs'" + TESTRTESTS="$TESTRTESTS --testr-args='--subunit --concurrency $concurrency $testropts $testrargs'" if [ setup.cfg -nt nova.egg-info/entry_points.txt ] then ${wrapper} python setup.py egg_info