cvs: php4 / run-tests.php /win32 php4ts.dsw testsuite.dsp

From: Date: Wed, 02 May 2001 16:39:04 +0000
Subject: cvs: php4 / run-tests.php /win32 php4ts.dsw testsuite.dsp
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-5455@lists.php.net to get a copy of this message
dbeu Wed May 2 09:39:04 2001 EDT Added files: /php4/win32 testsuite.dsp Modified files: /php4 run-tests.php /php4/win32 php4ts.dsw Log: make run-tests work under win32 too # this whole thing is pretty ugly...

Index: php4/run-tests.php diff -u php4/run-tests.php:1.23 php4/run-tests.php:1.24 --- php4/run-tests.php:1.23 Mon Apr 16 16:28:57 2001 +++ php4/run-tests.php Wed May 2 09:39:03 2001 @@ -73,15 +73,8 @@ } function create_compiled_in_modules_list() { - global $php,$compiled_in_modules; - $ret=`$php -m`; - - $compiled_in_modules=explode("\n",$ret); - foreach ($compiled_in_modules AS $key => $value) { - if (!$value - || strchr($value,' ') ) unset($compiled_in_modules[$key]); - } - + global $compiled_in_modules; + $compiled_in_modules = @get_loaded_extensions(); } function extract_module_name_from_path($path) { @@ -127,16 +120,13 @@ $term_bold = $term_norm = ""; } - $windows_p = (substr(PHP_OS, 0, 3) == "WIN"); - if ($windows_p) { - if (file_exists('Release_TS_inline\\php.exe')) { - $php = 'Release_TS_inline\\php.exe'; - } elseif (file_exists('Release_TS\\php.exe')) { - $php = 'Release_TS\\php.exe'; - } else { - $php=trim($windows_p ? `cd`:`pwd`).'\\php'; - } - } else { + 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"; } else { @@ -145,8 +135,8 @@ } create_compiled_in_modules_list(); - - if (!is_executable($php)) { + + 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."); exit; @@ -211,14 +201,14 @@ } } else { // $dir = $GLOBALS["TOP_SRCDIR"]; // XXX ??? where should this variable be set? - $dir=str_replace('\\','/',trim(($windows_p ? `cd`:`pwd`))); + $dir=str_replace('\\','/',trim(($windows_p ? getenv("TEST_DIR"):`pwd`))); } if (isset($dir) && $dir) { find_testdirs($dir); - + create_found_tests_4_modules_list(); create_modules_2_test_list(); - + for ($i = 0; $i < sizeof($testdirs); $i++) { run_tests_in_dir($testdirs[$i]); } @@ -265,22 +255,22 @@ } while ($ent = readdir($dp)) { $path = "$dir/$ent"; - + if ((isset($skip[$ent]) && $skip[$ent]) || substr($ent, 0, 1) == "." || !is_dir($path) - + ) { continue; } - + if (strstr("/$path/", "/tests/")) { $testdirs[] = $path; } find_testdirs($path, false); } closedir($dp); - + } function run_tests_in_dir($dir = '.') @@ -307,13 +297,13 @@ if (sizeof($testfiles) == 0) { return; } - + if ($mod_name=extract_module_name_from_path($dir)) { if ($ext_found=in_array($mod_name,$modules_available)) dowriteln("Testing extension: $mod_name"); else $skipped_extensions[$mod_name]=TRUE; } - + if ($ext_found!==FALSE) { dowriteln("%bRunning tests in $dir%B"); dowriteln("=================".str_repeat("=", strlen($dir))); @@ -373,7 +363,7 @@ * @return bool whether the files were "equal" */ function compare_results($file1, $file2) -{ +{ $data1 = $data2 = ""; if (!($fp1 = @fopen($file1, "r")) || !($fp2 = @fopen($file2, "r"))) { return false; @@ -382,12 +372,12 @@ while (!(feof($fp1) || feof($fp2))) { if (!feof($fp1) && trim($line1 = fgets($fp1, 10240)) != "") { //print "adding line1 $line1\n"; - + $data1 .= trim($line1); } if (!feof($fp2) && trim($line2 = fgets($fp2, 10240)) != "") { //print "adding line2 $line2\n"; - + $data2 .= trim($line2); } } @@ -404,7 +394,7 @@ function run_test($file) { - global $php, $tmpfile, $term_bold, $term_norm; + global $php, $tmpfile, $term_bold, $term_norm, $term, $windows_p; $variables = array("TEST", "POST", "GET", "FILE", "EXPECT", "SKIPIF", "OUTPUT"); @@ -417,11 +407,11 @@ $tmpfile["FILE"] = tempnam($tmpdir, $tmpfix); $tmpfile["SKIPIF"] = tempnam($tmpdir, $tmpfix); $tmpfile["POST"] = tempnam($tmpdir, $tmpfix); - + $tmpfile["EXPECT"] = tempnam($tmpdir, $tmpfix); $tmpfile["OUTPUT"] = tempnam($tmpdir, $tmpfix); - - + + while ($line = fgets($fp, 4096)) { if (preg_match('/^--([A-Z]+)--/', $line, $matches)) { $var = $matches[1]; @@ -487,11 +477,19 @@ putenv("CONTENT_LENGTH="); } if (isset($fps["POST"])) { - - // XXX Fix me, I do not work on win32 (?) - $cmd = "$php -q $tmpfile[FILE] < $tmpfile[POST]"; + if(!$windows_p) { + $cmd = "$php -q $tmpfile[FILE] < $tmpfile[POST]"; + } + else { + $cmd = "$term /c " . realpath($php) ." -q $tmpfile[FILE] < $tmpfile[POST]"; + } } else { - $cmd = "$php -q $tmpfile[FILE]"; + if(!$windows_p) { + $cmd = "$php -q $tmpfile[FILE]"; + } + else { + $cmd = "$term /c " . realpath($php) ." -q $tmpfile[FILE]";; + } } $ofp = @fopen($tmpfile["OUTPUT"], "w"); if (!$ofp) { @@ -563,4 +561,4 @@ return $status; } -?> +?> \ No newline at end of file Index: php4/win32/php4ts.dsw diff -u php4/win32/php4ts.dsw:1.8 php4/win32/php4ts.dsw:1.9 --- php4/win32/php4ts.dsw:1.8 Sat Apr 28 11:46:56 2001 +++ php4/win32/php4ts.dsw Wed May 2 09:39:03 2001 @@ -165,6 +165,21 @@ ############################################################################### +Project: "testsuite"=".\testsuite.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name php4ts + End Project Dependency +}}} + +############################################################################### + Global: Package=<5> Index: php4/win32/testsuite.dsp +++ php4/win32/testsuite.dsp # Microsoft Developer Studio Project File - Name="testsuite" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Generic Project" 0x010a CFG=testsuite - Win32 Debug_TS !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "testsuite.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "testsuite.mak" CFG="testsuite - Win32 Debug_TS" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "testsuite - Win32 Release_TS_Inline" (based on "Win32 (x86) Generic Project") !MESSAGE "testsuite - Win32 Release_TS" (based on "Win32 (x86) Generic Project") !MESSAGE "testsuite - Win32 Release_TSDbg" (based on "Win32 (x86) Generic Project") !MESSAGE "testsuite - Win32 Debug_TS" (based on "Win32 (x86) Generic Project") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" MTL=midl.exe !IF "$(CFG)" == "testsuite - Win32 Release_TS_Inline" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release_TS_Inline" # PROP BASE Intermediate_Dir "Release_TS_Inline" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "..\..\Release_TS_Inline" # PROP Intermediate_Dir "..\..\" # PROP Target_Dir "" !ELSEIF "$(CFG)" == "testsuite - Win32 Release_TS" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release_TS" # PROP BASE Intermediate_Dir "Release_TS" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "..\..\Release_TS" # PROP Intermediate_Dir "..\..\" # PROP Target_Dir "" !ELSEIF "$(CFG)" == "testsuite - Win32 Release_TSDbg" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release_TSDbg" # PROP BASE Intermediate_Dir "Release_TSDbg" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "..\..\Release_TSDbg" # PROP Intermediate_Dir "..\..\" # PROP Target_Dir "" !ELSEIF "$(CFG)" == "testsuite - Win32 Debug_TS" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug_TS" # PROP BASE Intermediate_Dir "Debug_TS" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "..\..\Debug_TS" # PROP Intermediate_Dir "..\..\" # PROP Target_Dir "" !ENDIF # Begin Target # Name "testsuite - Win32 Release_TS_Inline" # Name "testsuite - Win32 Release_TS" # Name "testsuite - Win32 Release_TSDbg" # Name "testsuite - Win32 Debug_TS" # Begin Source File SOURCE=..\results.txt !IF "$(CFG)" == "testsuite - Win32 Release_TS_Inline" # PROP Intermediate_Dir "..\Release_TS_Inline" # PROP Ignore_Default_Tool 1 # Begin Custom Build - Running Testsuite, please wait... IntDir=.\..\Release_TS_Inline InputPath=..\results.txt "..\..\results.txt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" set TOP_BUILDDIR=Release_TS_inline set TEST_DIR=tests $(IntDir)\php.exe -q ..\run-tests.php > ..\results.txt # End Custom Build !ELSEIF "$(CFG)" == "testsuite - Win32 Release_TS" # PROP Intermediate_Dir "..\Release_TS" # PROP Ignore_Default_Tool 1 # Begin Custom Build - Running Testsuite, please wait... IntDir=.\..\Release_TS InputPath=..\results.txt "..\..\results.txt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" set TOP_BUILDDIR=Release_TS set TEST_DIR=tests $(IntDir)\php.exe -q ..\run-tests.php > ..\results.txt # End Custom Build !ELSEIF "$(CFG)" == "testsuite - Win32 Release_TSDbg" # PROP Intermediate_Dir "..\Release_TSDbg" # PROP Ignore_Default_Tool 1 # Begin Custom Build - Running Testsuite, please wait... IntDir=.\..\Release_TSDbg InputPath=..\results.txt "..\..\results.txt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" set TOP_BUILDDIR=Release_TSDbg set TEST_DIR=tests $(IntDir)\php.exe -q ..\run-tests.php > ..\results.txt # End Custom Build !ELSEIF "$(CFG)" == "testsuite - Win32 Debug_TS" # PROP Intermediate_Dir "..\Debug_TS" # PROP Exclude_From_Build 1 !ENDIF # End Source File # End Target # End Project
« previous php.cvs (#5455) next »