Skip to content

Commit 344ef05

Browse files
committed
Fix run-tests.php to always include TEST_PHPDBG_EXECUTABLE if phpdbg available
1 parent b73a3af commit 344ef05

File tree

2 files changed

+22
-29
lines changed

2 files changed

+22
-29
lines changed

run-tests.php

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,6 @@
159159
$php_cgi = null;
160160
}
161161
}
162-
163-
if (!getenv('TEST_PHPDBG_EXECUTABLE')) {
164-
$phpdbg = $cwd . '/sapi/phpdbg/phpdbg';
165-
166-
if (file_exists($phpdbg)) {
167-
putenv("TEST_PHPDBG_EXECUTABLE=$phpdbg");
168-
} else {
169-
$phpdbg = null;
170-
}
171-
}
172162
}
173163
$environment['TEST_PHP_EXECUTABLE'] = $php;
174164
}
@@ -184,6 +174,23 @@
184174
$environment['TEST_PHP_CGI_EXECUTABLE'] = $php_cgi;
185175
}
186176

177+
if (!getenv('TEST_PHPDBG_EXECUTABLE')) {
178+
if (!strncasecmp(PHP_OS, "win", 3) && file_exists(dirname($php) . "/phpdbg.exe")) {
179+
$phpdbg = realpath(dirname($php) . "/phpdbg.exe");
180+
} elseif (file_exists(dirname($php) . "/../../sapi/phpdbg/phpdbg")) {
181+
$phpdbg = realpath(dirname($php) . "/../../sapi/phpdbg/phpdbg");
182+
} elseif (file_exists("./sapi/phpdbg/phpdbg")) {
183+
$phpdbg = realpath("./sapi/phpdbg/phpdbg");
184+
} elseif (file_exists(dirname($php) . "/phpdbg")) {
185+
$phpdbg = realpath(dirname($php) . "/phpdbg");
186+
} else {
187+
$phpdbg = null;
188+
}
189+
if ($phpdbg) {
190+
putenv("TEST_PHPDBG_EXECUTABLE=$phpdbg");
191+
}
192+
}
193+
187194
if (getenv('TEST_PHPDBG_EXECUTABLE')) {
188195
$phpdbg = getenv('TEST_PHPDBG_EXECUTABLE');
189196

@@ -1415,26 +1422,12 @@ function run_test($php, $file, $env)
14151422
if (isset($phpdbg)) {
14161423
$old_php = $php;
14171424
$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 ';
14211425
} 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");
1426+
show_result('SKIP', $tested, $tested_file, "reason: phpdbg not available");
14331427

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-
}
1428+
junit_init_suite(junit_get_suitename_for($shortname));
1429+
junit_mark_test_as('SKIP', $shortname, $tested, 0, 'phpdbg not available');
1430+
return 'SKIPPED';
14381431
}
14391432
}
14401433

sapi/phpdbg/tests/bug73615.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Bug #73615 (phpdbg without option never load .phpdbginit at startup)
33
--SKIPIF--
44
<?php
5-
if (!getenv('TEST_PHPDBG_EXECUTABLE')) die("No TEST_PHPDBG_EXECUTABLE specified");
5+
if (!getenv('TEST_PHPDBG_EXECUTABLE')) die("SKIP: No TEST_PHPDBG_EXECUTABLE specified");
66
?>
77
--FILE--
88
<?php

0 commit comments

Comments
 (0)