cvs: php-gcov-web /cron tests.php /www config.php graph.php lcov.php site.api.php skip.php tests.php viewer.php

From: Date: Thu, 21 Dec 2006 18:58:49 +0000
Subject: cvs: php-gcov-web /cron tests.php /www config.php graph.php lcov.php site.api.php skip.php tests.php viewer.php
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-33578@lists.php.net to get a copy of this message
nlopess Thu Dec 21 18:58:49 2006 UTC Added files: /php-gcov-web/www graph.php lcov.php skip.php tests.php Modified files: /php-gcov-web/cron tests.php /php-gcov-web/www config.php site.api.php viewer.php Log: separate the content and the templating code (take #1) add a section to list skipped tests #note this breaks temporarly the remote building (which was already somewhat broken..)

http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/tests.php?r1=1.2&r2=1.3&diff_format=u Index: php-gcov-web/cron/tests.php diff -u php-gcov-web/cron/tests.php:1.2 php-gcov-web/cron/tests.php:1.3 --- php-gcov-web/cron/tests.php:1.2 Tue Dec 19 15:52:09 2006 +++ php-gcov-web/cron/tests.php Thu Dec 21 18:58:49 2006 @@ -18,206 +18,56 @@ +----------------------------------------------------------------------+ */ -/* $Id: tests.php,v 1.2 2006/12/19 15:52:09 nlopess Exp $ */ +/* $Id: tests.php,v 1.3 2006/12/21 18:58:49 nlopess Exp $ */ // Tests generation file +// $data: contains the contents of $tmpdir/php_test.log -if(!defined('CRON_PHP')) -{ - echo basename($_SERVER['PHP_SELF']).': Sorry this file must be called by a cron script.'."\n"; - exit; -} - -require_once $workdir.'/template.php'; - -// data: contains the contents of $tmpdir/php_test.log -// unicode: true if unicode is included - -// Clear the variable that stores the output file for the core file -$index_write = ''; - -// Clear the variable that stores the output content for the individual files -$write = ''; +$fail_tests = array(); +$skip_tests = array(); +$tests_re = '/(?P<status>FAIL|PASS|SKIP)(?::(?P<testtype>[a-z|A-Z]))? (?P<title>.+) \[(?P<file>[^\]]+)\](?: reason: (?P<reason>.+))?/'; -// Regular expression used to find a single failure -$fail_re = '/FAIL(:(?P<testtype>[a-z|A-Z]))?/'; - -// Regular expression to find all tests with a pass or failure -$tests_re = '/(?P<status>FAIL|PASS)(:(?P<testtype>[a-z|A-Z]))? (?P<title>.+) \[(?P<file>[^\]]+)\]/'; - -// Grab all tests that match the tests regular expression preg_match_all($tests_re, $data, $tests, PREG_SET_ORDER); -// Clear old directory variable -$old_dir = ''; - -// A single failure is enough to verify that a failure occurred -if (preg_match($fail_re, $data) < 1) -{ - $index_write .= "<p>Congratulations! Currently there are no test failures!</p>\n"; -} -else -{ - // If there are leaks start the table - - $index_write .= <<< HTML -<table border="1"> -HTML; +foreach ($tests as $test) { -} - -// Loop through each result -foreach ($tests as $test) -{ - - $dir = dirname($test['file']); - $file = basename($test['file']); - - $status = strtolower($test['status']); // fail or pass - - $testtype = ''; // test type will be determined later - - $title = $test['title']; + $status = $test['status']; // FAIL, PASS or SKIP + $title = $test['title']; + $reason = isset($test['reason']) ? $test['reason'] : ''; // Note: that the following period is maintained $base = "$phpdir/".substr($test['file'],0,-4); $report_file = $base; - if((isset($test['testtype'])) && (strtolower($test['testtype']) == 'u')) - { + if (isset($test['testtype']) && strtolower($test['testtype']) == 'u') { $testtype = 'Unicode'; $report_file .= 'u.'; - } - else - { + } else { $testtype = 'Native'; } - // Note: the hash reflects the exact filename for native - // i.e. unicode would be file.u.phpt and native file.phpt - $hash = md5($report_file.'phpt'); - // Failed tests provide more content then passed tests - if($status == 'fail') - { - // These variables are only used for failed tests - $difference = file_get_contents($report_file.'diff') - or $difference = 'N\A'; - $expected = file_get_contents($report_file.'exp') - or $expected = 'N\A'; - $output = file_get_contents($report_file.'out') - or $output = 'N\A'; - $script = file_get_contents($base.'php') - or $script = 'Script contents not available.'; - - // Currently only used by master server but may also be useful here - $totalnumfailures += 1; - - // Ensure content is running on a master server before writing up with the output files - if($is_master) - { - if ($old_dir != $dir) - { - $old_dir = $dir; - - $index_write .= <<< HTML - <tr> -<td colspan="3" align="center"><b>$dir</b></td> -</tr> -<tr> -<td width="190">File</td> -<td width="80">Test Type</td> -<td width="*">Name</td> -</tr> -HTML; - - } // End check for change of directory location - - $title_html = htmlspecialchars($title); - - $index_write .= <<< HTML -<tr> -<td> -<a href="viewer.php?version=$phpver&func=tests&file=$hash">$file</a></td> -<td>{$testtype}</td> -<td>{$title_html}</td> -</tr> -HTML; - - // Manipulate the data to work with HTML formatting - $script_html = highlight_string($script, true); - $expected_html = htmlspecialchars($expected); - $difference_html = htmlspecialchars(str_replace($phpdir,'',$difference)); - $output_html = htmlspecialchars(str_replace($phpdir,'',$output)); - - $write = <<< HTML - -<h2>Script</h2> -<pre>$script_html</pre> -<h2>Expected</h2> -<pre>$expected_html</pre> -<h2>Output</h2> -<pre>$output_html</pre> -<h2>Diff</h2> -<pre>$difference_html</pre> -HTML; - - // output the content for the individual test failure - file_put_contents("$outdir/$hash.inc", - '<?php $filename="'.htmlspecialchars(basename($file)).'"; ?>'."\n" - .$write. - html_footer() - ); - - } - else - { - // If not master server, add to output array - - $newtest = array(); - $newtest['difference'] = $difference; - $newtest['expected'] = $expected; - $newtest['file'] = $test['file']; - $newtest['output'] = $output; - $newtest['script'] = $script; - $newtest['status'] = $status; - $newtest['testtype'] = $testtype; - $newtest['title'] = $title; - - $xmlarray['tests'][] = $newtest; - } // End check for master server - - } // End check for loop through failed tests - else - { - // So far passed tests are not used locally but are used for output - - if(!$is_master) - { - // test title might be useful for passed tests - - $newtest = array(); - $newtest['file'] = $test['file']; - $newtest['status'] = $status; - $newtest['testtype'] = $testtype; - - $xmlarray['tests'][] = $newtest; - - } // End check for not master server - - } // End loop through pass tests - -} // End loop through tests - -// Continue master server check for output of the core tests file -if($is_master) -{ - if ($totalnumfailures > 0) - $index_write .= "</table>\n"; + if ($status === 'FAIL') { + $difference = @file_get_contents($report_file.'diff'); + $expected = @file_get_contents($report_file.'exp'); + $output = @file_get_contents($report_file.'out'); + $script = @file_get_contents($base.'php'); + + $fail_tests[$test['file']] = array($testtype, $title, $difference, $expected, $output, $script); + + } elseif ($status === 'SKIP') { + $skip = @file_get_contents($report_file.'skip.php'); - file_put_contents("$outdir/tests.inc", $index_write.html_footer()); + $skip_tests[$test['file']] = array($skip, $reason); + } +} -} // End check for master server for core tests file output -?> +// sort by filename +ksort($skip_tests); +ksort($fail_tests); + +// now write the raw data to thw www dir +file_put_contents("$outdir/skip.inc", serialize($skip_tests)); +file_put_contents("$outdir/fail.inc", serialize($fail_tests)); http://cvs.php.net/viewvc.cgi/php-gcov-web/www/config.php?r1=1.2&r2=1.3&diff_format=u Index: php-gcov-web/www/config.php diff -u php-gcov-web/www/config.php:1.2 php-gcov-web/www/config.php:1.3 --- php-gcov-web/www/config.php:1.2 Tue Dec 19 15:52:13 2006 +++ php-gcov-web/www/config.php Thu Dec 21 18:58:49 2006 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: config.php,v 1.2 2006/12/19 15:52:13 nlopess Exp $ */ +/* $Id: config.php,v 1.3 2006/12/21 18:58:49 nlopess Exp $ */ // File: Core Site Configuration File // Desc: contains core site settings, this file is essential and always included by the API. @@ -42,9 +42,10 @@ 'compile-results' => 'compile_results', 'graphs' => 'graph', 'parameter-parsing' => 'params', - 'system' => 'system', + 'skipped-tests' => 'skip', 'test-failures' => 'tests', - 'valgrind' => 'valgrind' + 'valgrind' => 'valgrind', + 'system' => 'system', ); // Define sidebar links that are active when viewing a builder's submissions http://cvs.php.net/viewvc.cgi/php-gcov-web/www/site.api.php?r1=1.2&r2=1.3&diff_format=u Index: php-gcov-web/www/site.api.php diff -u php-gcov-web/www/site.api.php:1.2 php-gcov-web/www/site.api.php:1.3 --- php-gcov-web/www/site.api.php:1.2 Tue Dec 19 15:52:13 2006 +++ php-gcov-web/www/site.api.php Thu Dec 21 18:58:49 2006 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: site.api.php,v 1.2 2006/12/19 15:52:13 nlopess Exp $ */ +/* $Id: site.api.php,v 1.3 2006/12/21 18:58:49 nlopess Exp $ */ // File: Core Site API File // Desc: contains core display functions, it is essential for all pages to include this file. @@ -36,6 +36,7 @@ die('Unable to access the database at this time. Please try again in a few minutes'); } +date_default_timezone_set('UTC'); // Application Initialization Function // appsvars is passed to the script by reference @@ -269,3 +270,16 @@ <?php // End content footer } + + +function footer_timestamp($tm) +{ + $date = date('r', $tm); + $diff = time_diff($tm, true); + + return <<< HTML +<p>&nbsp;</p> +<p align="center"><small>Generated at $date ($diff ago)</small></p> + +HTML; +} http://cvs.php.net/viewvc.cgi/php-gcov-web/www/viewer.php?r1=1.3&r2=1.4&diff_format=u Index: php-gcov-web/www/viewer.php diff -u php-gcov-web/www/viewer.php:1.3 php-gcov-web/www/viewer.php:1.4 --- php-gcov-web/www/viewer.php:1.3 Tue Dec 19 18:42:06 2006 +++ php-gcov-web/www/viewer.php Thu Dec 21 18:58:49 2006 @@ -1,4 +1,4 @@ -<?php +<?php /* +----------------------------------------------------------------------+ | PHP QA GCOV Website | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: viewer.php,v 1.3 2006/12/19 18:42:06 nlopess Exp $ */ +/* $Id: viewer.php,v 1.4 2006/12/21 18:58:49 nlopess Exp $ */ // Name: GCOV Viewer page // Desc: page for view PHP version information such as code coverage @@ -36,8 +36,8 @@ $file = isset($_REQUEST['file']) ? basename($_REQUEST['file']) : ''; $version = isset($_REQUEST['version']) && isset($appvars['site']['tags'][$_REQUEST['version']]) ? $_REQUEST['version'] : ''; -$mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : ''; +define('IN_GCOV_CODE', true); if(isset($_REQUEST['username']) && ctype_alnum($_REQUEST['username']) && file_exists('other_platforms/'.$_REQUEST['username'].'/'.$version)) @@ -55,59 +55,49 @@ $func_array = array( 'compile_results' => array( - 'option' => 'phpinc', 'pagetitle' => 'PHP: Compile Results for '.$version, 'pagehead' => 'Compile Results' ), - // todo: remove php_test_log - 'php_test_log' => + 'graph' => + array( + 'pagetitle' => 'PHP: '.$version. ' Graphs', + 'pagehead' => 'Graphs' + ), + 'lcov' => array( - 'option' => 'text', - 'pagetitle' => 'PHP: Test Log for '. $version, - 'pagehead' => 'Test Log' + 'pagetitle' => 'PHP: '. $version.' Code Coverage Report', + 'pagehead' => $version.': Code Coverage Report' ), 'params' => array( - 'option' => 'phpinc', 'pagetitle' => 'PHP: Parameter Parsing Report for '.$version, 'pagehead' => 'Parameter Parsing Report' ), - 'valgrind' => + 'skip' => array( - 'option' => 'phpinc', - 'pagetitle' => 'PHP: Valgrind Report for '.$version, - 'pagehead' => 'Valgrind Report' + 'pagetitle' => 'PHP: Skipped tests for '.$version, + 'pagehead' => 'Skipped Tests' + ), + 'system' => + array( + 'pagetitle' => 'PHP: System Info', + 'pagehead' => 'System Info' ), 'tests' => array( - 'option' => 'phpinc', 'pagetitle' => 'PHP: Test Failures for '.$version, 'pagehead' => 'Test Failures' ), - 'system' => + 'valgrind' => array( - 'option' => 'phpinc', - 'pagetitle' => 'PHP: System Info', - 'pagehead' => 'System Info' - ) - ); - -// Define the acceptable modes for the graphs -$graph_mode_array = array( - 'Week' => 'Weekly', - 'Month' => 'Monthly', - 'Year' => 'Yearly' + 'pagetitle' => 'PHP: Valgrind Report for '.$version, + 'pagehead' => 'Valgrind Report' + ), ); -$graph_types_array = array('codecoverage','failures','memleaks','warnings'); - - -if(isset($_REQUEST['func'])) -{ +if(isset($_REQUEST['func'])) { $func = $_REQUEST['func']; -} -else -{ +} else { $func = isset($username) ? 'system' : 'menu'; } $appvars['site']['func'] = $func; @@ -208,130 +198,31 @@ HTML; } // End check for Operating System set - } // End check for function search - - elseif (isset($func_array[$func])) - { - $incfile = $file ? $file : $func; - - // Determine the file path - $filepath = $fileroot.$version.'/'.$incfile.'.inc'; - - // Obtain file contents by the required method - if($func_array[$func]['option'] == 'phpinc') // Parse file as a PHP script - { - ob_start(); - if(file_exists($filepath)) - { - include $filepath; - } - $content = ob_get_clean(); - } - else // Treat the file contents as regular text file - { - $content = @file_get_contents($filepath); - - if($func_array[$func]['option'] == 'text') - $content = '<pre>'.$content.'</pre>'; - } + } // End check for function search + elseif (isset($func_array[$func])) { $appvars['page']['title'] = $func_array[$func]['pagetitle']; $appvars['page']['head'] = $func_array[$func]['pagehead']; $appvars['page']['headtitle'] = $version; - // Determine title based on success or failure - if($content) - { - if(isset($username)) - { - $appvars['page']['head'] .= " (builder: $username)"; - } - } - else - { - $appvars['page']['head'] .= ' Data File Not Available'; - $content = 'File could not be opened. Please try again in a few minutes, or return to the <a href="/">listing</a> page.'; - } - - } // End check for func defined in func_array - - elseif($func == 'graph') - { - // If date is not set display all available dates - if(isset($graph_mode_array[$mode])) - { - $appvars['page']['title'] = 'PHP: '.$version.' '.$graph_mode_array[$mode] . ' Graphs'; - $appvars['page']['head'] = $graph_mode_array[$mode]. ' Graphs'; - $appvars['page']['headtitle'] = $version; - - $content .= '<p>The following images show the changes in code coverage, compile warnings, memory leaks and test failures:</p>'; - - $graph_count = 0; - - foreach($graph_types_array as $graph_type) - { - $graph = "$version/graphs/{$graph_type}_$mode.png"; - - if(file_exists($graph)) - { - $content .= '<img src="'.$graph.'" />&nbsp;'."\n"; - - if(++$graph_count == 2) - $content .= "<br />\n"; - } - } + require "$func.php"; + if(isset($username)) { + $appvars['page']['head'] .= " (builder: $username)"; } - else // Display the graphs for the specified PHP version and date - { - $appvars['page']['title'] = 'PHP: '.$version.' Graphs'; - $appvars['page']['head'] = 'Graphs'; - $appvars['page']['headtitle'] = $version; - $content .= <<< HTML -<p>Select the period of time you wish to view as a graphical progression:</p> -HTML; - - foreach($graph_mode_array as $idx => $graph_mode) - { - $content .= <<< HTML -<a href="viewer.php?version=$version&func=graph&mode=$idx">$graph_mode</a><br /> -HTML; - } - } // End check for valid graph mode - - } // End check for func=graph - - else if($func == 'lcov') - // Displays the lcov content for this version - { - // Define page variables - $appvars['page']['title'] = 'PHP: '. $version.' Code Coverage Report'; - $appvars['page']['head'] = $version.': Code Coverage Report'; - $appvars['page']['headtitle'] = $version; - - if (@is_dir("$version/lcov_html")) { - header("Location: /$version/lcov_html/"); - exit; - } else { - $content = "Sorry, but the lcov data isn't available at this time."; - } - } - else if($func == 'menu') - { + } elseif ($func === 'menu') { $content = 'Please choose one function from the menu on the left.'; - } - else - { + + } else { // Define page variables $appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis'; $appvars['page']['head'] = 'PHP function not active'; - + $error .= 'The PHP version specified exists but the function specified does not appear to serve any purpose at this time.'; } -} -else -{ + +} else { // Define page variables $appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis'; $appvars['page']['head'] = 'PHP version not active'; @@ -343,16 +234,11 @@ api_showheader($appvars); // If an error occurred the command did not exist -if($error) -{ +if ($error) { echo 'Oops! Seems we were unable to execute your command. The following are the errors the system found: <br />'.$error; -} -else -{ +} else { echo $content; } -?> -<?php // Outputs the site footer to the screen api_showfooter($appvars); http://cvs.php.net/viewvc.cgi/php-gcov-web/www/graph.php?view=markup&rev=1.1 Index: php-gcov-web/www/graph.php +++ php-gcov-web/www/graph.php <?php /* +----------------------------------------------------------------------+ | PHP QA GCOV Website | +----------------------------------------------------------------------+ | Copyright (c) 2005-2006 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Nuno Lopes <nlopess@php.net> | +----------------------------------------------------------------------+ */ /* $Id: graph.php,v 1.1 2006/12/21 18:58:49 nlopess Exp $ */ if (!defined('IN_GCOV_CODE')) exit; // available graph periods $graph_mode_array = array( 'Week' => 'Weekly', 'Month' => 'Monthly', 'Year' => 'Yearly' ); // available graph types $graph_types_array = array( 'codecoverage', 'failures', 'memleaks', 'warnings' ); $mode = isset($_GET['mode']) ? $_GET['mode'] : ''; if(isset($graph_mode_array[$mode])) { $appvars['page']['title'] = 'PHP: '.$version.' '.$graph_mode_array[$mode] . ' Graphs'; $appvars['page']['head'] = $graph_mode_array[$mode]. ' Graphs'; $content .= '<p>The following images show the changes in code coverage, compile warnings, memory leaks and test failures:</p>'; $graph_count = 0; foreach($graph_types_array as $graph_type) { $graph = "$version/graphs/{$graph_type}_$mode.png"; if (file_exists($graph)) { $content .= '<img src="'.$graph.'" />&nbsp;'."\n"; if(++$graph_count == 2) { $content .= "<br />\n"; } } } } else { $appvars['page']['title'] = 'PHP: '.$version.' Graphs'; $appvars['page']['head'] = 'Graphs'; $appvars['page']['headtitle'] = $version; $content .= <<< HTML <p>Select the period of time you wish to view as a graphical progression:</p> HTML; foreach($graph_mode_array as $idx => $graph_mode) { $content .= <<< HTML <a href="viewer.php?version=$version&func=graph&mode=$idx">$graph_mode</a><br /> HTML; } } http://cvs.php.net/viewvc.cgi/php-gcov-web/www/lcov.php?view=markup&rev=1.1 Index: php-gcov-web/www/lcov.php +++ php-gcov-web/www/lcov.php <?php /* +----------------------------------------------------------------------+ | PHP QA GCOV Website | +----------------------------------------------------------------------+ | Copyright (c) 2005-2006 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Nuno Lopes <nlopess@php.net> | +----------------------------------------------------------------------+ */ /* $Id: lcov.php,v 1.1 2006/12/21 18:58:49 nlopess Exp $ */ if (!defined('IN_GCOV_CODE')) exit; if (@is_dir("$version/lcov_html")) { header("Location: /$version/lcov_html/"); exit; } else { $content = "Sorry, but the lcov data isn't available at this time."; } http://cvs.php.net/viewvc.cgi/php-gcov-web/www/skip.php?view=markup&rev=1.1 Index: php-gcov-web/www/skip.php +++ php-gcov-web/www/skip.php <?php /* +----------------------------------------------------------------------+ | PHP QA GCOV Website | +----------------------------------------------------------------------+ | Copyright (c) 2005-2006 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Nuno Lopes <nlopess@php.net> | +----------------------------------------------------------------------+ */ /* $Id: skip.php,v 1.1 2006/12/21 18:58:49 nlopess Exp $ */ if (!defined('IN_GCOV_CODE')) exit; $inputfile = "./$version/skip.inc"; $raw_data = @file_get_contents($inputfile); $data = unserialize($raw_data); $old_dir = ''; if (!$raw_data) { $content = "<p>Sorry, but this data isn't available at this time.</p>"; return; } elseif (isset($_GET['file'])) { $file = $_GET['file']; $appvars['page']['title'] = "PHP: $version Skip Report for $file"; $appvars['page']['head'] = "Skip Report for $file"; if (isset($data[$file])) { $data = $data[$file]; $script = highlight_string($data[0], true); $reason = htmlspecialchars($data[1] ? $data[1] : '(no reason given)'); $content = <<< HTML <h2>Script</h2> $script <h2>Reason</h2> <pre>$reason</pre> HTML; } else { $content = "<p>Invalid file ID.</p>\n"; } } elseif ($data) { $content = '<p><b>'.count($data) . " tests were skipped:</b></p>\n"; $content .= <<< HTML <table border="1"> HTML; foreach ($data as $path => $entry) { $dir = dirname($path); $file = basename($path); $urlfile = htmlspecialchars(urlencode($path)); $reason = $entry[1] ? $entry[1] : '(no reason given)'; if ($dir !== $old_dir) { $old_dir = $dir; $content .= <<< HTML <tr> <td colspan="2" align="center"><b>$dir</b></td> </tr> <tr> <td><b>File</b></td> <td><b>Reason</b></td> </tr> HTML; } $content .= <<< HTML <tr> <td><a href="/viewer.php?version=$version&amp;func=skip&amp;file=$urlfile">$file</a></td> <td>$reason</td> </tr> HTML; } $content .= <<< HTML </table> HTML; } else { $content = "<p>Currently there are no skipped tests!</p>\n"; } $content .= footer_timestamp(@filemtime($inputfile)); http://cvs.php.net/viewvc.cgi/php-gcov-web/www/tests.php?view=markup&rev=1.1 Index: php-gcov-web/www/tests.php +++ php-gcov-web/www/tests.php <?php /* +----------------------------------------------------------------------+ | PHP QA GCOV Website | +----------------------------------------------------------------------+ | Copyright (c) 2005-2006 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Nuno Lopes <nlopess@php.net> | +----------------------------------------------------------------------+ */ /* $Id: tests.php,v 1.1 2006/12/21 18:58:49 nlopess Exp $ */ if (!defined('IN_GCOV_CODE')) exit; $inputfile = "./$version/fail.inc"; $raw_data = @file_get_contents($inputfile); $data = unserialize($raw_data); $old_dir = ''; if (!$raw_data) { $content = "<p>Sorry, but this data isn't available at this time.</p>"; return; } elseif (isset($_GET['file'])) { $file = $_GET['file']; $appvars['page']['title'] = "PHP: $version Test Failure Report for $file"; $appvars['page']['head'] = "Test Failure Report for $file"; if (isset($data[$file])) { $data = $data[$file]; $diff = htmlspecialchars($data[2]); $exp = htmlspecialchars($data[3]); $output = htmlspecialchars($data[4]); $script = highlight_string($data[5], true); $content = <<< HTML <h2>Script</h2> $script <h2>Expected</h2> <pre>$exp</pre> <h2>Output</h2> <pre>$output</pre> <h2>Diff</h2> <pre>$diff</pre> HTML; } else { $content = "<p>Invalid file ID.</p>\n"; } } elseif ($data) { $content = '<p><b>'.count($data) . " tests failed:</b></p>\n"; $content .= <<< HTML <table border="1"> HTML; foreach ($data as $path => $entry) { $dir = dirname($path); $file = basename($path); $urlfile = htmlspecialchars(urlencode($path)); $type = $entry[0]; $title = $entry[1]; if ($dir !== $old_dir) { $old_dir = $dir; $content .= <<< HTML <tr> <td colspan="3" align="center"><b>$dir</b></td> </tr> <tr> <td><b>File</b></td> <td><b>Type</b></td> <td><b>Name</b></td> </tr> HTML; } $content .= <<< HTML <tr> <td><a href="/viewer.php?version=$version&amp;func=tests&amp;file=$urlfile">$file</a></td> <td>$type</td> <td>$title</td> </tr> HTML; } $content .= <<< HTML </table> HTML; } else { $content = "<p>Congratulations! Currently there are no test failures!</p>\n"; } $content .= footer_timestamp(@filemtime($inputfile));
« previous php.mirrors (#33578) next »