Skip to content

Commit 2ef88f5

Browse files
gerardrochenikic
authored andcommitted
run-tests: echo message and exit if no tests found
The test runner currently defaults to running the entire test suite if no selected tests can be found. This can be unexpected. For example the ext/mysqlnd/ directory has no tests, if you specify that directory when testing the entire test suite will be run. run-tests.php [options] ext/mysqlnd/ Closes GH-5605.
1 parent 7f51f43 commit 2ef88f5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

run-tests.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ function main()
394394
$temp_urlbase = null;
395395
$conf_passed = null;
396396
$no_clean = false;
397+
$selected_tests = false;
397398
$slow_min_ms = INF;
398399
$preload = false;
399400
$file_cache = null;
@@ -634,6 +635,7 @@ function main()
634635
}
635636

636637
if (!$is_switch) {
638+
$selected_tests = true;
637639
$testfile = realpath($argv[$i]);
638640

639641
if (!$testfile && strpos($argv[$i], '*') !== false && function_exists('glob')) {
@@ -664,6 +666,11 @@ function main()
664666
}
665667
}
666668

669+
if ($selected_tests && count($test_files) === 0) {
670+
echo "No tests found.\n";
671+
return;
672+
}
673+
667674
// Default to PHP_BINARY as executable
668675
if (!isset($environment['TEST_PHP_EXECUTABLE'])) {
669676
$php = PHP_BINARY;

0 commit comments

Comments
 (0)