cvs: php-gcov-web(SOC06) /cron build_time.php compile_results.php cron.php cron.sh graph.php mailer.php system.php tags.inc tests.php valgrind.php
| From: | Daniel Pronych | Date: | Tue, 08 Aug 2006 18:03:04 +0000 |
| Subject: | cvs: php-gcov-web(SOC06) /cron build_time.php compile_results.php cron.php cron.sh graph.php mailer.php system.php tags.inc tests.php valgrind.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-32106@lists.php.net to get a copy of this message | ||
pronych Tue Aug 8 18:03:04 2006 UTC
Added files: (Branch: SOC06)
/php-gcov-web/cron graph.php mailer.php
Modified files:
/php-gcov-web/cron build_time.php compile_results.php cron.php
cron.sh system.php tags.inc tests.php
valgrind.php
Log:
Unicode handling, fundamentals for server posting and graphs
http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/build_time.php?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/cron/build_time.php diff -u php-gcov-web/cron/build_time.php:1.1.2.1 php-gcov-web/cron/build_time.php:1.1.2.2 --- php-gcov-web/cron/build_time.php:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/cron/build_time.php Tue Aug 8 18:03:03 2006 @@ -1,22 +1,20 @@ -<?php - -// script to get the build time of the php version - -$filename = '../tmp/PHP_5_2/php_test_valgrind.log'; -$fh = fopen($filename, 'r'); -$content = fread($fh, filesize($filename)); -fclose($fh); - -//$buildtime = preg_match('/Time taken[ ]? :[ ]?(\d*)[ ]?seconds/', $content); - -preg_match('/Time taken[ ]*:[ ]* ([0-9]+) seconds/', $content, $matches); - -//echo $buildtime.' seconds'."\n"; - -print_r($matches); -echo "\n"; - -if(is_array($matches)) -{ - echo $matches[1]."\n"; -} +<?php + +// script to get the build time of the php version + +$content = file_get_contents($tmpdir.DIRECTORY_SEPARATOR.'php_test.log'); + +//$buildtime = preg_match('/Time taken[ ]? :[ ]?(\d*)[ ]?seconds/', $content); + +preg_match('/Time taken[ ]*:[ ]* ([0-9]+) seconds/', $content, $matches); + +//echo $buildtime.' seconds'."\n"; + +//print_r($matches); +//echo "\n"; + +if(is_array($matches)) +{ + //echo $matches[1]."\n"; + $build_time = $matches[1]; +} http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/compile_results.php?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/cron/compile_results.php diff -u php-gcov-web/cron/compile_results.php:1.1.2.1 php-gcov-web/cron/compile_results.php:1.1.2.2 --- php-gcov-web/cron/compile_results.php:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/cron/compile_results.php Tue Aug 8 18:03:03 2006 @@ -1,147 +1,169 @@ -<?php - -// todo: make alphabetical sorting on compile_errors.php - -// todo: START adding for specific compile_errors.php generation only -//$phpdir="/home/quadra23/temp/PHP_5_2"; -//$tmpdir="/home/quadra23/temp/tmp"; -////$outdir="/var/www/PHP_5_2err"; -//$outdir="/var/www/gcov/PHP_5_2/"; -//VALGRIND=valgrind -// todo: END adding for specific compile_errors.php generation only - -//$phpsrc .= '/'; - -if(!defined('CRON_PHP')) -{ - echo 'Sorry this file must be called by a cron script'."\n"; - exit; -} - -$result['numerrors'] = 0; -$result['numwarnings'] = 0; -$result['totalnumerrors'] = 0; -$result['totalnumwarnings'] = 0; - -require_once 'template.php'; - -$data = file_get_contents("$tmpdir/php_build.log"); - - -// REGEX to fetch the gcc errors/warnings. tuned for gcc 3.4.x and 4.0.x -$gcc_regex = '/^(.+): In function [`\'](\w+)\':\s+'. - '\1:(\d+):\s+(.+)'. - str_repeat('(?:\s+\1:(\d+):\s+(.+))?', 99). // nick hack to capture up to 100 errors in the same function - '/m'; - -preg_match_all($gcc_regex, $data, $data, PREG_SET_ORDER); - -$stats = array(); - -foreach ($data as $error) -{ - - $file = $error[1]; - - // Remove the phpdir portion from the file path if it occurs - if(substr($file, 0, strlen($phpdir)) == $phpdir) - { - $filepath = substr($file, strlen($phpdir)); - } - else // todo; fix the need for the additional / in front - { - $filepath = '/'.$file; - $file = '/'.$file; - } - - $function = $error[2]; - - $write = ''; - - for ($i = 3; isset($error[$i]); $i += 2) { - $line = $error[$i]; - $msg = $error[$i+1]; - - $write .= <<< HTML - <tr> - <td>$function</td> - <td><a href="http://lxr.php.net/source/php-src{$filepath}#{$line}">$line</a></td> - <td>$msg</td> - </tr> -HTML; - if(substr($msg, 0, strlen('error')) == 'error') - { - $result['numerrors']++; - $result['totalnumerrors']++; - } - elseif(substr($msg, 0, strlen('warning')) == 'warning') - { - $result['numwarnings']++; - $result['totalnumwarnings']++; - } - else - { - } - - } - - @$stats[$file][0] = $result['numerrors']; // number of file errros - @$stats[$file][1] = $result['numwarnings']; // number of file warnings - //@$stats[$file][0] += ($i-3)/2; // number of errors in this file - @$stats[$file][2] .= $write; // data to write - -} - -// now write the stuff -$fp = fopen("$outdir/compile_results.inc", 'w'); -//fwrite($fp, html_header('Compile errors/warnings')); - -fwrite($fp, "<p>Number of Errors: {$result['totalnumerrors']}<br />Number of Warnings: {$result['numwarnings']}<br />Total: ".($result['totalnumerrors']+$result['numwarnings'])."</p>"); - -fwrite($fp, '<table border="1"><tr><td>File</td><td>Number of errors</td><td>Number of warnings</td></tr>'); - -$phpdir_len = strlen($phpdir)+1; -$total = 0; - -foreach ($stats as $file => $data) -{ - - $hash = md5($file); // files have consistent start character - - //$short_file = substr($file, $phpdir_len); - - // Compare first portion of file name to phpsrc - if(substr($file, 0, strlen($phpdir)) == $phpdir) - { - $short_file = substr($file, strlen($phpdir)); - } - else // If phpsrc does not occur, display full file name (todo: verify) - { - $short_file = $file; - } - - $total += $data[0]; - fwrite($fp, "<tr><td><a href='viewer.php?version=$version&func=compile_results&file=$hash'>$short_file</a></td><td>$data[0]</td><td>$data[1]</td></tr>\n"); - - $write = <<< HTML -<table border="1"> - <tr> - <td>Function</td> - <td>Line</td> - <td>Message</td> - </tr> -HTML; - - file_put_contents("$outdir/$hash.inc", - //html_header('Messages specific to "'. basename($file) . '"'). - //' $filename="'.$basename($file).'"; '. - '<?php $filename="'.basename($file).'"; ?>'. - $write. - $data[2]. - '</table>'. - html_footer()); -} - -fwrite($fp, '</table>'.html_footer()); -fclose($fp); -?> +<?php + +// todo: make alphabetical sorting on compile_errors.php + +// todo: START adding for specific compile_errors.php generation only +//$phpdir="/home/quadra23/temp/PHP_5_2"; +//$tmpdir="/home/quadra23/temp/tmp"; +////$outdir="/var/www/PHP_5_2err"; +//$outdir="/var/www/gcov/PHP_5_2/"; +//VALGRIND=valgrind +// todo: END adding for specific compile_errors.php generation only + +//$phpsrc .= '/'; + +if(!defined('CRON_PHP')) +{ + echo 'Sorry this file must be called by a cron script'."\n"; + exit; +} + +$totalnumerrors = 0; +$totalnumwarnings = 0; + +require_once 'template.php'; + +$data = file_get_contents("$tmpdir/php_build.log"); + + +// REGEX to fetch the gcc errors/warnings. tuned for gcc 3.4.x and 4.0.x +/* +$gcc_regex = '/^(.+): In function [`\'](\w+)\':\s+'. + '\1:(\d+):\s+(.+)'. + str_repeat('(?:\s+\1:(\d+):\s+(.+))?', 99). // nick hack to capture up to 100 errors in the same function + '/m'; +*/ + +$gcc_regex = '/^(.+): In function [`\'](\w+)\':\s+'. + '\1:(\d+): (error|warning):\s+(.+)'. + str_repeat('(?:\s+\1:(\d+): (error|warning):\s+(.+))?', 99). + '/m'; + +preg_match_all($gcc_regex, $data, $data, PREG_SET_ORDER); + +$stats = array(); + +foreach ($data as $error) +{ + + $file = $error[1]; + + // Remove the phpdir portion from the file path if it occurs + if(substr($file, 0, strlen($phpdir)) == $phpdir) + { + $filepath = substr($file, strlen($phpdir)); + } + else // todo; fix the need for the additional / in front + { + //$filepath = '/'.$file; + $file = '/'.$file; + } + + // If stats are not previously set for this file, initialize it to the default values + if(!isset($stats[$file])) + { + @$stats[$file][0] = 0; // number of file errros + @$stats[$file][1] = 0; // number of file warnings + @$stats[$file][2] = ''; // data to write + } + + + + $function = $error[2]; + + $write = ''; + + // increment +3 because of the addition of type + for ($i = 3; isset($error[$i]); $i += 3) { + $line = $error[$i]; + $type = $error[$i+1]; // added + $msg = $error[$i+2]; + + $write .= <<< HTML + <tr> + <td>$function</td> + <td><a href="http://lxr.php.net/source/php-src{$filepath}#{$line}">$line</a></td> + <td>$type: $msg</td> + </tr> +HTML; + if($type == 'error') + { + @$stats[$file][0] += 1; // number of file errros + $totalnumerrors++; + } + elseif($type == 'warning') + { + @$stats[$file][1] += 1; // number of file warnings + $totalnumwarnings++; + } + else + { + } + + $t = array(); + $t['file'] = $filepath; + $t['function'] = $function; + $t['line'] = $line; + $t['type'] = $type; + $t['msg'] = $msg; + + $xmlarray['compile_results'][] = $t; + } + + @$stats[$file][2] .= $write; // data to write + +} + +// now write the stuff +$fp = fopen("$outdir/compile_results.inc", 'w'); +//fwrite($fp, html_header('Compile errors/warnings')); + +fwrite($fp, "<p>Number of Errors: {$totalnumerrors}<br />Number of Warnings: {$totalnumwarnings}<br />Total: ".($totalnumerrors+$totalnumwarnings)."</p>"); + +fwrite($fp, '<table border="1"><tr><td>File</td><td>Number of errors</td><td>Number of warnings</td></tr>'); + +$phpdir_len = strlen($phpdir)+1; +$total = 0; + +foreach ($stats as $file => $data) +{ + + $hash = md5($file); // files have consistent start character + + //$short_file = substr($file, $phpdir_len); + + // Compare first portion of file name to phpsrc + if(substr($file, 0, strlen($phpdir)) == $phpdir) + { + $short_file = substr($file, strlen($phpdir)); + } + else // If phpsrc does not occur, display full file name (todo: verify) + { + $short_file = $file; + } + + $total += $data[0]; + fwrite($fp, "<tr><td><a href='viewer.php?version=$version&func=compile_results&file=$hash'>$short_file</a></td><td>$data[0]</td><td>$data[1]</td></tr>\n"); + + $write = <<< HTML +<table border="1"> + <tr> + <td>Function</td> + <td>Line</td> + <td>Message</td> + </tr> +HTML; + + file_put_contents("$outdir/$hash.inc", + //html_header('Messages specific to "'. basename($file) . '"'). + //' $filename="'.$basename($file).'"; '. + '<?php $filename="'.basename($file).'"; ?>'. + $write. + $data[2]. + '</table>'. + html_footer()); +} + +fwrite($fp, '</table>'.html_footer()); +fclose($fp); +?> http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/cron.php?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/cron/cron.php diff -u php-gcov-web/cron/cron.php:1.1.2.1 php-gcov-web/cron/cron.php:1.1.2.2 --- php-gcov-web/cron/cron.php:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/cron/cron.php Tue Aug 8 18:03:03 2006 @@ -1,43 +1,233 @@ -<?php - -if ($argc != 5) die("only 4 arguments: [tmp] [out] [phpsrc] [makestatus]\n\n"); - -define('CRON_PHP',true); - -$tmpdir = $argv[1]; -$outdir = $argv[2]; -$phpdir = $argv[3]; -$makestatus = $argv[4]; // make status from bash script (fail or pass) -$workdir = dirname(__FILE__); - -$makedata = ''; - -// Set up variables that apply to all scripts -$version = basename($phpdir, __FILE__); // todo: make this dynamic or based on the tags instead - -require $workdir.'/template.php'; - -//process stuff -require $workdir.'/compile_results.php'; // make compile errors/warnings file - -// If the make passes -if(trim($makestatus) == 'pass') -{ - require $workdir.'/tests.php'; - #require $workdir.'/run_tests.php'; - require $workdir.'/system.php'; - - $makedata = 'pass'; -} -else -{ - $makedata = 'fail'; -} - -$fh = fopen($outdir.DIRECTORY_SEPARATOR.'last_make_status.inc', 'w'); -#todo: if write fails we need to do something about it -fwrite($fh, $makedata); -fclose($fh); - -//require $workdir.'/make-index.php'; // make the index file -?> +<?php + +if ($argc != 6) die("cron.php requires 5 arguments: [tmp] [out] [phpsrc] [makestatus] [phpversion]\n\n"); + +define('CRON_PHP',true); + +$tmpdir = $argv[1]; +$outdir = $argv[2]; +$phpdir = $argv[3]; +$makestatus = $argv[4]; // make status from bash script (fail or pass) +$phpver = $argv[5]; +$workdir = dirname(__FILE__); + +// Initialize core variables +$build_time = -1; // Total time required for build (build_time.php) + +$totalnumerrors = 0; // Total number of errors (compile_errors.php) +$totalnumwarnings = 0; // Total number of warnings (compile_errors.php) + +$totalnumleaks = 0; // Total number of memory leaks (valgrind.php) +$totalnumfailures = 0; // Total number of test failures (tests.php) + +$linkerinfo = 'N/A'; // Information regarding linker (system.php) +$compilerinfo = 'N/A'; // Information regarding compiler (system.php) +$osinfo = 'N/A'; // Information regarding operating system (system.php) + +$version_id = 0; + +$xmlarray = array(); + +// Set up variables that apply to all scripts +$version = basename($phpdir, __FILE__); // todo: make this dynamic or based on the tags instead + +// Load main configuration including database connection +require $workdir.'/config.php'; + +// Load templates +require $workdir.'/template.php'; + +//process stuff +require $workdir.'/compile_results.php'; // make compile errors/warnings file + +require $workdir.'/system.php'; + +// Get version ID for current version + +try +{ + $sql = 'SELECT version_id FROM versions WHERE version_name = ?'; + $stmt = $mysqlconn->prepare($sql); + $stmt->execute(array($phpver)); + $version_id = $stmt->fetchColumn(); +} +catch(PDOException $e) +{ + // if error occurs log, output and ensure the version_id is not legimate + $version_id = 0; +} + +if($version_id > 0) +{ + // Add new build to the build tables + $build_date = date('Y-m-d'); + $build_datetime = date('Y-m-d H-i-s'); + $stmt = null; + + $sql = 'INSERT INTO builds (version_id, build_date, build_datetime, build_numerrors, build_numwarnings, build_numfailures, build_numleaks, build_os_info, build_compiler_info, build_linker_info) '. +'VALUES (:version_id, :build_date, :build_datetime, :build_numerrors, :build_numwarnings, :build_numfailures, :build_numleaks, :build_os_info, :build_compiler_info, :build_linker_info) '; + $stmt = $mysqlconn->prepare($sql); + + $stmt->bindParam(':version_id', $version_id); + $stmt->bindParam(':build_date', $build_date); + $stmt->bindParam(':build_datetime', $build_datetime); + $stmt->bindParam(':build_numerrors', $totalnumerrors); + $stmt->bindParam(':build_numwarnings', $totalnumwarnings); + $stmt->bindParam(':build_numfailures', $totalnumfailures); + $stmt->bindParam(':build_numleaks', $totalnumleaks); + $stmt->bindParam(':build_os_info', $osinfo); + $stmt->bindParam(':build_compiler_info', $compilerinfo); + $stmt->bindParam(':build_linker_info', $linkerinfo); + $stmt->execute(); + $stmt = null; + + if($makestatus == 'pass') + { + require $workdir.'/tests.php'; + require $workdir.'/build_time.php'; + + // todo: if a Sunday, call graphs otherwise skip + if(date('D') == 'Sun') + { + require $workdir.'/graph.php'; + } + + // Do SQL updates for the specific PHP version + + $sql = 'UPDATE versions SET version_last_build_time = ?, version_last_attempted_build_date = ?, version_last_successful_build_date = ? WHERE version_id = ?'; + $stmt_arr = array($build_time, $build_datetime, $build_datetime, $version_id); + } + else + { + // If build fails only update the last attempted build date for the version + $sql = 'UPDATE versions SET version_last_attempted_build_date = ? WHERE version_id = ?'; + $stmt_arr = array($build_datetime, $version_id); + } + $stmt = $mysqlconn->prepare($sql); + $stmt->execute($stmt_arr); + + // Update the existing version information + echo 'Build Time: '.$build_time."\n"; + + +} +else +{ + // we may not want to log this as the PHP version may have been made up +} + +file_put_contents($outdir.DIRECTORY_SEPARATOR.'last_make_status.inc', $makestatus); +#todo: if write fails we need to do something about it + +// todo: start of XML output + +//$xml_array = array('php_build.log','php_test.log'); + + +// Parse valgrind output file +$valgrind_serialized = file_get_contents("$outdir/valgrind.txt") or $valgrind_serialized = null; + +if(!is_null($valgrind_serialized)) +{ + //$xml_array['valgrind'] = array(); + $xmlarray['valgrind'] = unserialize($valgrind_serialized); + + //$valgrind = unserialize($valgrind_serialized); + +} +else +{ + echo 'no valgrind to read'."\n"; +} + +$xml_out = '<?xml version="1.0" encoding="UTF-8"?>'."\n" + .'<build>'."\n" + .'<buildinfo>'."\n" + .'<username>johndoe'.'</username>'."\n" + .'<version>'.$phpver.'</version>'."\n" + .'<buildstatus>'.$makestatus.'</buildstatus>'."\n" + .'<compiler>'.$compilerinfo.'</compiler>'."\n" + .'<linker>'.$linkerinfo.'</linker>'."\n" + .'<os>'.$osinfo.'</os>'."\n" + .'</buildinfo>'."\n" + .'<builddata>'."\n"; + +$xml_search_for = array($phpdir); +$xml_replace_with = array(''); + + +if(isset($xmlarray['compile_results'])) +{ + $xml_out .= '<compile_results>'."\n"; + //$xml_out .= '<files>'."\n"; + + foreach($xmlarray['compile_results'] as $res) + { + $xml_out .= '<message file="'.$res['file'].'" ' + .'function="'.$res['function'].'" ' + .'line="'.$res['line'].'" ' + .'type="'.$res['type'].'">' + .$res['msg'].'</message>'."\n"; + } + + $xml_out .= '</compile_results>'."\n"; +} // End check for compile results + + +if(isset($xmlarray['tests'])) +{ + $xml_out .= '<tests>'."\n"; + + foreach($xmlarray['tests'] as $test) + { + $xml_out .= '<test status="'.$test['status'].'" ' + .'file="'.$test['file'].'">'; + + if(strtolower($test['status']) == 'fail') + { + $xml_out .= "\n" + .'<expected>' + .htmlspecialchars($test['expected']) + .'</expected>'."\n" + .'<output>' + .htmlspecialchars($test['output']) + .'</output>'."\n" + .'<difference>'."\n" + .htmlspecialchars($test['difference']) + .'</difference>'; + } + else + { + } + $xml_out .= '</test>'."\n"; + } + + $xml_out .= '</tests>'."\n"; + +} // End check for tests + + +$xml_out .= '</builddata>'."\n" + .'</build>'."\n"; + +if(file_put_contents($tmpdir.'/build.new.xml', $xml_out)) +{ + echo 'XML file written'."\n"; +} + + +file_put_contents($outdir.'/build.new.xml', $xml_out); + + + +ob_start(); + +print_r($xmlarray); + +$contents = ob_get_clean(); + +file_put_contents($outdir.'/build.new.txt', $contents); + + +//require $workdir.'/make-index.php'; // make the index file +?> http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/cron.sh?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/cron/cron.sh diff -u php-gcov-web/cron/cron.sh:1.1.2.1 php-gcov-web/cron/cron.sh:1.1.2.2 --- php-gcov-web/cron/cron.sh:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/cron/cron.sh Tue Aug 8 18:03:03 2006 @@ -1,74 +1,84 @@ -#!/bin/sh - -LC_ALL=C -export LC_ALL - -VALGRIND=valgrind - -# file that contains the PHP version tags -filename=tags.inc - -# the maximum number of elements for a single php version -php_max_version_elements=4 - -WORKDIR=`dirname "$0"` -echo "$WORKDIR" | grep -q '^/' || WORKDIR="`pwd`/$WORKDIR" # get absolute path - -. ${WORKDIR}/config.sh - -# set up a one dimensional array to store all php version information -declare -a php_version_array -php_version_array=( `cat "$filename"` ) - -# Calculate how many elements there are in a php version array -php_version_totalcount=${#php_version_array[@]} - -# loop through each PHP version and perform the required builds -for (( i = 0 ; i < ${php_version_totalcount} ; i += ${php_max_version_elements} )) -do - #set up the php version information - echo ${php_version_array[i]} - PHPVERSION=${php_version_array[i]} - echo ${php_version_array[i+1]} - PHPSRC=${php_version_array[i+1]} - echo ${php_version_array[i+2]} - TMPDIR=${php_version_array[i+2]} - echo ${php_version_array[i+3]} - OUTDIR=${php_version_array[i+3]} - - # run the loop for each php version - cd ${PHPSRC} - ./cvsclean - # cvs -q up - ./buildconf - ./config.nice - - #test for success of the make operation - #if ( make > ${OUTDIR}/make_log.inc 2> ${TMPDIR}/php_build.log ); then - if ( make > /dev/null 2> ${TMPDIR}/php_build.log ); then - #echo pass > ${OUTDIR}/last_make_status.inc - - MAKESTATUS=pass - - export NO_INTERACTION=1 - export TEST_PHP_VALGRIND=${VALGRIND} - make test > ${TMPDIR}/php_test_valgrind.log - php ${WORKDIR}/valgrind.php ${TMPDIR} ${OUTDIR} ${PHPSRC} - - #rm .php_cov_info.ltpdata - #rm -r "*.gcov" - make lcov --warn-undefined-variables - make lcov-html --warn-undefined-variables - rm -fr ${OUTDIR}/lcov_html - mv lcov_html ${OUTDIR} - - echo make successful - else - #if make failed - - #echo fail > ${OUTDIR}/last_make_status.inc - MAKESTATUS=fail - echo make failed - fi - php ${WORKDIR}/cron.php ${TMPDIR} ${OUTDIR} ${PHPSRC} ${MAKESTATUS} -done +#!/bin/sh + +LC_ALL=C +export LC_ALL + +VALGRIND=valgrind + +# file that contains the PHP version tags +filename=tags.inc + +# the maximum number of elements for a single php version +php_max_version_elements=4 + +WORKDIR=`dirname "$0"` +echo "$WORKDIR" | grep -q '^/' || WORKDIR="`pwd`/$WORKDIR" # get absolute path + +. ${WORKDIR}/config.sh + +# set up a one dimensional array to store all php version information +declare -a php_version_array +php_version_array=( `cat "$filename"` ) + +# Calculate how many elements there are in a php version array +php_version_totalcount=${#php_version_array[@]} + +# loop through each PHP version and perform the required builds +for (( i = 0 ; i < ${php_version_totalcount} ; i += ${php_max_version_elements} )) +do + #set up the php version information + echo ${php_version_array[i]} + PHPVERSION=${php_version_array[i]} + echo ${php_version_array[i+1]} + PHPSRC=${php_version_array[i+1]} + echo ${php_version_array[i+2]} + TMPDIR=${php_version_array[i+2]} + echo ${php_version_array[i+3]} + OUTDIR=${php_version_array[i+3]} + + # run the loop for each php version + cd ${PHPSRC} + ./cvsclean + cvs -q up + ./buildconf + ./config.nice + + #test for success of the make operation + if ( make > /dev/null 2> ${TMPDIR}/php_build.log ); then + #echo pass > ${OUTDIR}/last_make_status.inc + + MAKESTATUS=pass + + # note: start this enables valgrind + export NO_INTERACTION=1 + export TEST_PHP_VALGRIND=${VALGRIND} + make test > ${TMPDIR}/php_test_valgrind.log + php ${WORKDIR}/valgrind.php ${TMPDIR} ${OUTDIR} ${PHPSRC} + # note: end this enables valgrind + + #rm .php_cov_info.ltpdata + #rm -r "*.gcov" + + make lcov --warn-undefined-variables + make lcov-html --warn-undefined-variables + #rm -fr ${OUTDIR}/lcov_html + mv lcov_html ${OUTDIR} + + export NO_INTERACTION=1 + #export TEST_PHP_VALGRIND= + + # note: start this enables run-tests + export TEST_PHP_EXECUTABLE="./sapi/cli/php" + ./sapi/cli/php run-tests.php -U -m > ${TMPDIR}/php_test.log + # note: end this enables run-tests + + echo make successful + else + #if make failed + + MAKESTATUS=fail + + echo make failed + fi + php ${WORKDIR}/cron.php ${TMPDIR} ${OUTDIR} ${PHPSRC} ${MAKESTATUS} ${PHPVERSION} +done http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/system.php?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/cron/system.php diff -u php-gcov-web/cron/system.php:1.1.2.1 php-gcov-web/cron/system.php:1.1.2.2 --- php-gcov-web/cron/system.php:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/cron/system.php Tue Aug 8 18:03:04 2006 @@ -1,23 +1,26 @@ -<?php - -$write = html_header('System Info'); - -// configure -$write .= "<h2>Configure used:</h2>\n"; -$config = file("$phpdir/config.nice"); -$config = array_slice($config, 4); //remove inital comments -$write .= "<pre>". implode('', $config) ."</pre>\n"; - -// compiler -$write .= "<h2>Compiler used</h2>\n"; -$compiler = explode("\n", `gcc --version`); -$write .= '<p>' . $compiler[0] . "</p>\n"; - -// SO -$write .= "<h2>Operating System:</h2>\n"; -$write .= '<p>' . `uname -srmi` . "</p>\n"; - -$write .= html_footer(); - -file_put_contents("$outdir/system.inc", $write); -?> +<?php + +$write = html_header('System Info'); + +// configure (linker?) +$write .= "<h2>Configure used:</h2>\n"; +$config = file("$phpdir/config.nice"); +$config = array_slice($config, 4); //remove inital comments +$linkerinfo = implode('', $config); +$write .= "<pre>".$linkerinfo."</pre>\n"; + +// compiler +$write .= "<h2>Compiler used</h2>\n"; +$compiler = explode("\n", `gcc --version`); +$compilerinfo = $compiler[0]; +$write .= '<p>'.$compilerinfo. "</p>\n"; + +// OS +$write .= "<h2>Operating System:</h2>\n"; +$osinfo = `uname -srmi`; +$write .= '<p>'.$osinfo."</p>\n"; + +$write .= html_footer(); + +file_put_contents("$outdir/system.inc", $write); +?> http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/tags.inc?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/cron/tags.inc diff -u php-gcov-web/cron/tags.inc:1.1.2.1 php-gcov-web/cron/tags.inc:1.1.2.2 --- php-gcov-web/cron/tags.inc:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/cron/tags.inc Tue Aug 8 18:03:04 2006 @@ -1,4 +1,5 @@ PHP_4_4 /home/quadra23/temp/PHP_4_4 /home/quadra23/temp/tmp/PHP_4_4 /var/local/gcov/www/PHP_4_4 PHP_5_1 /home/quadra23/temp/PHP_5_1 /home/quadra23/temp/tmp/PHP_5_1 /var/local/gcov/www/PHP_5_1 PHP_5_2 /home/quadra23/temp/PHP_5_2 /home/quadra23/temp/tmp/PHP_5_2 /var/local/gcov/www/PHP_5_2 +PHP_5_E /home/quadra23/temp/PHP_5_E /home/quadra23/temp/tmp/PHP_5_E /var/local/gcov/www/PHP_5_E PHP_HEAD /home/quadra23/temp/PHP_HEAD /home/quadra23/temp/tmp/PHP_HEAD /var/local/gcov/www/PHP_HEAD http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/tests.php?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/cron/tests.php diff -u php-gcov-web/cron/tests.php:1.1.2.1 php-gcov-web/cron/tests.php:1.1.2.2 --- php-gcov-web/cron/tests.php:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/cron/tests.php Tue Aug 8 18:03:04 2006 @@ -1,74 +1,106 @@ -<?php - -// Ensure the write variable is empty before inserting content -$write = ''; - -$data = file_get_contents("$tmpdir/php_test.log"); -//$write = html_header('Test Failures'); - -$test_regex = '/Number of tests :\s*\d+\s+\d+\n'. - 'Tests skipped :\s*\d+\s*\(\s*\d+\.\d+%\) --------\n'. - 'Tests warned :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)\n'. - 'Tests failed :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)\n'. - 'Tests passed :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)/'; - -preg_match($test_regex, $data, $m); -$test_summary = $m[0]; - - -preg_match_all('/FAIL (?P<title>.+) \[(?P<file>[^\]]+)\]/', $data, $failed, PREG_SET_ORDER); - -$old_dir = ''; - -if (count($failed) == 0) { - $write .= "<p>Congratulations! Currently there are no test failures!</p>\n"; -} else { - $write .= <<< HTML -<table border="1"> - <tr> - <td>File</td> - <td>Name</td> - </tr> -HTML; -} - - -foreach ($failed as $test) { - - $file = basename($test['file']); - $title = $test['title']; - $dir = dirname($test['file']); - $hash = md5($test['file']); - - if ($old_dir != $dir) { - $old_dir = $dir; - $write .= "<tr><td colspan='2' align='center'><b>$dir</b></td></tr>\n"; - } - - $write .= "<tr><td><a href='viewer.php?version=$version&func=tests&file=$hash'>$file</a></td><td>$title</td></tr>\n"; - - // todo: did str_replace of phpdir, is this a good idea? - - $base = "$phpdir/".substr($test['file'],0,-4); - $additional = - "<h2>Script</h2><pre>\n" . highlight_file($base.'php', true). - "\n</pre><h2>Expected</h2><pre>\n" . htmlentities(file_get_contents($base.'exp')). - "\n</pre><h2>Output</h2><pre>\n" .htmlentities(str_replace($phpdir,'',file_get_contents($base.'out'))). - "\n</pre><h2>Diff</h2><pre>\n".htmlentities(str_replace($phpdir,'',file_get_contents($base.'diff')))."\n</pre>"; - - // now create the test's page - file_put_contents("$outdir/$hash.inc", - //html_header("Test Failure: $file"). - '<?php $filename="'.basename($file).'"; ?>'. - $additional. - html_footer() - ); -} - -if (count($failed)) - $write .= "</table>\n"; - -$write .= html_footer(); - -file_put_contents("$outdir/tests.inc", $write); -?> +<?php + +// Ensure the write variable is empty before inserting content +$write = ''; + +$data = file_get_contents("$tmpdir/php_test.log"); +//$write = html_header('Test Failures'); + +$test_regex = '/Number of tests :\s*\d+\s+\d+\n'. + 'Tests skipped :\s*\d+\s*\(\s*\d+\.\d+%\) --------\n'. + 'Tests warned :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)\n'. + 'Tests failed :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)\n'. + 'Tests passed :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)/'; + +preg_match($test_regex, $data, $m); +$test_summary = $m[0]; + +// Grab the results according to failure or pass +preg_match_all('/(?P<status>FAIL|PASS) (?P<title>.+) \[(?P<file>[^\]]+)\]/', $data, $tests, PREG_SET_ORDER); + +//print_r($tests); + +// todo: do a count instead of a bloated get all failures +preg_match_all('/FAIL (?P<title>.+) \[(?P<file>[^\]]+)\]/', $data, $failed, PREG_SET_ORDER); + +$old_dir = ''; + +if (count($failed) < 1) { + $write .= "<p>Congratulations! Currently there are no test failures!</p>\n"; +} else { + $totalnumfailures = count($failed); + + $write .= <<< HTML +<table border="1"> + <tr> + <td>File</td> + <td>Name</td> + </tr> +HTML; +} + + +foreach ($tests as $test) { + + $file = basename($test['file']); + $status = $test['status']; + $title = $test['title']; + $dir = dirname($test['file']); + $hash = md5($test['file']); + + $base = "$phpdir/".substr($test['file'],0,-4); + + $t = array(); + if(strtolower($status) == 'fail') + { + $t['status'] = 'fail'; + $t['file'] = $test['file']; + $t['expected'] = file_get_contents($base.'exp') + or $t['expected'] = 'N\A'; + $t['output'] = file_get_contents($base.'out') + or $t['output'] = 'N\A'; + $t['difference'] = file_get_contents($base.'diff') + or $t['difference'] = 'N\A'; + } + else // status == 'PASS' + { + $t['status'] = 'pass'; + $t['file'] = $test['file']; + } + $xmlarray['tests'][] = $t; + + // This loop writes the content for a failed test + if(strtolower($status) == 'fail') + { + + if ($old_dir != $dir) + { + $old_dir = $dir; + $write .= "<tr><td colspan='2' align='center'><b>$dir</b></td></tr>\n"; + } + + $write .= "<tr><td><a href='viewer.php?version=$version&func=tests&file=$hash'>$file</a></td><td>$title</td></tr>\n"; + + $additional = + "<h2>Script</h2><pre>\n" . highlight_file($base.'php', true). + "\n</pre><h2>Expected</h2><pre>\n" . htmlspecialchars(file_get_contents($base.'exp')). + "\n</pre><h2>Output</h2><pre>\n" .htmlspecialchars(str_replace($phpdir,'',file_get_contents($base.'out'))). + "\n</pre><h2>Diff</h2><pre>\n".htmlspecialchars(str_replace($phpdir,'',file_get_contents($base.'diff')))."\n</pre>"; + + // now create the test's page + file_put_contents("$outdir/$hash.inc", + //html_header("Test Failure: $file"). + '<?php $filename="'.htmlspecialchars(basename($file)).'"; ?>'. + $additional. + html_footer() + ); + } +} + +if (count($failed)) + $write .= "</table>\n"; + +$write .= html_footer(); + +file_put_contents("$outdir/tests.inc", $write); +?> http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/valgrind.php?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/cron/valgrind.php diff -u php-gcov-web/cron/valgrind.php:1.1.2.1 php-gcov-web/cron/valgrind.php:1.1.2.2 --- php-gcov-web/cron/valgrind.php:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/cron/valgrind.php Tue Aug 8 18:03:04 2006 @@ -1,84 +1,193 @@ -<?php - -// stolen from cron.php -if ($argc != 4) die("only 3 arguments: [tmp] [out] [phpsrc]\n\n"); - -$tmpdir = $argv[1]; -$outdir = $argv[2]; -$phpdir = $argv[3]; -$workdir = dirname(__FILE__); - -require $workdir.'/template.php'; -// ----------------- - -$version = basename($phpdir, __FILE__); // todo: make this dynamic or based on the tags instead - -$data = file_get_contents("$tmpdir/php_test_valgrind.log"); - -//$write = html_header('Valgrind Reports'); - -$test_regex = '/Number of tests :\s*\d+\s+\d+\n'. - 'Tests skipped :\s*\d+\s*\(\s*\d+\.\d+%\) --------\n'. - 'Tests warned :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)\n'. - 'Tests failed :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)\n'. - 'Tests passed :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)/'; - -preg_match($test_regex, $data, $m); - -file_put_contents("$tmpdir/php_valgrind_summary.txt", $m[0]); - -//file_put_contents("$tmpdir/valgrind_summary.inc", $m[0]); - -preg_match_all('/FAIL (?P<title>.+) \[(?P<file>[^\]]+)\]/', $data, $failed, PREG_SET_ORDER); - -$old_dir = ''; - -if (count($failed) == 0) { - $write .= "<p>Congratulations! Currently there are no test failures!</p>\n"; -} else { - $write .= <<< HTML -<table border="1"> - <tr> - <td>File</td> - <td>Name</td> - </tr> -HTML; -} - -foreach ($failed as $test) { - - $file = basename($test['file']); - $title = $test['title']; - $dir = dirname($test['file']); - $hash = 'v' . md5($test['file']); - - if ($old_dir != $dir) { - $old_dir = $dir; - $write .= "<tr><td colspan='2' align='center'><b>$dir</b></td></tr>\n"; - } - - $write .= "<tr><td><a href='viewer.php?version=$version&func=valgrind&file=$hash'>$file</a></td><td>$title</td></tr>\n"; - - // todo: added str_replace to individual report output - - $base = "$phpdir/".substr($test['file'],0,-4); - $additional = - "<h2>Script</h2><pre>\n" . highlight_file($base.'php', true). - "\n</pre><h2>Report</h2><pre>\n".htmlentities(str_replace($phpdir,'',file_get_contents($base.'out')))."\n</pre>"; - - // now create the test's page - file_put_contents("$outdir/$hash.inc", - //html_header("Valgrind Report: $file"). - '<?php $filename="'.basename($file).'"; ?>' - .$additional. - html_footer() - ); -} - -if (count($failed)) - $write .= "</table>\n"; - -$write .= html_footer(); - -file_put_contents("$outdir/valgrind.inc", $write); -?> +<?php + +// stolen from cron.php +if ($argc != 4) die("only 3 arguments: [tmp] [out] [phpsrc]\n\n"); + +$tmpdir = $argv[1]; +$outdir = $argv[2]; +$phpdir = $argv[3]; +$workdir = dirname(__FILE__); + +$unicode = false; // assume unicode is disabled + +$write = ''; + +$valgrind = array(); + +require $workdir.'/template.php'; +// ----------------- + + // todo: make this dynamic or based on the tags instead +$version = basename($phpdir, __FILE__); + +// fix filename after the others are fixed +$data = file_get_contents("$tmpdir/php_test_valgrind.log"); + +//$write = html_header('Valgrind Reports'); + +// Check if unicode testing is enabled (is this sufficient for PHP > 6?) +if(preg_match('/UNICODE[ ]*:[ ]*ON[ ]?/', $data)) +{ + // Regular expression to match leaks if unicode is enabled + $leak_re = '/(?P<teststatus>FAIL|LEAK):(?P<testtype>[a-z|A-Z]) (?P<title>.+) \[(?P<file>[^\]]+)\]/'; + $unicode = true; + echo 'unicode: on'."\n"; +} +else +{ + // /LEAK (?P<title>.+) \[(?P<file>[^\]]+)\]/ + $leak_re = '/(?P<teststatus>FAIL|LEAK) (?P<title>.+) \[(?P<file>[^\]]+)\]/'; + echo 'unicode: off'."\n"; +} + +$test_regex = '/Number of tests :\s*\d+\s+\d+\n'. + 'Tests skipped :\s*\d+\s*\(\s*\d+\.\d+%\) --------\n'. + 'Tests warned :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)\n'. + 'Tests failed :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)\n'. + 'Tests passed :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)/'; + +preg_match($test_regex, $data, $m); + +file_put_contents("$tmpdir/php_valgrind_summary.txt", $m[0]); + +//file_put_contents("$tmpdir/valgrind_summary.inc", $m[0]); + + +// todo: is this FAIL or LEAK? (was fail previously) +//preg_match_all('/LEAK:(\s) (?P<title>.+) \[(?P<file>[^\]]+)\]/', $data, $failed, PREG_SET_ORDER); + +// todo: verify PHP 6 is used and that unicode is specified + +preg_match_all($leak_re, $data, $leaks, PREG_SET_ORDER); + +//print_r($leaks); + +$old_dir = ''; + +if (count($leaks) == 0) { + $write .= "<p>Congratulations! Currently there are no test failures!</p>\n"; +} else { + $totalnumleaks = count($leaks); + + $write .= '<table border="1">'."\n"; +/* + $write .= <<< HTML +<table border="1"> + <tr> + <td>File</td> + <td>Test Type</td> + <td>Name</td> + </tr> +HTML; + +*/ +} + + +foreach ($leaks as $test) +{ + + $base = "$phpdir/".substr($test['file'],0,-4); + + $file = basename($test['file']); + + $report_file = ''; // Used internally to determine unicode or native filename + + $t = array(); + + // If test is a leak perform all operations + if(strtolower($test['teststatus']) == 'leak') + { + // If test mode is not unicode it is native + if((isset($test['testtype'])) && (strtolower($test['testtype']) == 'u')) + { + $testtype = 'Unicode'; + $report_file = $base.'u.mem'; + } + else + { + $testtype = 'Native'; + $report_file = $base.'mem'; + } + + $title = $test['title']; + $dir = dirname($test['file']); + $hash = 'v' . md5($test['file']); + + if ($old_dir != $dir) + { + $old_dir = $dir; + // todo: track if there are 2 or 3 columns + $write .= '<tr>'."\n".'<td colspan="3" align="center">' + ."<b>$dir</b></td>\n</tr>\n"; + + $write .= "<tr>\n<td>File</td>\n<td>Test Type</td>\n<td>Name</td>\n</tr>\n"; + } + + // todo: if testtype is not set don't output it + $write .= "<tr><td><a href='viewer.php?version=$version&func=valgrind&file=$hash'>$file</a></td><td>$testtype</td><td>$title</td></tr>\n"; + + // todo: added str_replace to individual report output + + $base = "$phpdir/".substr($test['file'],0,-4); + + $script = highlight_file($base.'php', true) + or $script = 'Script contents were not available.'; + + $report = file_get_contents($report_file); + + if($report === false) + $report = 'Memory leak file contents were not available.'; + else + $report = str_replace($phpdir,'',$report); + + $additional = + "<h2>Script</h2><pre>\n" .$script. + "\n</pre><h2>Report</h2><pre>\n".$report."\n</pre>"; + // .out replaced by .mem + // now create the test's page + file_put_contents("$outdir/$hash.inc", + //html_header("Valgrind Report: $file"). + '<?php $filename="'.basename($file).'"; ?>' + .$additional. + html_footer() + ); + + $t['file'] = $test['file']; + $t['teststatus'] = $test['teststatus']; + $t['script'] = $script; + $t['report'] = $report; + } + else // For valgrind failure we only know file and status + { + // todo: fix this if more information can be gathered + $t['file'] = $test['file']; + $t['teststatus'] = $test['teststatus']; + } + + $valgrind[] = $t; + +} + +if (count($leaks)) + $write .= "</table>\n"; + +$write .= html_footer(); + +file_put_contents("$outdir/valgrind.inc", $write); + +// Serialize testing + +// This prevents writing the file if there is no content +if(count($valgrind) > 0) +{ + ob_start(); + + echo serialize($valgrind); + + $contents = ob_get_clean(); + + file_put_contents("$outdir/valgrind.txt", $contents); +} + +?> http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/graph.php?view=markup&rev=1.1 Index: php-gcov-web/cron/graph.php +++ php-gcov-web/cron/graph.php http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/mailer.php?view=markup&rev=1.1 Index: php-gcov-web/cron/mailer.php +++ php-gcov-web/cron/mailer.php
http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/build_time.php?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/cron/build_time.php diff -u php-gcov-web/cron/build_time.php:1.1.2.1 php-gcov-web/cron/build_time.php:1.1.2.2 --- php-gcov-web/cron/build_time.php:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/cron/build_time.php Tue Aug 8 18:03:03 2006 @@ -1,22 +1,20 @@ -<?php - -// script to get the build time of the php version - -$filename = '../tmp/PHP_5_2/php_test_valgrind.log'; -$fh = fopen($filename, 'r'); -$content = fread($fh, filesize($filename)); -fclose($fh); - -//$buildtime = preg_match('/Time taken[ ]? :[ ]?(\d*)[ ]?seconds/', $content); - -preg_match('/Time taken[ ]*:[ ]* ([0-9]+) seconds/', $content, $matches); - -//echo $buildtime.' seconds'."\n"; - -print_r($matches); -echo "\n"; - -if(is_array($matches)) -{ - echo $matches[1]."\n"; -} +<?php + +// script to get the build time of the php version + +$content = file_get_contents($tmpdir.DIRECTORY_SEPARATOR.'php_test.log'); + +//$buildtime = preg_match('/Time taken[ ]? :[ ]?(\d*)[ ]?seconds/', $content); + +preg_match('/Time taken[ ]*:[ ]* ([0-9]+) seconds/', $content, $matches); + +//echo $buildtime.' seconds'."\n"; + +//print_r($matches); +//echo "\n"; + +if(is_array($matches)) +{ + //echo $matches[1]."\n"; + $build_time = $matches[1]; +} http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/compile_results.php?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/cron/compile_results.php diff -u php-gcov-web/cron/compile_results.php:1.1.2.1 php-gcov-web/cron/compile_results.php:1.1.2.2 --- php-gcov-web/cron/compile_results.php:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/cron/compile_results.php Tue Aug 8 18:03:03 2006 @@ -1,147 +1,169 @@ -<?php - -// todo: make alphabetical sorting on compile_errors.php - -// todo: START adding for specific compile_errors.php generation only -//$phpdir="/home/quadra23/temp/PHP_5_2"; -//$tmpdir="/home/quadra23/temp/tmp"; -////$outdir="/var/www/PHP_5_2err"; -//$outdir="/var/www/gcov/PHP_5_2/"; -//VALGRIND=valgrind -// todo: END adding for specific compile_errors.php generation only - -//$phpsrc .= '/'; - -if(!defined('CRON_PHP')) -{ - echo 'Sorry this file must be called by a cron script'."\n"; - exit; -} - -$result['numerrors'] = 0; -$result['numwarnings'] = 0; -$result['totalnumerrors'] = 0; -$result['totalnumwarnings'] = 0; - -require_once 'template.php'; - -$data = file_get_contents("$tmpdir/php_build.log"); - - -// REGEX to fetch the gcc errors/warnings. tuned for gcc 3.4.x and 4.0.x -$gcc_regex = '/^(.+): In function [`\'](\w+)\':\s+'. - '\1:(\d+):\s+(.+)'. - str_repeat('(?:\s+\1:(\d+):\s+(.+))?', 99). // nick hack to capture up to 100 errors in the same function - '/m'; - -preg_match_all($gcc_regex, $data, $data, PREG_SET_ORDER); - -$stats = array(); - -foreach ($data as $error) -{ - - $file = $error[1]; - - // Remove the phpdir portion from the file path if it occurs - if(substr($file, 0, strlen($phpdir)) == $phpdir) - { - $filepath = substr($file, strlen($phpdir)); - } - else // todo; fix the need for the additional / in front - { - $filepath = '/'.$file; - $file = '/'.$file; - } - - $function = $error[2]; - - $write = ''; - - for ($i = 3; isset($error[$i]); $i += 2) { - $line = $error[$i]; - $msg = $error[$i+1]; - - $write .= <<< HTML - <tr> - <td>$function</td> - <td><a href="http://lxr.php.net/source/php-src{$filepath}#{$line}">$line</a></td> - <td>$msg</td> - </tr> -HTML; - if(substr($msg, 0, strlen('error')) == 'error') - { - $result['numerrors']++; - $result['totalnumerrors']++; - } - elseif(substr($msg, 0, strlen('warning')) == 'warning') - { - $result['numwarnings']++; - $result['totalnumwarnings']++; - } - else - { - } - - } - - @$stats[$file][0] = $result['numerrors']; // number of file errros - @$stats[$file][1] = $result['numwarnings']; // number of file warnings - //@$stats[$file][0] += ($i-3)/2; // number of errors in this file - @$stats[$file][2] .= $write; // data to write - -} - -// now write the stuff -$fp = fopen("$outdir/compile_results.inc", 'w'); -//fwrite($fp, html_header('Compile errors/warnings')); - -fwrite($fp, "<p>Number of Errors: {$result['totalnumerrors']}<br />Number of Warnings: {$result['numwarnings']}<br />Total: ".($result['totalnumerrors']+$result['numwarnings'])."</p>"); - -fwrite($fp, '<table border="1"><tr><td>File</td><td>Number of errors</td><td>Number of warnings</td></tr>'); - -$phpdir_len = strlen($phpdir)+1; -$total = 0; - -foreach ($stats as $file => $data) -{ - - $hash = md5($file); // files have consistent start character - - //$short_file = substr($file, $phpdir_len); - - // Compare first portion of file name to phpsrc - if(substr($file, 0, strlen($phpdir)) == $phpdir) - { - $short_file = substr($file, strlen($phpdir)); - } - else // If phpsrc does not occur, display full file name (todo: verify) - { - $short_file = $file; - } - - $total += $data[0]; - fwrite($fp, "<tr><td><a href='viewer.php?version=$version&func=compile_results&file=$hash'>$short_file</a></td><td>$data[0]</td><td>$data[1]</td></tr>\n"); - - $write = <<< HTML -<table border="1"> - <tr> - <td>Function</td> - <td>Line</td> - <td>Message</td> - </tr> -HTML; - - file_put_contents("$outdir/$hash.inc", - //html_header('Messages specific to "'. basename($file) . '"'). - //' $filename="'.$basename($file).'"; '. - '<?php $filename="'.basename($file).'"; ?>'. - $write. - $data[2]. - '</table>'. - html_footer()); -} - -fwrite($fp, '</table>'.html_footer()); -fclose($fp); -?> +<?php + +// todo: make alphabetical sorting on compile_errors.php + +// todo: START adding for specific compile_errors.php generation only +//$phpdir="/home/quadra23/temp/PHP_5_2"; +//$tmpdir="/home/quadra23/temp/tmp"; +////$outdir="/var/www/PHP_5_2err"; +//$outdir="/var/www/gcov/PHP_5_2/"; +//VALGRIND=valgrind +// todo: END adding for specific compile_errors.php generation only + +//$phpsrc .= '/'; + +if(!defined('CRON_PHP')) +{ + echo 'Sorry this file must be called by a cron script'."\n"; + exit; +} + +$totalnumerrors = 0; +$totalnumwarnings = 0; + +require_once 'template.php'; + +$data = file_get_contents("$tmpdir/php_build.log"); + + +// REGEX to fetch the gcc errors/warnings. tuned for gcc 3.4.x and 4.0.x +/* +$gcc_regex = '/^(.+): In function [`\'](\w+)\':\s+'. + '\1:(\d+):\s+(.+)'. + str_repeat('(?:\s+\1:(\d+):\s+(.+))?', 99). // nick hack to capture up to 100 errors in the same function + '/m'; +*/ + +$gcc_regex = '/^(.+): In function [`\'](\w+)\':\s+'. + '\1:(\d+): (error|warning):\s+(.+)'. + str_repeat('(?:\s+\1:(\d+): (error|warning):\s+(.+))?', 99). + '/m'; + +preg_match_all($gcc_regex, $data, $data, PREG_SET_ORDER); + +$stats = array(); + +foreach ($data as $error) +{ + + $file = $error[1]; + + // Remove the phpdir portion from the file path if it occurs + if(substr($file, 0, strlen($phpdir)) == $phpdir) + { + $filepath = substr($file, strlen($phpdir)); + } + else // todo; fix the need for the additional / in front + { + //$filepath = '/'.$file; + $file = '/'.$file; + } + + // If stats are not previously set for this file, initialize it to the default values + if(!isset($stats[$file])) + { + @$stats[$file][0] = 0; // number of file errros + @$stats[$file][1] = 0; // number of file warnings + @$stats[$file][2] = ''; // data to write + } + + + + $function = $error[2]; + + $write = ''; + + // increment +3 because of the addition of type + for ($i = 3; isset($error[$i]); $i += 3) { + $line = $error[$i]; + $type = $error[$i+1]; // added + $msg = $error[$i+2]; + + $write .= <<< HTML + <tr> + <td>$function</td> + <td><a href="http://lxr.php.net/source/php-src{$filepath}#{$line}">$line</a></td> + <td>$type: $msg</td> + </tr> +HTML; + if($type == 'error') + { + @$stats[$file][0] += 1; // number of file errros + $totalnumerrors++; + } + elseif($type == 'warning') + { + @$stats[$file][1] += 1; // number of file warnings + $totalnumwarnings++; + } + else + { + } + + $t = array(); + $t['file'] = $filepath; + $t['function'] = $function; + $t['line'] = $line; + $t['type'] = $type; + $t['msg'] = $msg; + + $xmlarray['compile_results'][] = $t; + } + + @$stats[$file][2] .= $write; // data to write + +} + +// now write the stuff +$fp = fopen("$outdir/compile_results.inc", 'w'); +//fwrite($fp, html_header('Compile errors/warnings')); + +fwrite($fp, "<p>Number of Errors: {$totalnumerrors}<br />Number of Warnings: {$totalnumwarnings}<br />Total: ".($totalnumerrors+$totalnumwarnings)."</p>"); + +fwrite($fp, '<table border="1"><tr><td>File</td><td>Number of errors</td><td>Number of warnings</td></tr>'); + +$phpdir_len = strlen($phpdir)+1; +$total = 0; + +foreach ($stats as $file => $data) +{ + + $hash = md5($file); // files have consistent start character + + //$short_file = substr($file, $phpdir_len); + + // Compare first portion of file name to phpsrc + if(substr($file, 0, strlen($phpdir)) == $phpdir) + { + $short_file = substr($file, strlen($phpdir)); + } + else // If phpsrc does not occur, display full file name (todo: verify) + { + $short_file = $file; + } + + $total += $data[0]; + fwrite($fp, "<tr><td><a href='viewer.php?version=$version&func=compile_results&file=$hash'>$short_file</a></td><td>$data[0]</td><td>$data[1]</td></tr>\n"); + + $write = <<< HTML +<table border="1"> + <tr> + <td>Function</td> + <td>Line</td> + <td>Message</td> + </tr> +HTML; + + file_put_contents("$outdir/$hash.inc", + //html_header('Messages specific to "'. basename($file) . '"'). + //' $filename="'.$basename($file).'"; '. + '<?php $filename="'.basename($file).'"; ?>'. + $write. + $data[2]. + '</table>'. + html_footer()); +} + +fwrite($fp, '</table>'.html_footer()); +fclose($fp); +?> http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/cron.php?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/cron/cron.php diff -u php-gcov-web/cron/cron.php:1.1.2.1 php-gcov-web/cron/cron.php:1.1.2.2 --- php-gcov-web/cron/cron.php:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/cron/cron.php Tue Aug 8 18:03:03 2006 @@ -1,43 +1,233 @@ -<?php - -if ($argc != 5) die("only 4 arguments: [tmp] [out] [phpsrc] [makestatus]\n\n"); - -define('CRON_PHP',true); - -$tmpdir = $argv[1]; -$outdir = $argv[2]; -$phpdir = $argv[3]; -$makestatus = $argv[4]; // make status from bash script (fail or pass) -$workdir = dirname(__FILE__); - -$makedata = ''; - -// Set up variables that apply to all scripts -$version = basename($phpdir, __FILE__); // todo: make this dynamic or based on the tags instead - -require $workdir.'/template.php'; - -//process stuff -require $workdir.'/compile_results.php'; // make compile errors/warnings file - -// If the make passes -if(trim($makestatus) == 'pass') -{ - require $workdir.'/tests.php'; - #require $workdir.'/run_tests.php'; - require $workdir.'/system.php'; - - $makedata = 'pass'; -} -else -{ - $makedata = 'fail'; -} - -$fh = fopen($outdir.DIRECTORY_SEPARATOR.'last_make_status.inc', 'w'); -#todo: if write fails we need to do something about it -fwrite($fh, $makedata); -fclose($fh); - -//require $workdir.'/make-index.php'; // make the index file -?> +<?php + +if ($argc != 6) die("cron.php requires 5 arguments: [tmp] [out] [phpsrc] [makestatus] [phpversion]\n\n"); + +define('CRON_PHP',true); + +$tmpdir = $argv[1]; +$outdir = $argv[2]; +$phpdir = $argv[3]; +$makestatus = $argv[4]; // make status from bash script (fail or pass) +$phpver = $argv[5]; +$workdir = dirname(__FILE__); + +// Initialize core variables +$build_time = -1; // Total time required for build (build_time.php) + +$totalnumerrors = 0; // Total number of errors (compile_errors.php) +$totalnumwarnings = 0; // Total number of warnings (compile_errors.php) + +$totalnumleaks = 0; // Total number of memory leaks (valgrind.php) +$totalnumfailures = 0; // Total number of test failures (tests.php) + +$linkerinfo = 'N/A'; // Information regarding linker (system.php) +$compilerinfo = 'N/A'; // Information regarding compiler (system.php) +$osinfo = 'N/A'; // Information regarding operating system (system.php) + +$version_id = 0; + +$xmlarray = array(); + +// Set up variables that apply to all scripts +$version = basename($phpdir, __FILE__); // todo: make this dynamic or based on the tags instead + +// Load main configuration including database connection +require $workdir.'/config.php'; + +// Load templates +require $workdir.'/template.php'; + +//process stuff +require $workdir.'/compile_results.php'; // make compile errors/warnings file + +require $workdir.'/system.php'; + +// Get version ID for current version + +try +{ + $sql = 'SELECT version_id FROM versions WHERE version_name = ?'; + $stmt = $mysqlconn->prepare($sql); + $stmt->execute(array($phpver)); + $version_id = $stmt->fetchColumn(); +} +catch(PDOException $e) +{ + // if error occurs log, output and ensure the version_id is not legimate + $version_id = 0; +} + +if($version_id > 0) +{ + // Add new build to the build tables + $build_date = date('Y-m-d'); + $build_datetime = date('Y-m-d H-i-s'); + $stmt = null; + + $sql = 'INSERT INTO builds (version_id, build_date, build_datetime, build_numerrors, build_numwarnings, build_numfailures, build_numleaks, build_os_info, build_compiler_info, build_linker_info) '. +'VALUES (:version_id, :build_date, :build_datetime, :build_numerrors, :build_numwarnings, :build_numfailures, :build_numleaks, :build_os_info, :build_compiler_info, :build_linker_info) '; + $stmt = $mysqlconn->prepare($sql); + + $stmt->bindParam(':version_id', $version_id); + $stmt->bindParam(':build_date', $build_date); + $stmt->bindParam(':build_datetime', $build_datetime); + $stmt->bindParam(':build_numerrors', $totalnumerrors); + $stmt->bindParam(':build_numwarnings', $totalnumwarnings); + $stmt->bindParam(':build_numfailures', $totalnumfailures); + $stmt->bindParam(':build_numleaks', $totalnumleaks); + $stmt->bindParam(':build_os_info', $osinfo); + $stmt->bindParam(':build_compiler_info', $compilerinfo); + $stmt->bindParam(':build_linker_info', $linkerinfo); + $stmt->execute(); + $stmt = null; + + if($makestatus == 'pass') + { + require $workdir.'/tests.php'; + require $workdir.'/build_time.php'; + + // todo: if a Sunday, call graphs otherwise skip + if(date('D') == 'Sun') + { + require $workdir.'/graph.php'; + } + + // Do SQL updates for the specific PHP version + + $sql = 'UPDATE versions SET version_last_build_time = ?, version_last_attempted_build_date = ?, version_last_successful_build_date = ? WHERE version_id = ?'; + $stmt_arr = array($build_time, $build_datetime, $build_datetime, $version_id); + } + else + { + // If build fails only update the last attempted build date for the version + $sql = 'UPDATE versions SET version_last_attempted_build_date = ? WHERE version_id = ?'; + $stmt_arr = array($build_datetime, $version_id); + } + $stmt = $mysqlconn->prepare($sql); + $stmt->execute($stmt_arr); + + // Update the existing version information + echo 'Build Time: '.$build_time."\n"; + + +} +else +{ + // we may not want to log this as the PHP version may have been made up +} + +file_put_contents($outdir.DIRECTORY_SEPARATOR.'last_make_status.inc', $makestatus); +#todo: if write fails we need to do something about it + +// todo: start of XML output + +//$xml_array = array('php_build.log','php_test.log'); + + +// Parse valgrind output file +$valgrind_serialized = file_get_contents("$outdir/valgrind.txt") or $valgrind_serialized = null; + +if(!is_null($valgrind_serialized)) +{ + //$xml_array['valgrind'] = array(); + $xmlarray['valgrind'] = unserialize($valgrind_serialized); + + //$valgrind = unserialize($valgrind_serialized); + +} +else +{ + echo 'no valgrind to read'."\n"; +} + +$xml_out = '<?xml version="1.0" encoding="UTF-8"?>'."\n" + .'<build>'."\n" + .'<buildinfo>'."\n" + .'<username>johndoe'.'</username>'."\n" + .'<version>'.$phpver.'</version>'."\n" + .'<buildstatus>'.$makestatus.'</buildstatus>'."\n" + .'<compiler>'.$compilerinfo.'</compiler>'."\n" + .'<linker>'.$linkerinfo.'</linker>'."\n" + .'<os>'.$osinfo.'</os>'."\n" + .'</buildinfo>'."\n" + .'<builddata>'."\n"; + +$xml_search_for = array($phpdir); +$xml_replace_with = array(''); + + +if(isset($xmlarray['compile_results'])) +{ + $xml_out .= '<compile_results>'."\n"; + //$xml_out .= '<files>'."\n"; + + foreach($xmlarray['compile_results'] as $res) + { + $xml_out .= '<message file="'.$res['file'].'" ' + .'function="'.$res['function'].'" ' + .'line="'.$res['line'].'" ' + .'type="'.$res['type'].'">' + .$res['msg'].'</message>'."\n"; + } + + $xml_out .= '</compile_results>'."\n"; +} // End check for compile results + + +if(isset($xmlarray['tests'])) +{ + $xml_out .= '<tests>'."\n"; + + foreach($xmlarray['tests'] as $test) + { + $xml_out .= '<test status="'.$test['status'].'" ' + .'file="'.$test['file'].'">'; + + if(strtolower($test['status']) == 'fail') + { + $xml_out .= "\n" + .'<expected>' + .htmlspecialchars($test['expected']) + .'</expected>'."\n" + .'<output>' + .htmlspecialchars($test['output']) + .'</output>'."\n" + .'<difference>'."\n" + .htmlspecialchars($test['difference']) + .'</difference>'; + } + else + { + } + $xml_out .= '</test>'."\n"; + } + + $xml_out .= '</tests>'."\n"; + +} // End check for tests + + +$xml_out .= '</builddata>'."\n" + .'</build>'."\n"; + +if(file_put_contents($tmpdir.'/build.new.xml', $xml_out)) +{ + echo 'XML file written'."\n"; +} + + +file_put_contents($outdir.'/build.new.xml', $xml_out); + + + +ob_start(); + +print_r($xmlarray); + +$contents = ob_get_clean(); + +file_put_contents($outdir.'/build.new.txt', $contents); + + +//require $workdir.'/make-index.php'; // make the index file +?> http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/cron.sh?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/cron/cron.sh diff -u php-gcov-web/cron/cron.sh:1.1.2.1 php-gcov-web/cron/cron.sh:1.1.2.2 --- php-gcov-web/cron/cron.sh:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/cron/cron.sh Tue Aug 8 18:03:03 2006 @@ -1,74 +1,84 @@ -#!/bin/sh - -LC_ALL=C -export LC_ALL - -VALGRIND=valgrind - -# file that contains the PHP version tags -filename=tags.inc - -# the maximum number of elements for a single php version -php_max_version_elements=4 - -WORKDIR=`dirname "$0"` -echo "$WORKDIR" | grep -q '^/' || WORKDIR="`pwd`/$WORKDIR" # get absolute path - -. ${WORKDIR}/config.sh - -# set up a one dimensional array to store all php version information -declare -a php_version_array -php_version_array=( `cat "$filename"` ) - -# Calculate how many elements there are in a php version array -php_version_totalcount=${#php_version_array[@]} - -# loop through each PHP version and perform the required builds -for (( i = 0 ; i < ${php_version_totalcount} ; i += ${php_max_version_elements} )) -do - #set up the php version information - echo ${php_version_array[i]} - PHPVERSION=${php_version_array[i]} - echo ${php_version_array[i+1]} - PHPSRC=${php_version_array[i+1]} - echo ${php_version_array[i+2]} - TMPDIR=${php_version_array[i+2]} - echo ${php_version_array[i+3]} - OUTDIR=${php_version_array[i+3]} - - # run the loop for each php version - cd ${PHPSRC} - ./cvsclean - # cvs -q up - ./buildconf - ./config.nice - - #test for success of the make operation - #if ( make > ${OUTDIR}/make_log.inc 2> ${TMPDIR}/php_build.log ); then - if ( make > /dev/null 2> ${TMPDIR}/php_build.log ); then - #echo pass > ${OUTDIR}/last_make_status.inc - - MAKESTATUS=pass - - export NO_INTERACTION=1 - export TEST_PHP_VALGRIND=${VALGRIND} - make test > ${TMPDIR}/php_test_valgrind.log - php ${WORKDIR}/valgrind.php ${TMPDIR} ${OUTDIR} ${PHPSRC} - - #rm .php_cov_info.ltpdata - #rm -r "*.gcov" - make lcov --warn-undefined-variables - make lcov-html --warn-undefined-variables - rm -fr ${OUTDIR}/lcov_html - mv lcov_html ${OUTDIR} - - echo make successful - else - #if make failed - - #echo fail > ${OUTDIR}/last_make_status.inc - MAKESTATUS=fail - echo make failed - fi - php ${WORKDIR}/cron.php ${TMPDIR} ${OUTDIR} ${PHPSRC} ${MAKESTATUS} -done +#!/bin/sh + +LC_ALL=C +export LC_ALL + +VALGRIND=valgrind + +# file that contains the PHP version tags +filename=tags.inc + +# the maximum number of elements for a single php version +php_max_version_elements=4 + +WORKDIR=`dirname "$0"` +echo "$WORKDIR" | grep -q '^/' || WORKDIR="`pwd`/$WORKDIR" # get absolute path + +. ${WORKDIR}/config.sh + +# set up a one dimensional array to store all php version information +declare -a php_version_array +php_version_array=( `cat "$filename"` ) + +# Calculate how many elements there are in a php version array +php_version_totalcount=${#php_version_array[@]} + +# loop through each PHP version and perform the required builds +for (( i = 0 ; i < ${php_version_totalcount} ; i += ${php_max_version_elements} )) +do + #set up the php version information + echo ${php_version_array[i]} + PHPVERSION=${php_version_array[i]} + echo ${php_version_array[i+1]} + PHPSRC=${php_version_array[i+1]} + echo ${php_version_array[i+2]} + TMPDIR=${php_version_array[i+2]} + echo ${php_version_array[i+3]} + OUTDIR=${php_version_array[i+3]} + + # run the loop for each php version + cd ${PHPSRC} + ./cvsclean + cvs -q up + ./buildconf + ./config.nice + + #test for success of the make operation + if ( make > /dev/null 2> ${TMPDIR}/php_build.log ); then + #echo pass > ${OUTDIR}/last_make_status.inc + + MAKESTATUS=pass + + # note: start this enables valgrind + export NO_INTERACTION=1 + export TEST_PHP_VALGRIND=${VALGRIND} + make test > ${TMPDIR}/php_test_valgrind.log + php ${WORKDIR}/valgrind.php ${TMPDIR} ${OUTDIR} ${PHPSRC} + # note: end this enables valgrind + + #rm .php_cov_info.ltpdata + #rm -r "*.gcov" + + make lcov --warn-undefined-variables + make lcov-html --warn-undefined-variables + #rm -fr ${OUTDIR}/lcov_html + mv lcov_html ${OUTDIR} + + export NO_INTERACTION=1 + #export TEST_PHP_VALGRIND= + + # note: start this enables run-tests + export TEST_PHP_EXECUTABLE="./sapi/cli/php" + ./sapi/cli/php run-tests.php -U -m > ${TMPDIR}/php_test.log + # note: end this enables run-tests + + echo make successful + else + #if make failed + + MAKESTATUS=fail + + echo make failed + fi + php ${WORKDIR}/cron.php ${TMPDIR} ${OUTDIR} ${PHPSRC} ${MAKESTATUS} ${PHPVERSION} +done http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/system.php?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/cron/system.php diff -u php-gcov-web/cron/system.php:1.1.2.1 php-gcov-web/cron/system.php:1.1.2.2 --- php-gcov-web/cron/system.php:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/cron/system.php Tue Aug 8 18:03:04 2006 @@ -1,23 +1,26 @@ -<?php - -$write = html_header('System Info'); - -// configure -$write .= "<h2>Configure used:</h2>\n"; -$config = file("$phpdir/config.nice"); -$config = array_slice($config, 4); //remove inital comments -$write .= "<pre>". implode('', $config) ."</pre>\n"; - -// compiler -$write .= "<h2>Compiler used</h2>\n"; -$compiler = explode("\n", `gcc --version`); -$write .= '<p>' . $compiler[0] . "</p>\n"; - -// SO -$write .= "<h2>Operating System:</h2>\n"; -$write .= '<p>' . `uname -srmi` . "</p>\n"; - -$write .= html_footer(); - -file_put_contents("$outdir/system.inc", $write); -?> +<?php + +$write = html_header('System Info'); + +// configure (linker?) +$write .= "<h2>Configure used:</h2>\n"; +$config = file("$phpdir/config.nice"); +$config = array_slice($config, 4); //remove inital comments +$linkerinfo = implode('', $config); +$write .= "<pre>".$linkerinfo."</pre>\n"; + +// compiler +$write .= "<h2>Compiler used</h2>\n"; +$compiler = explode("\n", `gcc --version`); +$compilerinfo = $compiler[0]; +$write .= '<p>'.$compilerinfo. "</p>\n"; + +// OS +$write .= "<h2>Operating System:</h2>\n"; +$osinfo = `uname -srmi`; +$write .= '<p>'.$osinfo."</p>\n"; + +$write .= html_footer(); + +file_put_contents("$outdir/system.inc", $write); +?> http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/tags.inc?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/cron/tags.inc diff -u php-gcov-web/cron/tags.inc:1.1.2.1 php-gcov-web/cron/tags.inc:1.1.2.2 --- php-gcov-web/cron/tags.inc:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/cron/tags.inc Tue Aug 8 18:03:04 2006 @@ -1,4 +1,5 @@ PHP_4_4 /home/quadra23/temp/PHP_4_4 /home/quadra23/temp/tmp/PHP_4_4 /var/local/gcov/www/PHP_4_4 PHP_5_1 /home/quadra23/temp/PHP_5_1 /home/quadra23/temp/tmp/PHP_5_1 /var/local/gcov/www/PHP_5_1 PHP_5_2 /home/quadra23/temp/PHP_5_2 /home/quadra23/temp/tmp/PHP_5_2 /var/local/gcov/www/PHP_5_2 +PHP_5_E /home/quadra23/temp/PHP_5_E /home/quadra23/temp/tmp/PHP_5_E /var/local/gcov/www/PHP_5_E PHP_HEAD /home/quadra23/temp/PHP_HEAD /home/quadra23/temp/tmp/PHP_HEAD /var/local/gcov/www/PHP_HEAD http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/tests.php?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/cron/tests.php diff -u php-gcov-web/cron/tests.php:1.1.2.1 php-gcov-web/cron/tests.php:1.1.2.2 --- php-gcov-web/cron/tests.php:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/cron/tests.php Tue Aug 8 18:03:04 2006 @@ -1,74 +1,106 @@ -<?php - -// Ensure the write variable is empty before inserting content -$write = ''; - -$data = file_get_contents("$tmpdir/php_test.log"); -//$write = html_header('Test Failures'); - -$test_regex = '/Number of tests :\s*\d+\s+\d+\n'. - 'Tests skipped :\s*\d+\s*\(\s*\d+\.\d+%\) --------\n'. - 'Tests warned :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)\n'. - 'Tests failed :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)\n'. - 'Tests passed :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)/'; - -preg_match($test_regex, $data, $m); -$test_summary = $m[0]; - - -preg_match_all('/FAIL (?P<title>.+) \[(?P<file>[^\]]+)\]/', $data, $failed, PREG_SET_ORDER); - -$old_dir = ''; - -if (count($failed) == 0) { - $write .= "<p>Congratulations! Currently there are no test failures!</p>\n"; -} else { - $write .= <<< HTML -<table border="1"> - <tr> - <td>File</td> - <td>Name</td> - </tr> -HTML; -} - - -foreach ($failed as $test) { - - $file = basename($test['file']); - $title = $test['title']; - $dir = dirname($test['file']); - $hash = md5($test['file']); - - if ($old_dir != $dir) { - $old_dir = $dir; - $write .= "<tr><td colspan='2' align='center'><b>$dir</b></td></tr>\n"; - } - - $write .= "<tr><td><a href='viewer.php?version=$version&func=tests&file=$hash'>$file</a></td><td>$title</td></tr>\n"; - - // todo: did str_replace of phpdir, is this a good idea? - - $base = "$phpdir/".substr($test['file'],0,-4); - $additional = - "<h2>Script</h2><pre>\n" . highlight_file($base.'php', true). - "\n</pre><h2>Expected</h2><pre>\n" . htmlentities(file_get_contents($base.'exp')). - "\n</pre><h2>Output</h2><pre>\n" .htmlentities(str_replace($phpdir,'',file_get_contents($base.'out'))). - "\n</pre><h2>Diff</h2><pre>\n".htmlentities(str_replace($phpdir,'',file_get_contents($base.'diff')))."\n</pre>"; - - // now create the test's page - file_put_contents("$outdir/$hash.inc", - //html_header("Test Failure: $file"). - '<?php $filename="'.basename($file).'"; ?>'. - $additional. - html_footer() - ); -} - -if (count($failed)) - $write .= "</table>\n"; - -$write .= html_footer(); - -file_put_contents("$outdir/tests.inc", $write); -?> +<?php + +// Ensure the write variable is empty before inserting content +$write = ''; + +$data = file_get_contents("$tmpdir/php_test.log"); +//$write = html_header('Test Failures'); + +$test_regex = '/Number of tests :\s*\d+\s+\d+\n'. + 'Tests skipped :\s*\d+\s*\(\s*\d+\.\d+%\) --------\n'. + 'Tests warned :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)\n'. + 'Tests failed :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)\n'. + 'Tests passed :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)/'; + +preg_match($test_regex, $data, $m); +$test_summary = $m[0]; + +// Grab the results according to failure or pass +preg_match_all('/(?P<status>FAIL|PASS) (?P<title>.+) \[(?P<file>[^\]]+)\]/', $data, $tests, PREG_SET_ORDER); + +//print_r($tests); + +// todo: do a count instead of a bloated get all failures +preg_match_all('/FAIL (?P<title>.+) \[(?P<file>[^\]]+)\]/', $data, $failed, PREG_SET_ORDER); + +$old_dir = ''; + +if (count($failed) < 1) { + $write .= "<p>Congratulations! Currently there are no test failures!</p>\n"; +} else { + $totalnumfailures = count($failed); + + $write .= <<< HTML +<table border="1"> + <tr> + <td>File</td> + <td>Name</td> + </tr> +HTML; +} + + +foreach ($tests as $test) { + + $file = basename($test['file']); + $status = $test['status']; + $title = $test['title']; + $dir = dirname($test['file']); + $hash = md5($test['file']); + + $base = "$phpdir/".substr($test['file'],0,-4); + + $t = array(); + if(strtolower($status) == 'fail') + { + $t['status'] = 'fail'; + $t['file'] = $test['file']; + $t['expected'] = file_get_contents($base.'exp') + or $t['expected'] = 'N\A'; + $t['output'] = file_get_contents($base.'out') + or $t['output'] = 'N\A'; + $t['difference'] = file_get_contents($base.'diff') + or $t['difference'] = 'N\A'; + } + else // status == 'PASS' + { + $t['status'] = 'pass'; + $t['file'] = $test['file']; + } + $xmlarray['tests'][] = $t; + + // This loop writes the content for a failed test + if(strtolower($status) == 'fail') + { + + if ($old_dir != $dir) + { + $old_dir = $dir; + $write .= "<tr><td colspan='2' align='center'><b>$dir</b></td></tr>\n"; + } + + $write .= "<tr><td><a href='viewer.php?version=$version&func=tests&file=$hash'>$file</a></td><td>$title</td></tr>\n"; + + $additional = + "<h2>Script</h2><pre>\n" . highlight_file($base.'php', true). + "\n</pre><h2>Expected</h2><pre>\n" . htmlspecialchars(file_get_contents($base.'exp')). + "\n</pre><h2>Output</h2><pre>\n" .htmlspecialchars(str_replace($phpdir,'',file_get_contents($base.'out'))). + "\n</pre><h2>Diff</h2><pre>\n".htmlspecialchars(str_replace($phpdir,'',file_get_contents($base.'diff')))."\n</pre>"; + + // now create the test's page + file_put_contents("$outdir/$hash.inc", + //html_header("Test Failure: $file"). + '<?php $filename="'.htmlspecialchars(basename($file)).'"; ?>'. + $additional. + html_footer() + ); + } +} + +if (count($failed)) + $write .= "</table>\n"; + +$write .= html_footer(); + +file_put_contents("$outdir/tests.inc", $write); +?> http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/valgrind.php?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/cron/valgrind.php diff -u php-gcov-web/cron/valgrind.php:1.1.2.1 php-gcov-web/cron/valgrind.php:1.1.2.2 --- php-gcov-web/cron/valgrind.php:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/cron/valgrind.php Tue Aug 8 18:03:04 2006 @@ -1,84 +1,193 @@ -<?php - -// stolen from cron.php -if ($argc != 4) die("only 3 arguments: [tmp] [out] [phpsrc]\n\n"); - -$tmpdir = $argv[1]; -$outdir = $argv[2]; -$phpdir = $argv[3]; -$workdir = dirname(__FILE__); - -require $workdir.'/template.php'; -// ----------------- - -$version = basename($phpdir, __FILE__); // todo: make this dynamic or based on the tags instead - -$data = file_get_contents("$tmpdir/php_test_valgrind.log"); - -//$write = html_header('Valgrind Reports'); - -$test_regex = '/Number of tests :\s*\d+\s+\d+\n'. - 'Tests skipped :\s*\d+\s*\(\s*\d+\.\d+%\) --------\n'. - 'Tests warned :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)\n'. - 'Tests failed :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)\n'. - 'Tests passed :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)/'; - -preg_match($test_regex, $data, $m); - -file_put_contents("$tmpdir/php_valgrind_summary.txt", $m[0]); - -//file_put_contents("$tmpdir/valgrind_summary.inc", $m[0]); - -preg_match_all('/FAIL (?P<title>.+) \[(?P<file>[^\]]+)\]/', $data, $failed, PREG_SET_ORDER); - -$old_dir = ''; - -if (count($failed) == 0) { - $write .= "<p>Congratulations! Currently there are no test failures!</p>\n"; -} else { - $write .= <<< HTML -<table border="1"> - <tr> - <td>File</td> - <td>Name</td> - </tr> -HTML; -} - -foreach ($failed as $test) { - - $file = basename($test['file']); - $title = $test['title']; - $dir = dirname($test['file']); - $hash = 'v' . md5($test['file']); - - if ($old_dir != $dir) { - $old_dir = $dir; - $write .= "<tr><td colspan='2' align='center'><b>$dir</b></td></tr>\n"; - } - - $write .= "<tr><td><a href='viewer.php?version=$version&func=valgrind&file=$hash'>$file</a></td><td>$title</td></tr>\n"; - - // todo: added str_replace to individual report output - - $base = "$phpdir/".substr($test['file'],0,-4); - $additional = - "<h2>Script</h2><pre>\n" . highlight_file($base.'php', true). - "\n</pre><h2>Report</h2><pre>\n".htmlentities(str_replace($phpdir,'',file_get_contents($base.'out')))."\n</pre>"; - - // now create the test's page - file_put_contents("$outdir/$hash.inc", - //html_header("Valgrind Report: $file"). - '<?php $filename="'.basename($file).'"; ?>' - .$additional. - html_footer() - ); -} - -if (count($failed)) - $write .= "</table>\n"; - -$write .= html_footer(); - -file_put_contents("$outdir/valgrind.inc", $write); -?> +<?php + +// stolen from cron.php +if ($argc != 4) die("only 3 arguments: [tmp] [out] [phpsrc]\n\n"); + +$tmpdir = $argv[1]; +$outdir = $argv[2]; +$phpdir = $argv[3]; +$workdir = dirname(__FILE__); + +$unicode = false; // assume unicode is disabled + +$write = ''; + +$valgrind = array(); + +require $workdir.'/template.php'; +// ----------------- + + // todo: make this dynamic or based on the tags instead +$version = basename($phpdir, __FILE__); + +// fix filename after the others are fixed +$data = file_get_contents("$tmpdir/php_test_valgrind.log"); + +//$write = html_header('Valgrind Reports'); + +// Check if unicode testing is enabled (is this sufficient for PHP > 6?) +if(preg_match('/UNICODE[ ]*:[ ]*ON[ ]?/', $data)) +{ + // Regular expression to match leaks if unicode is enabled + $leak_re = '/(?P<teststatus>FAIL|LEAK):(?P<testtype>[a-z|A-Z]) (?P<title>.+) \[(?P<file>[^\]]+)\]/'; + $unicode = true; + echo 'unicode: on'."\n"; +} +else +{ + // /LEAK (?P<title>.+) \[(?P<file>[^\]]+)\]/ + $leak_re = '/(?P<teststatus>FAIL|LEAK) (?P<title>.+) \[(?P<file>[^\]]+)\]/'; + echo 'unicode: off'."\n"; +} + +$test_regex = '/Number of tests :\s*\d+\s+\d+\n'. + 'Tests skipped :\s*\d+\s*\(\s*\d+\.\d+%\) --------\n'. + 'Tests warned :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)\n'. + 'Tests failed :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)\n'. + 'Tests passed :\s*\d+\s*\(\s*\d+\.\d+%\) \(\s*\d+\.\d+%\)/'; + +preg_match($test_regex, $data, $m); + +file_put_contents("$tmpdir/php_valgrind_summary.txt", $m[0]); + +//file_put_contents("$tmpdir/valgrind_summary.inc", $m[0]); + + +// todo: is this FAIL or LEAK? (was fail previously) +//preg_match_all('/LEAK:(\s) (?P<title>.+) \[(?P<file>[^\]]+)\]/', $data, $failed, PREG_SET_ORDER); + +// todo: verify PHP 6 is used and that unicode is specified + +preg_match_all($leak_re, $data, $leaks, PREG_SET_ORDER); + +//print_r($leaks); + +$old_dir = ''; + +if (count($leaks) == 0) { + $write .= "<p>Congratulations! Currently there are no test failures!</p>\n"; +} else { + $totalnumleaks = count($leaks); + + $write .= '<table border="1">'."\n"; +/* + $write .= <<< HTML +<table border="1"> + <tr> + <td>File</td> + <td>Test Type</td> + <td>Name</td> + </tr> +HTML; + +*/ +} + + +foreach ($leaks as $test) +{ + + $base = "$phpdir/".substr($test['file'],0,-4); + + $file = basename($test['file']); + + $report_file = ''; // Used internally to determine unicode or native filename + + $t = array(); + + // If test is a leak perform all operations + if(strtolower($test['teststatus']) == 'leak') + { + // If test mode is not unicode it is native + if((isset($test['testtype'])) && (strtolower($test['testtype']) == 'u')) + { + $testtype = 'Unicode'; + $report_file = $base.'u.mem'; + } + else + { + $testtype = 'Native'; + $report_file = $base.'mem'; + } + + $title = $test['title']; + $dir = dirname($test['file']); + $hash = 'v' . md5($test['file']); + + if ($old_dir != $dir) + { + $old_dir = $dir; + // todo: track if there are 2 or 3 columns + $write .= '<tr>'."\n".'<td colspan="3" align="center">' + ."<b>$dir</b></td>\n</tr>\n"; + + $write .= "<tr>\n<td>File</td>\n<td>Test Type</td>\n<td>Name</td>\n</tr>\n"; + } + + // todo: if testtype is not set don't output it + $write .= "<tr><td><a href='viewer.php?version=$version&func=valgrind&file=$hash'>$file</a></td><td>$testtype</td><td>$title</td></tr>\n"; + + // todo: added str_replace to individual report output + + $base = "$phpdir/".substr($test['file'],0,-4); + + $script = highlight_file($base.'php', true) + or $script = 'Script contents were not available.'; + + $report = file_get_contents($report_file); + + if($report === false) + $report = 'Memory leak file contents were not available.'; + else + $report = str_replace($phpdir,'',$report); + + $additional = + "<h2>Script</h2><pre>\n" .$script. + "\n</pre><h2>Report</h2><pre>\n".$report."\n</pre>"; + // .out replaced by .mem + // now create the test's page + file_put_contents("$outdir/$hash.inc", + //html_header("Valgrind Report: $file"). + '<?php $filename="'.basename($file).'"; ?>' + .$additional. + html_footer() + ); + + $t['file'] = $test['file']; + $t['teststatus'] = $test['teststatus']; + $t['script'] = $script; + $t['report'] = $report; + } + else // For valgrind failure we only know file and status + { + // todo: fix this if more information can be gathered + $t['file'] = $test['file']; + $t['teststatus'] = $test['teststatus']; + } + + $valgrind[] = $t; + +} + +if (count($leaks)) + $write .= "</table>\n"; + +$write .= html_footer(); + +file_put_contents("$outdir/valgrind.inc", $write); + +// Serialize testing + +// This prevents writing the file if there is no content +if(count($valgrind) > 0) +{ + ob_start(); + + echo serialize($valgrind); + + $contents = ob_get_clean(); + + file_put_contents("$outdir/valgrind.txt", $contents); +} + +?> http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/graph.php?view=markup&rev=1.1 Index: php-gcov-web/cron/graph.php +++ php-gcov-web/cron/graph.php http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/mailer.php?view=markup&rev=1.1 Index: php-gcov-web/cron/mailer.php +++ php-gcov-web/cron/mailer.php