summaryrefslogtreecommitdiff
path: root/run-tests.php
diff options
context:
space:
mode:
authorStig Bakken <ssb@php.net>2001-08-27 16:39:49 +0000
committerStig Bakken <ssb@php.net>2001-08-27 16:39:49 +0000
commit2186ced3a6ca1a258d7ad711c969dbc41f4dd544 (patch)
tree22b245c3af665410784d0fd7aa56caa18b431ec5 /run-tests.php
parentd7149ba8fc1cca561e4ad3ae30c12c2348842edc (diff)
downloadphp-git-2186ced3a6ca1a258d7ad711c969dbc41f4dd544.tar.gz
* MTH (merge _to_ head)
Diffstat (limited to 'run-tests.php')
-rwxr-xr-xrun-tests.php75
1 files changed, 50 insertions, 25 deletions
diff --git a/run-tests.php b/run-tests.php
index f5014ebabf..40ceac9ecc 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -102,6 +102,28 @@ function create_modules_2_test_list() {
+function in_path($program)
+{
+ global $HTTP_ENV_VARS;
+ if (substr(PHP_OS, 0, 3) == "WIN") {
+ $delim = ";";
+ $ext = ".exe";
+ } else {
+ $delim = ":";
+ $ext = "";
+ }
+ $slash = DIRECTORY_SEPARATOR;
+ $path_components = explode($delim, $HTTP_ENV_VARS['PATH']);
+ foreach ($path_components as $path) {
+ $test = "{$path}{$slash}php{$ext}";
+ if (@is_executable($test)) {
+ return $test;
+ }
+ }
+ return false;
+}
+
+
function initialize()
{
global $term, $windows_p, $php, $skip, $testdirs, $tmpfile,
@@ -109,39 +131,42 @@ function initialize()
$tests_in_dir;
// XXX Should support HTML output as well.
- $term = getenv("TERM");
- if (ereg('^(xterm|vt220)', $term)) {
- $term_bold = sprintf("%c%c%c%c", 27, 91, 49, 109);
- $term_norm = sprintf("%c%c%c", 27, 91, 109);
- } elseif (ereg('^vt100', $term)) {
- $term_bold = sprintf("%c%c%c%c", 27, 91, 49, 109);
- $term_norm = sprintf("%c%c%c", 27, 91, 109);
+ $php = "";
+ if((substr(PHP_OS, 0, 3) == "WIN")) {
+ $ext = ".exe";
+ $windows_p = true;
+ $term = getenv("COMSPEC");
} else {
- $term_bold = $term_norm = "";
- }
-
- if((substr(PHP_OS, 0, 3) == "WIN")) {
- $windows_p = true;
- $term = getenv("COMSPEC");
- $null = getenv("TOP_BUILDDIR");
- $php = ($null ? $null : getcwd()) . "/php.exe";
- unset($null);
- } else {
- if (isset($GLOBALS["TOP_BUILDDIR"])) {
- $php = $GLOBALS["TOP_BUILDDIR"]."/php";
+ $ext = "";
+ $term = getenv("TERM");
+ if (ereg('^(xterm|vt220)', $term)) {
+ $term_bold = sprintf("%c%c%c%c", 27, 91, 49, 109);
+ $term_norm = sprintf("%c%c%c", 27, 91, 109);
+ } elseif (ereg('^vt100', $term)) {
+ $term_bold = sprintf("%c%c%c%c", 27, 91, 49, 109);
+ $term_norm = sprintf("%c%c%c", 27, 91, 109);
} else {
- $php = getcwd() . '/php';
+ $term_bold = $term_norm = "";
}
}
- create_compiled_in_modules_list();
-
- if (!is_executable($php) && !$windows_p) {
- dowriteln("PHP CGI binary ($php) is not executable.");
- dowriteln("Please compile PHP as a CGI executable and try again.");
+ if (isset($GLOBALS["TOP_BUILDDIR"]) && @is_executable($GLOBALS["TOP_BUILDDIR"]."/php{$ext}")) {
+ $php = $GLOBALS["TOP_BUILDDIR"]."/php{$ext}";
+ } elseif (@is_executable("./php{$ext}")) {
+ $php = getcwd() . "/php{$ext}";
+ }
+ if (empty($php)) {
+ $php = in_path("php");
+ }
+ if (empty($php)) {
+ dowriteln("Unable to find PHP executable (php{$ext}).");
+ dowriteln("Please build PHP as a CGI executable or make sure it is");
+ dowriteln("available in the PATH environment variable.");
exit;
}
+ create_compiled_in_modules_list();
+
$skip = array(
"CVS" => 1
);