diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-08-18 18:52:31 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-08-18 18:52:31 +0000 |
commit | ba6aa9f515996b676940f5a8a8d10c1249c1bda0 (patch) | |
tree | 5228fa40ca063c0a35a1e3d1fb4c3024f5f3bfde /scripts/run-tests.sh | |
parent | e2825f474b71d515d85ce12574d8ed5b55cebdc0 (diff) | |
download | brdo-ba6aa9f515996b676940f5a8a8d10c1249c1bda0.tar.gz brdo-ba6aa9f515996b676940f5a8a8d10c1249c1bda0.tar.bz2 |
- Patch #291670 by dhubler, Dries: run tests by file.
Diffstat (limited to 'scripts/run-tests.sh')
-rwxr-xr-x | scripts/run-tests.sh | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh index 8f2c7238a..15a703714 100755 --- a/scripts/run-tests.sh +++ b/scripts/run-tests.sh @@ -114,13 +114,16 @@ All arguments are long options. --concurrency [num] - Run tests in parallel, up to [num] tests at a time. - This requires the Process Control Extension (PCNTL) to be compiled in PHP, - not supported under Windows. + Run tests in parallel, up to [num] tests at a time. This requires + the Process Control Extension (PCNTL) to be compiled in PHP, not + supported under Windows. --all Run all available tests. --class Run tests identified by specific class names, instead of group names. + + --file Run tests identifiled by specific file names, instead of group names. + Specify the path and the extension (i.e. 'modules/user/user.test'). --color Output the rusults with color highlighting. @@ -160,6 +163,7 @@ function simpletest_script_parse_args() { 'concurrency' => 1, 'all' => FALSE, 'class' => FALSE, + 'file' => FALSE, 'color' => FALSE, 'verbose' => FALSE, 'test_names' => array(), @@ -353,7 +357,7 @@ function simpletest_script_get_test_list() { $test_list = array_keys($all_tests); } else { - if ($args['class_names']) { + if ($args['class']) { // Check for valid class names. foreach ($args['test_names'] as $class_name) { if (isset($all_tests[$class_name])) { @@ -361,6 +365,21 @@ function simpletest_script_get_test_list() { } } } + else if ($args['file']) { + $files = array(); + foreach ($args['test_names'] as $file) { + $files[realpath($file)] = 1; + } + + // Check for valid class names. + foreach ($all_tests as $class_name => $instance) { + $refclass = new ReflectionClass($class_name); + $file = $refclass->getFileName(); + if (isset($files[$file])) { + $test_list[] = $class_name; + } + } + } else { // Check for valid group names and get all valid classes in group. foreach ($args['test_names'] as $group_name) { |