com php-src: Fix issues with phpt and EXTENSION on windows (BUG 75042): run-tests.php tests/run-test/bug75042-2.phpt tests/run-test/bug75042-3.phpt
tests/run-test/bug75042.phpt

From: Date: Fri, 18 Aug 2017 23:59:48 +0000
Subject: com php-src: Fix issues with phpt and EXTENSION on windows (BUG 75042): run-tests.php tests/run-test/bug75042-2.phpt tests/run-test/bug75042-3.phpt
tests/run-test/bug75042.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-99098@lists.php.net to get a copy of this message
Commit: 71b12940d0349e58f8719a22e0d4667f19c13dcf Author: John Boehr <jbboehr@gmail.com> Sun, 6 Aug 2017 15:04:36 -0700 Committer: Anatol Belski <ab@php.net> Sat, 19 Aug 2017 01:59:48 +0200 Parents: ba59b6f11bcbeb939359be5c567e877ed16ac8d4 Branches: PHP-7.0 PHP-7.1 PHP-7..2 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=71b12940d0349e58f8719a22e0d4667f19c13dcf Log: Fix issues with phpt and EXTENSION on windows (BUG 75042) * Commands are not properly escaped for windows * Specifying "-n" to check loaded modules causes "Module already loaded" warning * Extensions to be loaded need the "php_" prefix on Windows Bug: https://bugs.php.net/bug.php?id=75042 Add back -n flag to fetch loaded extensions in run-tests.php Add test for phpt EXTENSIONS directive Add a second test for bug 75042 Add test to test loading of nonexistent shared module with the EXTENSIONS phpt block Pass ini settings when checking loaded extensions Fix skipifs Bugs: https://bugs.php.net/75042 Changed paths: M run-tests.php A tests/run-test/bug75042-2.phpt A tests/run-test/bug75042-3.phpt A tests/run-test/bug75042.phpt Diff: diff --git a/run-tests.php b/run-tests.php index f256803..d50e4b7 100755 --- a/run-tests.php +++ b/run-tests.php @@ -1535,15 +1535,19 @@ TEST $file // Additional required extensions if (array_key_exists('EXTENSIONS', $section_text)) { - $ext_dir=$php -r 'echo ini_get("extension_dir");'; + $ext_params = array(); + settings2array($ini_overwrites, $ext_params); + settings2params($ext_params); + $ext_dir=$php $pass_options $ext_params -d display_errors=0 -r "echo ini_get('extension_dir');"; $extensions = preg_split("/[\n\r]+/", trim($section_text['EXTENSIONS'])); - $loaded = explode(",", $php -n -r 'echo join(",", get_loaded_extensions());'); + $loaded = explode(",", $php $pass_options $ext_params -d display_errors=0 -r "echo implode(',', get_loaded_extensions());"); + $ext_prefix = substr(PHP_OS, 0, 3) === "WIN" ? "php_" : ""; foreach ($extensions as $req_ext) { if (!in_array($req_ext, $loaded)) { if ($req_ext == 'opcache') { - $ini_settings['zend_extension'][] = $ext_dir . DIRECTORY_SEPARATOR . $req_ext . '.' . PHP_SHLIB_SUFFIX; + $ini_settings['zend_extension'][] = $ext_dir . DIRECTORY_SEPARATOR . $ext_prefix . $req_ext . '.' . PHP_SHLIB_SUFFIX; } else { - $ini_settings['extension'][] = $ext_dir . DIRECTORY_SEPARATOR . $req_ext . '.' . PHP_SHLIB_SUFFIX; + $ini_settings['extension'][] = $ext_dir . DIRECTORY_SEPARATOR . $ext_prefix . $req_ext . '.' . PHP_SHLIB_SUFFIX; } } } diff --git a/tests/run-test/bug75042-2.phpt b/tests/run-test/bug75042-2.phpt new file mode 100644 index 0000000..25f6d08 --- /dev/null +++ b/tests/run-test/bug75042-2.phpt @@ -0,0 +1,15 @@ +--TEST-- +phpt EXTENSIONS directive with static module +--SKIPIF-- +<?php +$php = getenv('TEST_PHP_EXECUTABLE'); +if (false === stripos($php -n -m, 'spl')) { + die('skip spl is NOT built static'); +} +--EXTENSIONS-- +SPL +--FILE-- +<?php +var_dump(extension_loaded('spl')); +--EXPECT-- +bool(true) diff --git a/tests/run-test/bug75042-3.phpt b/tests/run-test/bug75042-3.phpt new file mode 100644 index 0000000..76ec2b5 --- /dev/null +++ b/tests/run-test/bug75042-3.phpt @@ -0,0 +1,8 @@ +--TEST-- +phpt EXTENSIONS directive with nonexistent shared module +--EXTENSIONS-- +nonexistentsharedmodule +--FILE-- +<?php +--EXPECTF-- +PHP Warning: PHP Startup: Unable to load dynamic library '%snonexistentsharedmodule.%s' %A \ No newline at end of file diff --git a/tests/run-test/bug75042.phpt b/tests/run-test/bug75042.phpt new file mode 100644 index 0000000..001e8f3 --- /dev/null +++ b/tests/run-test/bug75042.phpt @@ -0,0 +1,17 @@ +--TEST-- +phpt EXTENSIONS directive with shared module +--SKIPIF-- +<?php +$php = getenv('TEST_PHP_EXECUTABLE'); +if (false !== stripos($php -n -m, 'openssl')) { + die('skip openssl is built static'); +} +$ext_module = ini_get('extension_dir') . DIRECTORY_SEPARATOR . (substr(PHP_OS, 0, 3) === "WIN" ? "php_openssl." : "openssl.") . PHP_SHLIB_SUFFIX; +if( !file_exists($ext_module) ) die('skip openssl shared extension not found'); +--EXTENSIONS-- +openssl +--FILE-- +<?php +var_dump(extension_loaded('openssl')); +--EXPECT-- +bool(true)

« previous php.cvs (#99098) next »