fact #1: some tests *require* cgi sapi (eg. POST stuff) fact #2: current test suid *does not work* with php-cgi
conclusion: a lot of stuff doesn't get any automatic testing solution: (see attached patch) - run-tests.php sets USER_AGENT=run-tests.php - run-tests.php prepends testcode with chdir() - php-cgi falls back to argc/argv parsing even if in cgi mode when USER_AGENT=run-tests.php with the patch applied the following works again: export TEST_PHP_EXECUTABLE=sapi/cgi/php-cgi sapi/cli/php run-tests.php comments? ;) -----8<--------------------------------- Index: run-tests.php =================================================================== RCS file: /repository/php4/run-tests.php,v retrieving revision 1.83 diff -u -2 -r1.83 run-tests.php --- run-tests.php 23 Oct 2002 12:54:57 -0000 1.83 +++ run-tests.php 24 Oct 2002 09:26:06 -0000 @@ -83,4 +83,6 @@ } +$php = realpath($php); + // Check whether a detailed log is wanted. if (getenv('TEST_PHP_DETAILED')) { @@ -425,4 +427,5 @@ // Reset environment from any previous test. + putenv("USER_AGENT=run-tests.php"); putenv("REDIRECT_STATUS="); putenv("QUERY_STRING="); @@ -437,7 +440,8 @@ if (trim($section_text['SKIPIF'])) { save_text($tmp_skipif, $section_text['SKIPIF']); - $output = `$php $tmp_skipif`; + putenv("PATH_TRANSLATED=$tmp_skipif"); + $output = `$php -q $tmp_skipif`; @unlink($tmp_skipif); - if (ereg("^skip", trim($output))){ + if (ereg("^skip", $output)){ echo "SKIP $tested"; $reason = (ereg("^skip[[:space:]]*(.+)\$", trim( $output))) ? ereg_replace("^skip[[:space:]]*(.+)\$", "\\1", trim($output)) : FAL SE; @@ -478,5 +482,5 @@ // We've satisfied the preconditions - run the test! - save_text($tmp_file,$section_text['FILE']); + save_text($tmp_file,"<?php chdir('".getcwd()."'); ?>" . $section_text['F ILE']); if (array_key_exists('GET', $section_text)) { $query_string = trim($section_text['GET']); @@ -502,6 +506,5 @@ putenv("CONTENT_LENGTH=$content_length"); - $cmd = "$php$ini_settings -f $tmp_file 2>&1 < $tmp_post"; - + $cmd = "$php -q $ini_settings -f $tmp_file 2>&1 < ". realpath($t mp_post); } else { @@ -510,5 +513,5 @@ putenv("CONTENT_LENGTH="); - $cmd = "$php$ini_settings -f $tmp_file$args 2>&1"; + $cmd = "$php -q $ini_settings -f $tmp_file$args 2>&1"; } @@ -524,6 +527,6 @@ "; - $out = `$cmd`; - + $out = `$cmd`; + @unlink($tmp_post); Index: sapi/cgi/cgi_main.c =================================================================== RCS file: /repository/php4/sapi/cgi/cgi_main.c,v retrieving revision 1.183 diff -u -2 -r1.183 cgi_main.c --- sapi/cgi/cgi_main.c 13 Oct 2002 09:40:44 -0000 1.183 +++ sapi/cgi/cgi_main.c 24 Oct 2002 09:26:06 -0000 @@ -523,5 +523,5 @@ { int exit_status = SUCCESS; - int cgi = 0, c, i, len; + int cgi = 0, c, i, len, testmode = 0; zend_file_handle file_handle; int retval = FAILURE; @@ -574,4 +574,8 @@ #endif +#ifndef PHP_FASTCGI + s = getenv("USER_AGENT"); + if(s && !strcmp(s, "run-tests.php")) testmode = 1; +#endif #ifdef ZTS @@ -876,9 +880,9 @@ zend_llist_init(&global_vars, sizeof(char *), NULL, 0); - if (!cgi + if ( testmode || (!cgi #ifdef PHP_FASTCGI && !fastcgi #endif - ) { /* never execute the arguments if you are a CGI */ + )) { /* never execute the arguments if you are a CGI unl ess in testmode*/ if (SG(request_info).argv0) { free(SG(request_info).argv0); -- Six Offene Systeme GmbH http://www.six.de/ i.A. Hartmut Holzgraefe Email: [EMAIL PROTECTED] Tel.: +49-711-99091-77 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php