Skip to content

Commit 5d7ff25

Browse files
dragoonisnikic
authored andcommitted
Removing HTML Functionality from run-tests.php
As discussed on GH-5632, the HTML functionality does not appear to be in active use. For HTML rendering of test results, it is suggested to instead use the JUnit integration, in combination with your favorite JUnit viewer. Closes GH-5705.
1 parent cd7d966 commit 5d7ff25

File tree

1 file changed

+12
-119
lines changed

1 file changed

+12
-119
lines changed

run-tests.php

Lines changed: 12 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,11 @@ function show_usage()
8787
--help
8888
-h This Help.
8989
90-
--html <file> Generate HTML output.
91-
9290
--temp-source <sdir> --temp-target <tdir> [--temp-urlbase <url>]
9391
Write temporary files to <tdir> by replacing <sdir> from the
94-
filenames to generate with <tdir>. If --html is being used and
95-
<url> given then the generated links are relative and prefixed
96-
with the given url. In general you want to make <sdir> the path
97-
to your source files and <tdir> some patch in your web page
98-
hierarchy with <url> pointing to <tdir>.
92+
filenames to generate with <tdir>. In general you want to make
93+
<sdir> the path to your source files and <tdir> some patch in
94+
your web page hierarchy with <url> pointing to <tdir>.
9995
10096
--keep-[all|php|skip|clean]
10197
Do not delete 'all' files, 'php' test file, 'skip' or 'clean'
@@ -137,7 +133,7 @@ function main()
137133
global $DETAILED, $PHP_FAILED_TESTS, $SHOW_ONLY_GROUPS, $argc, $argv, $cfg,
138134
$cfgfiles, $cfgtypes, $conf_passed, $end_time, $environment,
139135
$exts_skipped, $exts_tested, $exts_to_test, $failed_tests_file,
140-
$html_file, $html_output, $ignored_by_ext, $ini_overwrites, $is_switch,
136+
$ignored_by_ext, $ini_overwrites, $is_switch,
141137
$just_save_results, $log_format, $matches, $no_clean, $no_file_cache,
142138
$optionals, $output_file, $pass_option_n, $pass_options,
143139
$pattern_match, $php, $php_cgi, $phpdbg, $preload, $redir_tests,
@@ -378,8 +374,6 @@ function main()
378374

379375
$just_save_results = false;
380376
$valgrind = null;
381-
$html_output = false;
382-
$html_file = null;
383377
$temp_source = null;
384378
$temp_target = null;
385379
$temp_urlbase = null;
@@ -606,10 +600,6 @@ function main()
606600
$repeat = true;
607601
}
608602
break;
609-
case '--html':
610-
$html_file = fopen($argv[++$i], 'wt');
611-
$html_output = is_resource($html_file);
612-
break;
613603
case '--version':
614604
echo '$Id$' . "\n";
615605
exit(1);
@@ -691,20 +681,12 @@ function main()
691681
usort($test_files, "test_sort");
692682
$start_time = time();
693683

694-
if (!$html_output) {
695-
echo "Running selected tests.\n";
696-
} else {
697-
show_start($start_time);
698-
}
684+
echo "Running selected tests.\n";
699685

700686
$test_idx = 0;
701687
run_all_tests($test_files, $environment);
702688
$end_time = time();
703689

704-
if ($html_output) {
705-
show_end($end_time);
706-
}
707-
708690
if ($failed_tests_file) {
709691
fclose($failed_tests_file);
710692
}
@@ -719,15 +701,8 @@ function main()
719701
}
720702

721703
compute_summary();
722-
if ($html_output) {
723-
fwrite($html_file, "<hr/>\n" . get_summary(false, true));
724-
}
725704
echo "=====================================================================";
726-
echo get_summary(false, false);
727-
728-
if ($html_output) {
729-
fclose($html_file);
730-
}
705+
echo get_summary(false);
731706

732707
if ($output_file != '' && $just_save_results) {
733708
save_or_mail_results();
@@ -792,10 +767,6 @@ function main()
792767
show_end($end_time);
793768
show_summary();
794769

795-
if ($html_output) {
796-
fclose($html_file);
797-
}
798-
799770
save_or_mail_results();
800771
}
801772

@@ -962,7 +933,7 @@ function save_or_mail_results()
962933
$failed_tests_data = '';
963934
$sep = "\n" . str_repeat('=', 80) . "\n";
964935
$failed_tests_data .= $failed_test_summary . "\n";
965-
$failed_tests_data .= get_summary(true, false) . "\n";
936+
$failed_tests_data .= get_summary(true) . "\n";
966937

967938
if ($sum_results['FAILED']) {
968939
foreach ($PHP_FAILED_TESTS['FAILED'] as $test_info) {
@@ -3015,7 +2986,7 @@ function compute_summary()
30152986
}
30162987
}
30172988

3018-
function get_summary($show_ext_summary, $show_html)
2989+
function get_summary($show_ext_summary)
30192990
{
30202991
global $exts_skipped, $exts_tested, $n_total, $sum_results, $percent_results, $end_time, $start_time, $failed_test_summary, $PHP_FAILED_TESTS, $valgrind;
30212992

@@ -3034,10 +3005,6 @@ function get_summary($show_ext_summary, $show_html)
30343005

30353006
$summary = '';
30363007

3037-
if ($show_html) {
3038-
$summary .= "<pre>\n";
3039-
}
3040-
30413008
if ($show_ext_summary) {
30423009
$summary .= '
30433010
=====================================================================
@@ -3179,55 +3146,27 @@ function get_summary($show_ext_summary, $show_html)
31793146
$summary .= $failed_test_summary;
31803147
}
31813148

3182-
if ($show_html) {
3183-
$summary .= "</pre>";
3184-
}
3185-
31863149
return $summary;
31873150
}
31883151

31893152
function show_start($start_time)
31903153
{
3191-
global $html_output, $html_file;
3192-
3193-
if ($html_output) {
3194-
fwrite($html_file, "<h2>Time Start: " . date('Y-m-d H:i:s', $start_time) . "</h2>\n");
3195-
fwrite($html_file, "<table>\n");
3196-
}
3197-
31983154
echo "TIME START " . date('Y-m-d H:i:s', $start_time) . "\n=====================================================================\n";
31993155
}
32003156

32013157
function show_end($end_time)
32023158
{
3203-
global $html_output, $html_file;
3204-
3205-
if ($html_output) {
3206-
fwrite($html_file, "</table>\n");
3207-
fwrite($html_file, "<h2>Time End: " . date('Y-m-d H:i:s', $end_time) . "</h2>\n");
3208-
}
3209-
32103159
echo "=====================================================================\nTIME END " . date('Y-m-d H:i:s', $end_time) . "\n";
32113160
}
32123161

32133162
function show_summary()
32143163
{
3215-
global $html_output, $html_file;
3216-
3217-
if ($html_output) {
3218-
fwrite($html_file, "<hr/>\n" . get_summary(true, true));
3219-
}
3220-
3221-
echo get_summary(true, false);
3164+
echo get_summary(true);
32223165
}
32233166

32243167
function show_redirect_start($tests, $tested, $tested_file)
32253168
{
3226-
global $html_output, $html_file, $line_length, $SHOW_ONLY_GROUPS;
3227-
3228-
if ($html_output) {
3229-
fwrite($html_file, "<tr><td colspan='3'>---&gt; $tests ($tested [$tested_file]) begin</td></tr>\n");
3230-
}
3169+
global $SHOW_ONLY_GROUPS;
32313170

32323171
if (!$SHOW_ONLY_GROUPS || in_array('REDIRECT', $SHOW_ONLY_GROUPS)) {
32333172
echo "REDIRECT $tests ($tested [$tested_file]) begin\n";
@@ -3238,11 +3177,7 @@ function show_redirect_start($tests, $tested, $tested_file)
32383177

32393178
function show_redirect_ends($tests, $tested, $tested_file)
32403179
{
3241-
global $html_output, $html_file, $line_length, $SHOW_ONLY_GROUPS;
3242-
3243-
if ($html_output) {
3244-
fwrite($html_file, "<tr><td colspan='3'>---&gt; $tests ($tested [$tested_file]) done</td></tr>\n");
3245-
}
3180+
global $SHOW_ONLY_GROUPS;
32463181

32473182
if (!$SHOW_ONLY_GROUPS || in_array('REDIRECT', $SHOW_ONLY_GROUPS)) {
32483183
echo "REDIRECT $tests ($tested [$tested_file]) done\n";
@@ -3283,56 +3218,14 @@ function parse_conflicts(string $text): array
32833218

32843219
function show_result($result, $tested, $tested_file, $extra = '', $temp_filenames = null)
32853220
{
3286-
global $html_output, $html_file, $temp_target, $temp_urlbase, $line_length, $SHOW_ONLY_GROUPS;
3221+
global $temp_target, $temp_urlbase, $line_length, $SHOW_ONLY_GROUPS;
32873222

32883223
if (!$SHOW_ONLY_GROUPS || in_array($result, $SHOW_ONLY_GROUPS)) {
32893224
echo "$result $tested [$tested_file] $extra\n";
32903225
} elseif (!$SHOW_ONLY_GROUPS) {
32913226
clear_show_test();
32923227
}
32933228

3294-
if ($html_output) {
3295-
if (isset($temp_filenames['file']) && file_exists($temp_filenames['file'])) {
3296-
$url = str_replace($temp_target, $temp_urlbase, $temp_filenames['file']);
3297-
$tested = "<a href='$url'>$tested</a>";
3298-
}
3299-
3300-
if (isset($temp_filenames['skip']) && file_exists($temp_filenames['skip'])) {
3301-
if (empty($extra)) {
3302-
$extra = "skipif";
3303-
}
3304-
3305-
$url = str_replace($temp_target, $temp_urlbase, $temp_filenames['skip']);
3306-
$extra = "<a href='$url'>$extra</a>";
3307-
} elseif (empty($extra)) {
3308-
$extra = "&nbsp;";
3309-
}
3310-
3311-
if (isset($temp_filenames['diff']) && file_exists($temp_filenames['diff'])) {
3312-
$url = str_replace($temp_target, $temp_urlbase, $temp_filenames['diff']);
3313-
$diff = "<a href='$url'>diff</a>";
3314-
} else {
3315-
$diff = "&nbsp;";
3316-
}
3317-
3318-
if (isset($temp_filenames['mem']) && file_exists($temp_filenames['mem'])) {
3319-
$url = str_replace($temp_target, $temp_urlbase, $temp_filenames['mem']);
3320-
$mem = "<a href='$url'>leaks</a>";
3321-
} else {
3322-
$mem = "&nbsp;";
3323-
}
3324-
3325-
fwrite(
3326-
$html_file,
3327-
"<tr>" .
3328-
"<td>$result</td>" .
3329-
"<td>$tested</td>" .
3330-
"<td>$extra</td>" .
3331-
"<td>$diff</td>" .
3332-
"<td>$mem</td>" .
3333-
"</tr>\n"
3334-
);
3335-
}
33363229
}
33373230

33383231
function junit_init()

0 commit comments

Comments
 (0)