From f5131c6c041d327fe91755ff93cd1765659e2594 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Fri, 28 Oct 2016 23:11:47 +0200 Subject: additional env is generated for phpize, too --- win32/build/Makefile.phpize | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'win32') diff --git a/win32/build/Makefile.phpize b/win32/build/Makefile.phpize index d3b89c9195..d07ba2fc76 100644 --- a/win32/build/Makefile.phpize +++ b/win32/build/Makefile.phpize @@ -34,7 +34,7 @@ _EXTENSION_DLL=$(PECL_TARGETS) _EXTENSION_DLL=$(EXT_TARGETS) !endif -test: +test: set-test-env "$(PHP_PREFIX)\php.exe" -d open_basedir= -d output_buffering=0 run-tests.php $(TESTS) -p "$(PHP_PREFIX)\php.exe" -d extension=$(BUILD_DIR)\$(_EXTENSION_DLL) !if $(MT) == "" -- cgit v1.2.1 From 5b04a2187e2b12325b26e289df7f73e03cc4cda2 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sat, 29 Oct 2016 02:08:48 +0200 Subject: generate test ini file, so shared exts are loaded for nmake test --- win32/build/Makefile | 5 ++++ win32/build/config.w32 | 6 +++++ win32/build/confutils.js | 68 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) (limited to 'win32') diff --git a/win32/build/Makefile b/win32/build/Makefile index 813d92a086..a46dfe4375 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 b7e5e49220..56c150b974 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 abbd09506e..0914621f3b 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); -- cgit v1.2.1