Skip to content
Browse files

Cosmetics and adjust the pear2/all thing to also allow people to use …

…pear2 dir directly if people want to populate /all (they provide the same in most cases, just with /trunk added really)

git-svn-id: http://svn.php.net/repository/pear/pear-core/pear/pear-core/trunk@286945 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent ce6b244 commit 1188cf7f69319137b6419833f780eb95347bffbc dufuz committed
Showing with 25 additions and 8 deletions.
  1. +25 −8 test-modified.php
View
33 test-modified.php
@@ -1,8 +1,6 @@
<?php
namespace {
-$path = false;
-$force = false;
-$norender = false;
+$norender = $force = $path = false;
if (isset($_SERVER['argv'][1])) {
$arg = $_SERVER['argv'][1];
if ($arg === '--force') {
@@ -10,6 +8,7 @@
if (!isset($_SERVER['argv'][2])) {
goto skippy;
}
+
// check if we only want to rebuild the coverage db
if ($_SERVER['argv'][2] === '--norender') {
$norender = true;
@@ -25,6 +24,7 @@
if (!isset($_SERVER['argv'][2])) {
goto skippy;
}
+
if ($_SERVER['argv'][2] === '--force') {
$force = true;
if (!isset($_SERVER['argv'][3])) {
@@ -35,15 +35,23 @@
$arg = $_SERVER['argv'][2];
}
}
- $path = realpath($arg);
- if ($path) {
- $path = realpath($path . '/Pyrus_Developer/src/Pyrus/Developer/CoverageAnalyzer');
+
+ $realpath = realpath($arg);
+ if ($realpath) {
+ $path = realpath($realpath . '/Pyrus_Developer/src/Pyrus/Developer/CoverageAnalyzer');
}
+
+ if ($realpath && !$path) {
+ $path = realpath($realpath . '/Pyrus_Developer/trunk/src/Pyrus/Developer/CoverageAnalyzer');
+ }
+
}
+
skippy:
if (!$path) {
$path = realpath(__DIR__ . '/../all/Pyrus_Developer/src/Pyrus/Developer/CoverageAnalyzer');
}
+
if (!$path) {
die("Usage:
php test-modified.php [--force] [--norender] [/path/to/all]
@@ -56,12 +64,14 @@
by default, we assume ../all
");
}
+
function __autoload($c)
{
$c = str_replace(array('PEAR2\Pyrus\Developer\CoverageAnalyzer\\',
'\\'), array('', '/'), $c);
include $GLOBALS['path'] . '/' . $c . '.php';
}
+
$e = error_reporting();
error_reporting(0);
$olddir = getcwd();
@@ -78,18 +88,21 @@ function __autoload($c)
break;
}
}
+
if (!isset($codepath)) {
die("Something is wrong - PEAR.php exists, but was not within include_path\n");
}
+
require_once 'PEAR/Command/Test.php';
require_once 'PEAR/Frontend/CLI.php';
require_once 'PEAR/Config.php';
-$cli = new PEAR_Frontend_CLI;
+$cli = new PEAR_Frontend_CLI;
$config = @PEAR_Config::singleton();
-$test = new PEAR_Command_Test($cli, $config);
+$test = new PEAR_Command_Test($cli, $config);
error_reporting($e);
chdir($olddir);
}
+
namespace PEAR2\Pyrus\Developer\CoverageAnalyzer {
$sqlite = new Sqlite($testpath . '/pear2coverage.db', $codepath, $testpath);
$modified = $sqlite->getModifiedTests();
@@ -97,9 +110,11 @@ function __autoload($c)
echo "No changes to coverage needed. Bye!\n";
exit;
}
+
if (!count($modified) && $force) {
goto norunnie;
}
+
chdir($testpath);
$e = error_reporting();
error_reporting(0);
@@ -118,6 +133,7 @@ function __autoload($c)
if ($norender) {
exit;
}
+
if (file_exists(__DIR__ . '/coverage')) {
echo "Removing old coverage HTML...";
foreach (new \DirectoryIterator(__DIR__ . '/coverage') as $file) {
@@ -128,6 +144,7 @@ function __autoload($c)
} else {
mkdir(__DIR__ . '/coverage');
}
+
echo "Rendering\n";
$a->render(__DIR__ . '/coverage');
echo "Done rendering\n";

0 comments on commit 1188cf7

Please sign in to comment.
Something went wrong with that request. Please try again.