From a5699399159fff5cb17c505d9c0a9cffa2391615 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Fri, 5 Aug 2022 14:20:32 +0200 Subject: [PATCH] Add --[no-]progress option to run-tests.php Previously, adding the -g argument would disable progress, even locally. Now it needs to be disabled explicitly. --- .cirrus.yml | 2 +- .github/actions/test-linux/action.yml | 1 + .github/actions/test-macos/action.yml | 1 + appveyor/test_task.bat | 2 +- azure/libmysqlclient_test.yml | 1 + azure/test.yml | 1 + run-tests.php | 33 +++++++++++++++++---------- travis/test.sh | 1 + 8 files changed, 28 insertions(+), 14 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 0aed3f6b23a10..1863cc0e5f342 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -25,4 +25,4 @@ task: tests_script: - export SKIP_IO_CAPTURE_TESTS=1 - export CI_NO_IPV6=1 - - sapi/cli/php run-tests.php -P -q -j2 -g FAIL,BORK,LEAK,XLEAK --offline --show-diff --show-slow 1000 --set-timeout 120 -d zend_extension=opcache.so + - sapi/cli/php run-tests.php -P -q -j2 -g FAIL,BORK,LEAK,XLEAK --no-progress --offline --show-diff --show-slow 1000 --set-timeout 120 -d zend_extension=opcache.so diff --git a/.github/actions/test-linux/action.yml b/.github/actions/test-linux/action.yml index a0ec94ed80c31..a4275006e6ce7 100644 --- a/.github/actions/test-linux/action.yml +++ b/.github/actions/test-linux/action.yml @@ -25,6 +25,7 @@ runs: sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \ -j$(/usr/bin/nproc) \ -g FAIL,BORK,LEAK,XLEAK \ + --no-progress \ --offline \ --show-diff \ --show-slow 1000 \ diff --git a/.github/actions/test-macos/action.yml b/.github/actions/test-macos/action.yml index 46c7d39444350..3deafde06200c 100644 --- a/.github/actions/test-macos/action.yml +++ b/.github/actions/test-macos/action.yml @@ -18,6 +18,7 @@ runs: sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \ -j$(sysctl -n hw.ncpu) \ -g FAIL,BORK,LEAK,XLEAK \ + --no-progress \ --offline \ --show-diff \ --show-slow 1000 \ diff --git a/appveyor/test_task.bat b/appveyor/test_task.bat index c092083651fbc..c55bd7ea0543f 100644 --- a/appveyor/test_task.bat +++ b/appveyor/test_task.bat @@ -136,7 +136,7 @@ mkdir c:\tests_tmp set TEST_PHP_JUNIT=c:\junit.out.xml cd "%APPVEYOR_BUILD_FOLDER%" -nmake test TESTS="%OPCACHE_OPTS% -q --offline --show-diff --show-slow 1000 --set-timeout 120 --temp-source c:\tests_tmp --temp-target c:\tests_tmp --bless %PARALLEL%" +nmake test TESTS="%OPCACHE_OPTS% -g FAIL,BORK,LEAK,XLEAK --no-progress -q --offline --show-diff --show-slow 1000 --set-timeout 120 --temp-source c:\tests_tmp --temp-target c:\tests_tmp --bless %PARALLEL%" set EXIT_CODE=%errorlevel% diff --git a/azure/libmysqlclient_test.yml b/azure/libmysqlclient_test.yml index 059be219e2fe1..34b091cee196f 100644 --- a/azure/libmysqlclient_test.yml +++ b/azure/libmysqlclient_test.yml @@ -35,6 +35,7 @@ steps: rm -rf junit.xml | true sapi/cli/php run-tests.php -P -q \ -g FAIL,BORK,LEAK,XLEAK \ + --no-progress \ --offline --show-diff --show-slow 1000 --set-timeout 120 \ ext/pdo_mysql displayName: 'Test ${{ parameters.configurationName }}' diff --git a/azure/test.yml b/azure/test.yml index 09028900ea21a..7f72d4624ae50 100644 --- a/azure/test.yml +++ b/azure/test.yml @@ -19,6 +19,7 @@ steps: sapi/cli/php run-tests.php -P -q \ -j$(/usr/bin/nproc) \ -g FAIL,BORK,LEAK,XLEAK \ + --no-progress \ --offline \ --show-diff \ --show-slow 1000 \ diff --git a/run-tests.php b/run-tests.php index 7e9b61b1c8594..7bf892337a5bb 100755 --- a/run-tests.php +++ b/run-tests.php @@ -127,6 +127,9 @@ function show_usage(): void --color --no-color Do/Don't colorize the result type in the test result. + --progress + --no-progress Do/Don't show the current progress. + --repeat [n] Run the tests multiple times in the same process and check the output of the last execution (CLI SAPI only). @@ -159,7 +162,7 @@ function main(): void $temp_source, $temp_target, $test_cnt, $test_dirs, $test_files, $test_idx, $test_list, $test_results, $testfile, $user_tests, $valgrind, $sum_results, $shuffle, $file_cache, $num_repeats, - $bless; + $bless, $show_progress; // Parallel testing global $workers, $workerID; global $context_line_count; @@ -360,6 +363,7 @@ function main(): void $workers = null; $context_line_count = 3; $num_repeats = 1; + $show_progress = true; $cfgtypes = ['show', 'keep']; $cfgfiles = ['skip', 'php', 'clean', 'out', 'diff', 'exp', 'mem']; @@ -600,6 +604,12 @@ function main(): void $repeat = true; } break; + case '--progress': + $show_progress = true; + break; + case '--no-progress': + $show_progress = false; + break; case '--version': echo '$Id$' . "\n"; exit(1); @@ -1331,7 +1341,7 @@ function run_all_tests(array $test_files, array $env, $redir_tested = null): voi */ function run_all_tests_parallel(array $test_files, array $env, $redir_tested): void { - global $workers, $test_idx, $test_cnt, $test_results, $failed_tests_file, $result_tests_file, $PHP_FAILED_TESTS, $shuffle, $SHOW_ONLY_GROUPS, $valgrind; + global $workers, $test_idx, $test_cnt, $test_results, $failed_tests_file, $result_tests_file, $PHP_FAILED_TESTS, $shuffle, $SHOW_ONLY_GROUPS, $valgrind, $show_progress; global $junit; @@ -1578,13 +1588,13 @@ function run_all_tests_parallel(array $test_files, array $env, $redir_tested): v } $test_idx++; - if (!$SHOW_ONLY_GROUPS) { + if ($show_progress) { clear_show_test(); } echo $resultText; - if (!$SHOW_ONLY_GROUPS) { + if ($show_progress) { show_test($test_idx, count($workerProcs) . "/$workers concurrent test workers running"); } @@ -1634,7 +1644,7 @@ function run_all_tests_parallel(array $test_files, array $env, $redir_tested): v } } - if (!$SHOW_ONLY_GROUPS) { + if ($show_progress) { clear_show_test(); } @@ -3223,22 +3233,22 @@ function show_summary(): void function show_redirect_start(string $tests, string $tested, string $tested_file): void { - global $SHOW_ONLY_GROUPS; + global $SHOW_ONLY_GROUPS, $show_progress; if (!$SHOW_ONLY_GROUPS || in_array('REDIRECT', $SHOW_ONLY_GROUPS)) { echo "REDIRECT $tests ($tested [$tested_file]) begin\n"; - } else { + } elseif ($show_progress) { clear_show_test(); } } function show_redirect_ends(string $tests, string $tested, string $tested_file): void { - global $SHOW_ONLY_GROUPS; + global $SHOW_ONLY_GROUPS, $show_progress; if (!$SHOW_ONLY_GROUPS || in_array('REDIRECT', $SHOW_ONLY_GROUPS)) { echo "REDIRECT $tests ($tested [$tested_file]) done\n"; - } else { + } elseif ($show_progress) { clear_show_test(); } } @@ -3280,7 +3290,7 @@ function show_result( string $extra = '', ?array $temp_filenames = null ): void { - global $SHOW_ONLY_GROUPS, $colorize; + global $SHOW_ONLY_GROUPS, $colorize, $show_progress; if (!$SHOW_ONLY_GROUPS || in_array($result, $SHOW_ONLY_GROUPS)) { if ($colorize) { @@ -3302,10 +3312,9 @@ function show_result( } else { echo "$result $tested [$tested_file] $extra\n"; } - } elseif (!$SHOW_ONLY_GROUPS) { + } elseif ($show_progress) { clear_show_test(); } - } class BorkageException extends Exception diff --git a/travis/test.sh b/travis/test.sh index 313651a2ead37..8aaab2d13417d 100755 --- a/travis/test.sh +++ b/travis/test.sh @@ -7,6 +7,7 @@ if [ -z "$ARM64" ]; then export JOBS=$(nproc); else export JOBS=16; fi export SKIP_IO_CAPTURE_TESTS=1 ./sapi/cli/php run-tests.php -P \ -g "FAIL,BORK,LEAK" --offline --show-diff --show-slow 1000 \ + --no-progress \ --set-timeout 120 -j$JOBS \ -d extension=`pwd`/modules/zend_test.so \ -d zend_extension=`pwd`/modules/opcache.so \