mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Add miliseconds do the test time output (#12729)
Also replaced microtime() with hrtime()
This commit is contained in:
parent
703ef91edb
commit
948b2bc211
1 changed files with 12 additions and 10 deletions
|
@ -682,13 +682,14 @@ function main(): void
|
||||||
if ($test_cnt) {
|
if ($test_cnt) {
|
||||||
putenv('NO_INTERACTION=1');
|
putenv('NO_INTERACTION=1');
|
||||||
usort($test_files, "test_sort");
|
usort($test_files, "test_sort");
|
||||||
$start_time = time();
|
$start_timestamp = time();
|
||||||
|
$start_time = hrtime(true);
|
||||||
|
|
||||||
echo "Running selected tests.\n";
|
echo "Running selected tests.\n";
|
||||||
|
|
||||||
$test_idx = 0;
|
$test_idx = 0;
|
||||||
run_all_tests($test_files, $environment);
|
run_all_tests($test_files, $environment);
|
||||||
$end_time = time();
|
$end_time = hrtime(true);
|
||||||
|
|
||||||
if ($failed_tests_file) {
|
if ($failed_tests_file) {
|
||||||
fclose($failed_tests_file);
|
fclose($failed_tests_file);
|
||||||
|
@ -730,13 +731,14 @@ function main(): void
|
||||||
$test_files = array_unique($test_files);
|
$test_files = array_unique($test_files);
|
||||||
usort($test_files, "test_sort");
|
usort($test_files, "test_sort");
|
||||||
|
|
||||||
$start_time = time();
|
$start_timestamp = time();
|
||||||
|
$start_time = hrtime(true);
|
||||||
show_start($start_time);
|
show_start($start_time);
|
||||||
|
|
||||||
$test_cnt = count($test_files);
|
$test_cnt = count($test_files);
|
||||||
$test_idx = 0;
|
$test_idx = 0;
|
||||||
run_all_tests($test_files, $environment);
|
run_all_tests($test_files, $environment);
|
||||||
$end_time = time();
|
$end_time = hrtime(true);
|
||||||
|
|
||||||
if ($failed_tests_file) {
|
if ($failed_tests_file) {
|
||||||
fclose($failed_tests_file);
|
fclose($failed_tests_file);
|
||||||
|
@ -755,7 +757,7 @@ function main(): void
|
||||||
|
|
||||||
compute_summary();
|
compute_summary();
|
||||||
|
|
||||||
show_end($end_time);
|
show_end($start_timestamp, $start_time, $end_time);
|
||||||
show_summary();
|
show_summary();
|
||||||
|
|
||||||
save_results($output_file, /* prompt_to_save_results: */ true);
|
save_results($output_file, /* prompt_to_save_results: */ true);
|
||||||
|
@ -3064,7 +3066,7 @@ Expected leak : ' . sprintf('%5d (%5.1f%%)', $sum_results['XLEAKED'], $percent
|
||||||
$summary .= '
|
$summary .= '
|
||||||
Tests passed : ' . sprintf('%5d (%5.1f%%)', $sum_results['PASSED'], $percent_results['PASSED']) . ' ' . sprintf('(%5.1f%%)', $x_passed) . '
|
Tests passed : ' . sprintf('%5d (%5.1f%%)', $sum_results['PASSED'], $percent_results['PASSED']) . ' ' . sprintf('(%5.1f%%)', $x_passed) . '
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Time taken : ' . sprintf('%5d seconds', $end_time - $start_time) . '
|
Time taken : ' . sprintf('%5.3f seconds', ($end_time - $start_time) / 1e9) . '
|
||||||
=====================================================================
|
=====================================================================
|
||||||
';
|
';
|
||||||
$failed_test_summary = '';
|
$failed_test_summary = '';
|
||||||
|
@ -3167,14 +3169,14 @@ EXPECTED LEAK TEST SUMMARY
|
||||||
return $summary;
|
return $summary;
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_start(int $start_time): void
|
function show_start(int $start_timestamp): void
|
||||||
{
|
{
|
||||||
echo "TIME START " . date('Y-m-d H:i:s', $start_time) . "\n=====================================================================\n";
|
echo "TIME START " . date('Y-m-d H:i:s', $start_timestamp) . "\n=====================================================================\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_end(int $end_time): void
|
function show_end(int $start_timestamp, int|float $start_time, int|float $end_time): void
|
||||||
{
|
{
|
||||||
echo "=====================================================================\nTIME END " . date('Y-m-d H:i:s', $end_time) . "\n";
|
echo "=====================================================================\nTIME END " . date('Y-m-d H:i:s', $start_timestamp + (int)(($end_time - $start_time)/1e9)) . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_summary(): void
|
function show_summary(): void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue