141
141
142
142
$ php = null ;
143
143
$ php_cgi = null ;
144
+ $ phpdbg = null ;
144
145
145
146
if (getenv ('TEST_PHP_EXECUTABLE ' )) {
146
147
$ php = getenv ('TEST_PHP_EXECUTABLE ' );
158
159
$ php_cgi = null ;
159
160
}
160
161
}
162
+
163
+ if (!getenv ('TEST_PHPDBG_EXECUTABLE ' )) {
164
+ $ phpdbg = $ cwd . '/sapi/phpdbg/phpdbg ' ;
165
+
166
+ if (file_exists ($ phpdbg )) {
167
+ putenv ("TEST_PHP_CGI_EXECUTABLE= $ phpdbg " );
168
+ } else {
169
+ $ phpdbg = null ;
170
+ }
171
+ }
161
172
}
162
173
$ environment ['TEST_PHP_EXECUTABLE ' ] = $ php ;
163
174
}
173
184
$ environment ['TEST_PHP_CGI_EXECUTABLE ' ] = $ php_cgi ;
174
185
}
175
186
187
+ if (getenv ('TEST_PHPDBG_EXECUTABLE ' )) {
188
+ $ phpdbg = getenv ('TEST_PHPDBG_EXECUTABLE ' );
189
+
190
+ if ($ phpdbg =='auto ' ) {
191
+ $ phpdbg = $ cwd . '/sapi/phpdbg/phpdbg ' ;
192
+ putenv ("TEST_PHPDBG_EXECUTABLE= $ phpdbg " );
193
+ }
194
+
195
+ $ environment ['TEST_PHPDBG_EXECUTABLE ' ] = $ phpdbg ;
196
+ }
197
+
176
198
function verify_config ()
177
199
{
178
200
global $ php ;
@@ -247,7 +269,7 @@ function verify_config()
247
269
248
270
function write_information ($ show_html )
249
271
{
250
- global $ cwd , $ php , $ php_cgi , $ php_info , $ user_tests , $ ini_overwrites , $ pass_options , $ exts_to_test , $ leak_check , $ valgrind_header , $ no_file_cache ;
272
+ global $ cwd , $ php , $ php_cgi , $ phpdbg , $ php_info , $ user_tests , $ ini_overwrites , $ pass_options , $ exts_to_test , $ leak_check , $ valgrind_header , $ no_file_cache ;
251
273
252
274
// Get info from php
253
275
$ info_file = __DIR__ . '/run-test-info.php ' ;
@@ -274,6 +296,14 @@ function write_information($show_html)
274
296
$ php_cgi_info = '' ;
275
297
}
276
298
299
+ if ($ phpdbg ) {
300
+ $ phpdbg_info = `$ phpdbg $ pass_options $ info_params $ no_file_cache -qrr " $ info_file" `;
301
+ $ php_info_sep = "\n--------------------------------------------------------------------- " ;
302
+ $ phpdbg_info = "$ php_info_sep \nPHP : $ phpdbg $ phpdbg_info$ php_info_sep " ;
303
+ } else {
304
+ $ phpdbg_info = '' ;
305
+ }
306
+
277
307
@unlink ($ info_file );
278
308
279
309
// load list of enabled extensions
@@ -299,7 +329,7 @@ function write_information($show_html)
299
329
// Write test context information.
300
330
echo "
301
331
=====================================================================
302
- PHP : $ php $ php_info $ php_cgi_info
332
+ PHP : $ php $ php_info $ php_cgi_info $ phpdbg_info
303
333
CWD : $ cwd
304
334
Extra dirs : " ;
305
335
foreach ($ user_tests as $ test_dir ) {
@@ -1205,6 +1235,10 @@ function run_test($php, $file, $env)
1205
1235
$ php_cgi = $ env ['TEST_PHP_CGI_EXECUTABLE ' ];
1206
1236
}
1207
1237
1238
+ if (isset ($ env ['TEST_PHPDBG_EXECUTABLE ' ])) {
1239
+ $ phpdbg = $ env ['TEST_PHPDBG_EXECUTABLE ' ];
1240
+ }
1241
+
1208
1242
if (is_array ($ file )) {
1209
1243
$ file = $ file [0 ];
1210
1244
}
@@ -1290,7 +1324,7 @@ function run_test($php, $file, $env)
1290
1324
1291
1325
} else {
1292
1326
1293
- if (@count ($ section_text ['FILE ' ]) + @count ($ section_text ['FILEEOF ' ]) + @count ($ section_text ['FILE_EXTERNAL ' ]) != 1 ) {
1327
+ if (! isset ( $ section_text [ ' PHPDBG ' ]) && @count ($ section_text ['FILE ' ]) + @count ($ section_text ['FILEEOF ' ]) + @count ($ section_text ['FILE_EXTERNAL ' ]) != 1 ) {
1294
1328
$ bork_info = "missing section --FILE-- " ;
1295
1329
$ borked = true ;
1296
1330
}
@@ -1372,6 +1406,38 @@ function run_test($php, $file, $env)
1372
1406
}
1373
1407
}
1374
1408
1409
+ /* For phpdbg tests, check if phpdbg sapi is available and if it is, use it. */
1410
+ if (array_key_exists ('PHPDBG ' , $ section_text )) {
1411
+ if (!isset ($ section_text ['STDIN ' ])) {
1412
+ $ section_text ['STDIN ' ] = $ section_text ['PHPDBG ' ]."\n" ;
1413
+ }
1414
+
1415
+ if (isset ($ phpdbg )) {
1416
+ $ old_php = $ php ;
1417
+ $ php = $ phpdbg . ' -qIb ' ;
1418
+ } else if (!strncasecmp (PHP_OS , "win " , 3 ) && file_exists (dirname ($ php ) . "/phpdbg.exe " )) {
1419
+ $ old_php = $ php ;
1420
+ $ php = realpath (dirname ($ php ) . "/phpdbg.exe " ) . ' -qIb ' ;
1421
+ } else {
1422
+ if (file_exists (dirname ($ php ) . "/../../sapi/phpdbg/phpdbg " )) {
1423
+ $ old_php = $ php ;
1424
+ $ php = realpath (dirname ($ php ) . "/../../sapi/phpdbg/phpdbg " ) . ' -qIb ' ;
1425
+ } else if (file_exists ("./sapi/phpdbg/phpdbg " )) {
1426
+ $ old_php = $ php ;
1427
+ $ php = realpath ("./sapi/phpdbg/phpdbg " ) . ' -qIb ' ;
1428
+ } else if (file_exists (dirname ($ php ) . "/phpdbg " )) {
1429
+ $ old_php = $ php ;
1430
+ $ php = realpath (dirname ($ php ) . "/phpdbg " ) . ' -qIb ' ;
1431
+ } else {
1432
+ show_result ('SKIP ' , $ tested , $ tested_file , "reason: phpdbg not available " );
1433
+
1434
+ junit_init_suite (junit_get_suitename_for ($ shortname ));
1435
+ junit_mark_test_as ('SKIP ' , $ shortname , $ tested , 0 , 'phpdbg not available ' );
1436
+ return 'SKIPPED ' ;
1437
+ }
1438
+ }
1439
+ }
1440
+
1375
1441
if (!$ SHOW_ONLY_GROUPS ) {
1376
1442
show_test ($ test_idx , $ shortname );
1377
1443
}
@@ -1652,8 +1718,12 @@ function run_test($php, $file, $env)
1652
1718
}
1653
1719
1654
1720
// We've satisfied the preconditions - run the test!
1655
- show_file_block ('php ' , $ section_text ['FILE ' ], 'TEST ' );
1656
- save_text ($ test_file , $ section_text ['FILE ' ], $ temp_file );
1721
+ if (isset ($ section_text ['FILE ' ])) {
1722
+ show_file_block ('php ' , $ section_text ['FILE ' ], 'TEST ' );
1723
+ save_text ($ test_file , $ section_text ['FILE ' ], $ temp_file );
1724
+ } else {
1725
+ $ test_file = $ temp_file = "" ;
1726
+ }
1657
1727
1658
1728
if (array_key_exists ('GET ' , $ section_text )) {
1659
1729
$ query_string = trim ($ section_text ['GET ' ]);
@@ -1741,7 +1811,7 @@ function run_test($php, $file, $env)
1741
1811
$ env ['REQUEST_METHOD ' ] = 'PUT ' ;
1742
1812
1743
1813
if (empty ($ request )) {
1744
- junit_mark_test_as ('BORK ' , $ shortname , $ tested , null , 'empty $request ' );
1814
+ junit_mark_test_as ('BORK ' , $ shortname , $ tested , null , 'empty $request ' );
1745
1815
return 'BORKED ' ;
1746
1816
}
1747
1817
@@ -1765,34 +1835,33 @@ function run_test($php, $file, $env)
1765
1835
1766
1836
$ cmd = "$ php $ pass_options $ ini_settings -f \"$ test_file \" 2>&1 < \"$ tmp_post \"" ;
1767
1837
1768
- } else if (array_key_exists ('GZIP_POST ' , $ section_text ) && !empty ($ section_text ['GZIP_POST ' ])) {
1769
-
1770
- $ post = trim ($ section_text ['GZIP_POST ' ]);
1771
- $ post = gzencode ($ post , 9 , FORCE_GZIP );
1772
- $ env ['HTTP_CONTENT_ENCODING ' ] = 'gzip ' ;
1838
+ } else if (array_key_exists ('GZIP_POST ' , $ section_text ) && !empty ($ section_text ['GZIP_POST ' ])) {
1773
1839
1774
- save_text ($ tmp_post , $ post );
1775
- $ content_length = strlen ($ post );
1840
+ $ post = trim ($ section_text ['GZIP_POST ' ]);
1841
+ $ post = gzencode ($ post , 9 , FORCE_GZIP );
1842
+ $ env ['HTTP_CONTENT_ENCODING ' ] = 'gzip ' ;
1776
1843
1777
- $ env ['REQUEST_METHOD ' ] = 'POST ' ;
1778
- $ env ['CONTENT_TYPE ' ] = 'application/x-www-form-urlencoded ' ;
1779
- $ env ['CONTENT_LENGTH ' ] = $ content_length ;
1844
+ save_text ($ tmp_post , $ post );
1845
+ $ content_length = strlen ($ post );
1780
1846
1781
- $ cmd = "$ php $ pass_options $ ini_settings -f \"$ test_file \" 2>&1 < \"$ tmp_post \"" ;
1847
+ $ env ['REQUEST_METHOD ' ] = 'POST ' ;
1848
+ $ env ['CONTENT_TYPE ' ] = 'application/x-www-form-urlencoded ' ;
1849
+ $ env ['CONTENT_LENGTH ' ] = $ content_length ;
1782
1850
1783
- } else if (array_key_exists ('DEFLATE_POST ' , $ section_text ) && !empty ($ section_text ['DEFLATE_POST ' ])) {
1784
- $ post = trim ($ section_text ['DEFLATE_POST ' ]);
1785
- $ post = gzcompress ($ post , 9 );
1786
- $ env ['HTTP_CONTENT_ENCODING ' ] = 'deflate ' ;
1787
- save_text ($ tmp_post , $ post );
1788
- $ content_length = strlen ($ post );
1851
+ $ cmd = "$ php $ pass_options $ ini_settings -f \"$ test_file \" 2>&1 < \"$ tmp_post \"" ;
1789
1852
1790
- $ env ['REQUEST_METHOD ' ] = 'POST ' ;
1791
- $ env ['CONTENT_TYPE ' ] = 'application/x-www-form-urlencoded ' ;
1792
- $ env ['CONTENT_LENGTH ' ] = $ content_length ;
1853
+ } else if (array_key_exists ('DEFLATE_POST ' , $ section_text ) && !empty ($ section_text ['DEFLATE_POST ' ])) {
1854
+ $ post = trim ($ section_text ['DEFLATE_POST ' ]);
1855
+ $ post = gzcompress ($ post , 9 );
1856
+ $ env ['HTTP_CONTENT_ENCODING ' ] = 'deflate ' ;
1857
+ save_text ($ tmp_post , $ post );
1858
+ $ content_length = strlen ($ post );
1793
1859
1794
- $ cmd = "$ php $ pass_options $ ini_settings -f \"$ test_file \" 2>&1 < \"$ tmp_post \"" ;
1860
+ $ env ['REQUEST_METHOD ' ] = 'POST ' ;
1861
+ $ env ['CONTENT_TYPE ' ] = 'application/x-www-form-urlencoded ' ;
1862
+ $ env ['CONTENT_LENGTH ' ] = $ content_length ;
1795
1863
1864
+ $ cmd = "$ php $ pass_options $ ini_settings -f \"$ test_file \" 2>&1 < \"$ tmp_post \"" ;
1796
1865
1797
1866
} else {
1798
1867
0 commit comments