Comment 3 for bug 1116942

Revision history for this message
Jean-Marc Saffroy (jean-marc-saffroy) wrote :

This change breaks the following use case:

#############

stack@vm:~/nova$ ./run_tests.sh -V test_libvirt_volume
Running `tools/with_venv.sh python setup.py testr --slowest --testr-args='--subunit -V'`
running testr
Usage: setup.py run [options] testfilters* doubledash? testargs*

Run the tests for a project and load them into testrepository.

Configuring via .testr.conf:
---
[DEFAULT]
test_command=foo $IDOPTION
test_id_option=--bar $IDFILE
---
will cause 'testr run' to run 'foo' to execute tests, and
'testr run --failing' will cause 'foo --bar failing.list ' to be run to
execute tests. Shell variables are expanded in these commands on platforms
that have a shell.

The full list of options and variables for .testr.conf:
* filter_tags -- a list of tags which should be used to filter test counts.
  This is useful for stripping out non-test results from the subunit stream
  such as Zope test layers. These filtered items are still considered for
  test failures.
* test_command -- command line to run to execute tests.
* test_id_option -- the value to substitute into test_command when specific
  test ids should be run.
* test_id_list_default -- the value to use for $IDLIST when no specific
  test ids are being run.
* test_list_option -- the option to use to cause the test runner to report
  on the tests it would run, rather than running them. When supplied the
  test_command should output on stdout all the test ids that would have
  been run if every other option and argument was honoured, one per line.
  This is required for parallel testing, and is substituted into $LISTOPT.
* test_run_concurrency -- Optional call out to establish concurrency.
  Should return one line containing the number of concurrent test runner
  processes to run.
* instance_provision -- provision one or more test run environments.
  Accepts $INSTANCE_COUNT for the number of instances desired.
* instance_execute -- execute a test runner process in a given environment.
  Accepts $INSTANCE_ID, $FILES and $COMMAND. Paths in $FILES should be
  synchronised into the test runner environment filesystem. $COMMAND can
  be adjusted if the paths are synched with different names.
* instance_dispose -- dispose of one or more test running environments.
  Accepts $INSTANCE_IDS.
* $IDOPTION -- the variable to use to trigger running some specific tests.
* $IDFILE -- A file created before the test command is run and deleted
  afterwards which contains a list of test ids, one per line. This can
  handle test ids with emedded whitespace.
* $IDLIST -- A list of the test ids to run, separated by spaces. IDLIST
  defaults to an empty string when no test ids are known and no explicit
  default is provided. This will not handle test ids with spaces.

See the testrepository manual for example .testr.conf files in different
programming languages.

setup.py: error: no such option: -V

----------------------------------------------------------------------
Ran 0 tests in 0.521s

OK

#############

Suggested fix:

diff --git a/run_tests.sh b/run_tests.sh
index 1f269fb..fd09ce7 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -57,8 +57,8 @@ function process_options {
         (( i++ ))
         tools_path=${!i}
         ;;
- -*) testropts="$testropts $1";;
- *) testrargs="$testrargs $1"
+ -*) testropts="$testropts ${!i}";;
+ *) testrargs="$testrargs ${!i}"
     esac
     (( i++ ))
   done