cvs: pear-core / test-modified.php
| From: | Greg Beaver | Date: | Tue, 14 Apr 2009 01:24:31 +0000 |
| Subject: | cvs: pear-core / test-modified.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-8338@lists.php.net to get a copy of this message | ||
cellog Tue Apr 14 01:24:31 2009 UTC
Modified files:
/pear-core test-modified.php
Log:
now we support tests/ as a subdirectory of code, so add that in.
Also add --norender option
http://cvs.php.net/viewvc.cgi/pear-core/test-modified.php?r1=1.4&r2=1.5&diff_format=u
Index: pear-core/test-modified.php
diff -u pear-core/test-modified.php:1.4 pear-core/test-modified.php:1.5
--- pear-core/test-modified.php:1.4 Sat Apr 11 20:06:48 2009
+++ pear-core/test-modified.php Tue Apr 14 01:24:31 2009
@@ -2,6 +2,7 @@
namespace {
$path = false;
$force = false;
+$norender = false;
if (isset($_SERVER['argv'][1])) {
$arg = $_SERVER['argv'][1];
if ($arg === '--force') {
@@ -9,7 +10,30 @@
if (!isset($_SERVER['argv'][2])) {
goto skippy;
}
- $arg = $_SERVER['argv'][2];
+ // check if we only want to rebuild the coverage db
+ if ($_SERVER['argv'][2] === '--norender') {
+ $norender = true;
+ if (!isset($_SERVER['argv'][3])) {
+ goto skippy;
+ }
+ $arg = $_SERVER['argv'][3];
+ } else {
+ $arg = $_SERVER['argv'][2];
+ }
+ } elseif ($arg === '--norender') {
+ $norender = true;
+ if (!isset($_SERVER['argv'][2])) {
+ goto skippy;
+ }
+ if ($_SERVER['argv'][2] === '--force') {
+ $force = true;
+ if (!isset($_SERVER['argv'][3])) {
+ goto skippy;
+ }
+ $arg = $_SERVER['argv'][3];
+ } else {
+ $arg = $_SERVER['argv'][2];
+ }
}
$path = realpath($arg);
if ($path) {
@@ -22,13 +46,14 @@
}
if (!$path) {
die("Usage:
-php test-modified.php --force
+php test-modified.php [--force] [--norender] [/path/to/all]
+ --force:
Generate coverage even if no changes or failed tests
-php test-modified.php /path/to/all
+ --norender:
+ Do not generate coverage html files, just rebuild the database
+ /path/to/all:
Pass in path to checkout of http://svn.pear.php.net/PEAR2/all,
by default, we assume ../all
-php test-modified.php --force /path/to/all
- Force coverage generation and pass in path to all
");
}
function __autoload($c)
@@ -48,9 +73,9 @@
error_reporting($e);
}
namespace PEAR2\Pyrus\Developer\CoverageAnalyzer {
- $codepath = realpath(__DIR__ . '/PEAR');
+ $codepath = realpath(__DIR__);
$testpath = realpath(__DIR__ . '/tests');
- $sqlite = new Sqlite($codepath, $testpath . '/pear2coverage.db');
+ $sqlite = new Sqlite($testpath . '/pear2coverage.db', $codepath, $testpath);
$modified = $sqlite->getModifiedTests();
if (!$force && !count($modified)) {
echo "No changes to coverage needed. Bye!\n";
@@ -74,6 +99,9 @@
$a = new Aggregator($testpath,
$codepath,
$testpath . '/pear2coverage.db');
+ if ($norender) {
+ exit;
+ }
if (file_exists(__DIR__ . '/coverage')) {
echo "Removing old coverage HTML...";
foreach (new \DirectoryIterator(__DIR__ . '/coverage') as $file) {