Skip to content

Add --progress option to run-tests.php #9255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions .github/actions/test-linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
1 change: 1 addition & 0 deletions .github/actions/test-macos/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion appveyor/test_task.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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%

Expand Down
1 change: 1 addition & 0 deletions azure/libmysqlclient_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}'
Expand Down
1 change: 1 addition & 0 deletions azure/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
33 changes: 21 additions & 12 deletions run-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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'];
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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");
}

Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -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) {
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions travis/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down