com php-src: generate test ini file, so shared exts are loaded for nmake test: win32/build/Makefile win32/build/config.w32 win32/build/confutils.js
| From: | Anatol Belski | Date: | Sat, 29 Oct 2016 00:08:48 +0000 |
| Subject: | com php-src: generate test ini file, so shared exts are loaded for nmake test: win32/build/Makefile win32/build/config.w32 win32/build/confutils.js | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95329@lists.php.net to get a copy of this message | ||
Commit: 5b04a2187e2b12325b26e289df7f73e03cc4cda2
Author: Anatol Belski <ab@php.net> Sat, 29 Oct 2016 02:08:48 +0200
Parents: f5131c6c041d327fe91755ff93cd1765659e2594
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5b04a2187e2b12325b26e289df7f73e03cc4cda2
Log:
generate test ini file, so shared exts are loaded for nmake test
Changed paths:
M win32/build/Makefile
M win32/build/config.w32
M win32/build/confutils.js
Diff:
diff --git a/win32/build/Makefile b/win32/build/Makefile
index 813d92a..a46dfe4 100644
--- a/win32/build/Makefile
+++ b/win32/build/Makefile
@@ -151,8 +151,13 @@ clean-pgo: clean-all
-del /f /q
$(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip
-del /f /q $(BUILD_DIR)\php-test-pack-$(PHP_VERSION_STRING).zip
+!if $(PHP_TEST_INI_PATH) == ""
test: set-test-env
"$(BUILD_DIR)\php.exe" -d open_basedir= -d output_buffering=0 run-tests.php $(TESTS) -p
"$(BUILD_DIR)\php.exe"
+!else
+test: set-test-env
+ "$(BUILD_DIR)\php.exe" -c $(PHP_TEST_INI_PATH) -d open_basedir= -d output_buffering=0
run-tests.php $(TESTS) -p "$(BUILD_DIR)\php.exe"
+!endif
build-snap: generated_files
SET PATH=$(PATH);$(PHP_BUILD)\bin
diff --git a/win32/build/config.w32 b/win32/build/config.w32
index b7e5e49..56c150b 100644
--- a/win32/build/config.w32
+++ b/win32/build/config.w32
@@ -260,3 +260,9 @@ toolset_setup_codegen_arch();
ARG_WITH("all-shared", "Force all the non obligatory extensions to be shared",
"no");
+ARG_ENABLE("test-ini", "Enable automatic php.ini generation. The test.ini will be
put \
+ into the build dir and used to automatically load the shared extensions.", "yes");
+
+ARG_WITH("test-ini-ext-exclude", "Comma separated list of shared extensions to \
+ be excluded from the test.ini", "no");
+
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
index abbd095..0914621 100644
--- a/win32/build/confutils.js
+++ b/win32/build/confutils.js
@@ -38,6 +38,11 @@ var CLANGVERS = -1;
var INTELVERS = -1;
var COMPILER_NUMERIC_VERSION = -1;
var COMPILER_NAME = "unknown";
+var PHP_OBJECT_OUT_DIR = "";
+
+var PHP_TEST_INI_PATH = "";
+var PHP_TEST_INI = "";
+var PHP_TEST_INI_EXT_EXCLUDE = "";
var WINVER = "0x0600"; /* Vista */
@@ -1739,6 +1744,60 @@ function write_summary()
STDOUT.WriteBlankLines(2);
}
+function is_on_exclude_list_for_test_ini(list, name)
+{
+ for (var i in list) {
+ if (name == list[i]) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+function generate_test_php_ini()
+{
+ if ("no" == PHP_TEST_INI) {
+ /* Test ini generation is disabled. */
+ return;
+ }
+
+ var ini_dir = PHP_OBJECT_OUT_DIR + ("yes" == PHP_DEBUG ? "Debug" :
"Release") + (PHP_ZTS ? "_TS" : "");
+ PHP_TEST_INI_PATH = ini_dir + "\\test.ini";
+
+ if (FSO.FileExists(PHP_TEST_INI_PATH)) {
+ STDOUT.WriteLine("Generating " + PHP_TEST_INI_PATH + " ...");
+ var INI = FSO.OpenTextFile(PHP_TEST_INI_PATH, 2);
+ } else {
+ STDOUT.WriteLine("Regenerating " + PHP_TEST_INI_PATH + " ...");
+ var INI = FSO.CreateTextFile(PHP_TEST_INI_PATH, true);
+ }
+
+ var ext_list = PHP_TEST_INI_EXT_EXCLUDE.split(",");
+ INI.WriteLine("extension_dir=" + ini_dir);
+ for (var i in extensions_enabled) {
+ if ("shared" != extensions_enabled[i][1]) {
+ continue;
+ }
+
+ var directive = "extension";
+ if ("opcache" == extensions_enabled[i][0]) {
+ directive = "zend_extension";
+ }
+
+ var ext_name = extensions_enabled[i][0];
+ if ("gd" == ext_name) {
+ ext_name = "gd2";
+ }
+
+ if (!is_on_exclude_list_for_test_ini(ext_list, ext_name)) {
+ INI.WriteLine(directive + "=php_" + ext_name + ".dll");
+ }
+ }
+
+ INI.Close();;
+}
+
function generate_files()
{
var i, dir, bd, last;
@@ -1773,6 +1832,9 @@ function generate_files()
}
STDOUT..WriteLine("Generating files...");
+ if (!MODE_PHPIZE) {
+ generate_test_php_ini();
+ }
generate_makefile();
if (!MODE_PHPIZE) {
generate_internal_functions();
@@ -2080,6 +2142,12 @@ function generate_makefile()
MF.WriteBlankLines(1);
}
+ if (!MODE_PHPIZE) {
+ var val = "yes" == PHP_TEST_INI ? PHP_TEST_INI_PATH : "";
+ /* Be sure it's done after generate_test_php_ini(). */
+ MF.WriteLine("PHP_TEST_INI_PATH=\"" + val + "\"");
+ }
+
MF.WriteBlankLines(1);
if (MODE_PHPIZE) {
var TF = FSO.OpenTextFile(PHP_DIR + "/script/Makefile.phpize", 1);