iliaa Thu Jul 24 13:45:15 2003 EDT
Modified files: (Branch: PHP_4_3)
/php-src run-tests.php Makefile.global
Log:
MFH:
When encountering a test that users GET/POST make run-tests.php
use CGI sapi if it is avaliable.
If CLI sapi is not avaliable print a clear error when make test
is executed.
Index: php-src/run-tests.php
diff -u php-src/run-tests.php:1.119.2.32 php-src/run-tests.php:1.119.2.33
--- php-src/run-tests.php:1.119.2.32 Sat May 31 08:37:44 2003
+++ php-src/run-tests.php Thu Jul 24 13:45:15 2003
@@ -99,7 +99,7 @@
putenv("TEST_PHP_EXECUTABLE=$php");
}
}
-if (!file_exists($php)) {
+if (empty($php) || !file_exists($php)) {
error("environment variable TEST_PHP_EXECUTABLE must be set to specify PHP
executable!");
}
@@ -567,6 +567,14 @@
}
fclose($fp);
+ /* For GET/POST tests, check if cgi sapi is avaliable and if it is, use it. */
+ if ((!empty($section_text['GET']) || !empty($section_text['POST']))) {
+ if (file_exists("./sapi/cgi/php")) {
+ $old_php = $php;
+ $php = realpath("./sapi/cgi/php") . ' -C ';
+ }
+ }
+
$shortname = str_replace($GLOBALS['cwd'].'/', '', $file);
$tested = trim($section_text['TEST'])." [$shortname]";
@@ -610,6 +618,9 @@
} else {
echo "\n";
}
+ if (isset($old_php)) {
+ $php = $old_php;
+ }
return 'SKIPPED';
}
if (eregi("^info", trim($output))) {
@@ -696,6 +707,11 @@
$output = trim($out);
$output = preg_replace('/\r\n/',"\n",$output);
+ /* when using CGI, strip the headers from the output */
+ if (isset($old_php) && ($pos = strpos($output, "\n\n")) !== FALSE) {
+ $output = substr($output, ($pos + 2));
+ }
+
if (isset($section_text['EXPECTF']) || isset($section_text['EXPECTREGEX'])) {
if (isset($section_text['EXPECTF'])) {
$wanted = trim($section_text['EXPECTF']);
@@ -722,6 +738,9 @@
if (preg_match("/^$wanted_re\$/s", $output)) {
@unlink($tmp_file);
echo "PASS $tested\n";
+ if (isset($old_php)) {
+ $php = $old_php;
+ }
return 'PASSED';
}
@@ -733,6 +752,9 @@
if ($ok) {
@unlink($tmp_file);
echo "PASS $tested\n";
+ if (isset($old_php)) {
+ $php = $old_php;
+ }
return 'PASSED';
}
}
@@ -789,6 +811,10 @@
");
fclose($log);
error_report($file,$logname,$tested);
+ }
+
+ if (isset($old_php)) {
+ $php = $old_php;
}
return $warn ? 'WARNED' : 'FAILED';
Index: php-src/Makefile.global
diff -u php-src/Makefile.global:1.40.2.12 php-src/Makefile.global:1.40.2.13
--- php-src/Makefile.global:1.40.2.12 Tue Jul 1 22:48:16 2003
+++ php-src/Makefile.global Thu Jul 24 13:45:15 2003
@@ -50,11 +50,15 @@
install-su: install-pear install-tester
-test: $(SAPI_CLI_PATH)
- @TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
- TEST_PHP_SRCDIR=$(top_srcdir) \
- CC="$(CC)" \
- $(top_builddir)/$(SAPI_CLI_PATH) -d 'open_basedir=' -d
'safe_mode=0' -d 'output_buffering=0' $(top_srcdir)/run-tests.php $(TESTS)
+test:
+ [EMAIL PROTECTED] test -x $(SAPI_CLI_PATH) && test ! -z $(SAPI_CLI_PATH); then
\
+ TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
+ TEST_PHP_SRCDIR=$(top_srcdir) \
+ CC="$(CC)" \
+ $(top_builddir)/$(SAPI_CLI_PATH) -d 'open_basedir=' -d
'safe_mode=0' -d 'output_buffering=0' $(top_srcdir)/run-tests.php $(TESTS); \
+ else \
+ echo "ERROR: Cannot run tests without CLI sapi."; \
+ fi
clean:
find . -name \*.lo | xargs rm -f
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php