cellog Sun Jan 23 22:04:49 2005 EDT
Modified files:
/pear-core/PEAR/Command Package.php
Log:
add "realtimelog" option, which writes out a log of which tests have
been executed. This is very useful for 600+ test runs should PEAR
hang in the middle of testing.
Also, add command to all outputData() calls for possible web frontend
implementation of the run-tests command
http://cvs.php.net/diff.php/pear-core/PEAR/Command/Package.php?r1=1.88&r2=1.89&ty=u
Index: pear-core/PEAR/Command/Package.php
diff -u pear-core/PEAR/Command/Package.php:1.88
pear-core/PEAR/Command/Package.php:1.89
--- pear-core/PEAR/Command/Package.php:1.88 Sat Jan 1 01:56:22 2005
+++ pear-core/PEAR/Command/Package.php Sun Jan 23 22:04:49 2005
@@ -18,7 +18,7 @@
// | Greg Beaver <cellog@xxxxxxx> |
// +----------------------------------------------------------------------+
//
-// $Id: Package.php,v 1.88 2005/01/01 06:56:22 cellog Exp $
+// $Id: Package.php,v 1.89 2005/01/24 03:04:49 cellog Exp $
require_once 'PEAR/Common.php';
require_once 'PEAR/Packager.php';
@@ -171,6 +171,10 @@
'doc' => 'actual string of settings to pass to php in
format " -d setting=blah"',
'arg' => 'SETTINGS'
),
+ 'realtimelog' => array(
+ 'shortopt' => 'l',
+ 'doc' => 'Log test runs/results as they are run',
+ ),
),
'doc' => '[testfile|dir ...]
Run regression tests with PHP\'s regression testing script (run-tests.php).',
@@ -551,10 +555,27 @@
$this->ui->outputData('Using INI settings: "' . $ini_settings .
'"');
}
$skipped = $passed = $failed = array();
- $this->ui->outputData('Running ' . count($tests) . ' tests');
+ $this->ui->outputData('Running ' . count($tests) . ' tests', $command);
$start = time();
+ if (isset($options['realtimelog'])) {
+ @unlink('run-tests.log');
+ }
foreach ($tests as $t) {
+ if (isset($options['realtimelog'])) {
+ $fp = @fopen('run-tests.log', 'a');
+ if ($fp) {
+ fwrite($fp, "Running test $t...");
+ fclose($fp);
+ }
+ }
$result = $run->run($t, $ini_settings);
+ if (isset($options['realtimelog'])) {
+ $fp = @fopen('run-tests.log', 'a');
+ if ($fp) {
+ fwrite($fp, "$result\n");
+ fclose($fp);
+ }
+ }
if ($result == 'FAILED') {
$failed[] = $t;
}
@@ -574,22 +595,26 @@
foreach ($failed as $failure) {
$output .= $failure . "\n";
}
- $fp = @fopen('run-tests.log', 'w');
+ if (isset($options['realtimelog'])) {
+ $fp = @fopen('run-tests.log', 'a');
+ } else {
+ $fp = @fopen('run-tests.log', 'w');
+ }
if ($fp) {
fwrite($fp, $output, strlen($output));
fclose($fp);
- $this->ui->outputData('wrote log to "' .
realpath('run-tests.log') . '"');
+ $this->ui->outputData('wrote log to "' .
realpath('run-tests.log') . '"', $command);
}
} elseif (@file_exists('run-tests.log') && !@is_dir('run-tests.log')) {
@unlink('run-tests.log');
}
$this->ui->outputData('TOTAL TIME: ' . $total);
- $this->ui->outputData(count($passed) . ' PASSED TESTS');
- $this->ui->outputData(count($skipped) . ' SKIPPED TESTS');
+ $this->ui->outputData(count($passed) . ' PASSED TESTS', $command);
+ $this->ui->outputData(count($skipped) . ' SKIPPED TESTS', $command);
if (count($failed)) {
- $this->ui->outputData(count($failed) . ' FAILED TESTS:');
+ $this->ui->outputData(count($failed) . ' FAILED TESTS:',
$command);
foreach ($failed as $failure) {
- $this->ui->outputData($failure);
+ $this->ui->outputData($failure, $command);
}
}
--
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
|