1+ @ echo off
2+
13if /i " %GITHUB_ACTIONS% " neq " True" (
24 echo for CI only
35 exit /b 3
46)
57
6- set NO_INTERACTION = 1
7- set REPORT_EXIT_STATUS = 1
8- set SKIP_IO_CAPTURE_TESTS = 1
9-
10- call %~dp0 find-target-branch.bat
11- if " %BRANCH% " neq " master" (
12- set STABILITY = stable
13- ) else (
14- set STABILITY = staging
15- )
16- set DEPS_DIR = %PHP_BUILD_CACHE_BASE_DIR% \deps-%BRANCH% -%PHP_SDK_VS% -%PHP_SDK_ARCH%
17- if not exist " %DEPS_DIR% " (
18- echo " %DEPS_DIR% " doesn't exist
19- exit /b 3
20- )
21-
22- rem setup MySQL related exts
23- set MYSQL_PWD = Password12!
24- set MYSQL_TEST_PASSWD = %MYSQL_PWD%
25- set MYSQL_TEST_USER = root
26- set MYSQL_TEST_HOST = 127.0.0.1
27- set MYSQL_TEST_PORT = 3306
28- set PDO_MYSQL_TEST_USER = %MYSQL_TEST_USER%
29- set PDO_MYSQL_TEST_PASS = %MYSQL_PWD%
30- set PDO_MYSQL_TEST_HOST = %MYSQL_TEST_HOST%
31- set PDO_MYSQL_TEST_PORT = %MYSQL_TEST_PORT%
32- set PDO_MYSQL_TEST_DSN = mysql:host=%PDO_MYSQL_TEST_HOST% ;port=%PDO_MYSQL_TEST_PORT% ;dbname=test
33- mysql --host=%PDO_MYSQL_TEST_HOST% --port=%MYSQL_TEST_PORT% --user=%MYSQL_TEST_USER% --password=%MYSQL_TEST_PASSWD% -e " CREATE DATABASE IF NOT EXISTS test"
34- if %errorlevel% neq 0 exit /b 3
35-
36- rem setup PostgreSQL related exts
37- set PGUSER = postgres
38- set PGPASSWORD = Password12!
39- rem set PGSQL_TEST_CONNSTR=host=127.0.0.1 dbname=test port=5432 user=postgres password=Password12!
40- echo ^ < ?php $conn_str = " host=127.0.0.1 dbname=test port=5432 user=%PGUSER% password=%PGPASSWORD% " ; ?^ > >> " ./ext/pgsql/tests/config.inc"
41- set PDO_PGSQL_TEST_DSN = pgsql:host=127.0.0.1 port=5432 dbname=test user=%PGUSER% password=%PGPASSWORD%
42- set TMP_POSTGRESQL_BIN = %PGBIN%
43- " %TMP_POSTGRESQL_BIN% \createdb.exe" test
44- if %errorlevel% neq 0 exit /b 3
45-
46- rem setup ODBC related exts
47- set ODBC_TEST_USER = sa
48- set ODBC_TEST_PASS = Password12!
49- set ODBC_TEST_DSN = Driver={ODBC Driver 17 for SQL Server};Server=^ (local^ )\SQLEXPRESS;Database=master;uid=%ODBC_TEST_USER% ;pwd=%ODBC_TEST_PASS%
50- set PDOTEST_DSN = odbc:%ODBC_TEST_DSN%
51-
52- rem setup Firebird related exts
53- if " %PLATFORM% " == " x64" (
54- set PHP_FIREBIRD_DOWNLOAD_URL = https://github.com/FirebirdSQL/firebird/releases/download/v4.0.4/Firebird-4.0.4.3010-0-x64.zip
55- ) else (
56- set PHP_FIREBIRD_DOWNLOAD_URL = https://github.com/FirebirdSQL/firebird/releases/download/v4.0.4/Firebird-4.0.4.3010-0-Win32.zip
57- )
58- curl -sLo Firebird.zip %PHP_FIREBIRD_DOWNLOAD_URL%
59- 7z x -oC:\Firebird Firebird.zip
60- set PDO_FIREBIRD_TEST_DATABASE = C:\test.fdb
61- set PDO_FIREBIRD_TEST_DSN = firebird:dbname=127.0.0.1:%PDO_FIREBIRD_TEST_DATABASE%
62- set PDO_FIREBIRD_TEST_USER = SYSDBA
63- set PDO_FIREBIRD_TEST_PASS = phpfi
64- echo create user %PDO_FIREBIRD_TEST_USER% password '%PDO_FIREBIRD_TEST_PASS% ';> C:\Firebird\create_user.sql
65- echo commit;>> C:\Firebird\create_user.sql
66- echo create database '%PDO_FIREBIRD_TEST_DATABASE% ' user '%PDO_FIREBIRD_TEST_USER% ' password '%PDO_FIREBIRD_TEST_PASS% ';> C:\Firebird\setup.sql
67- C:\Firebird\instsvc.exe install -n TestInstance
68- C:\Firebird\isql -q -i C:\Firebird\setup.sql
69- C:\Firebird\isql -q -i C:\Firebird\create_user.sql -user sysdba %PDO_FIREBIRD_TEST_DATABASE%
70- C:\Firebird\instsvc.exe start -n TestInstance
71- if %errorlevel% neq 0 exit /b 3
72- path C:\Firebird;%PATH%
73-
74- rem prepare for ext/openssl
75- rmdir /s /q C:\OpenSSL-Win32 > NUL 2 > NUL
76- rmdir /s /q C:\OpenSSL-Win64 > NUL 2 > NUL
77- if " %PLATFORM% " == " x64" (
78- set OPENSSLDIR = " C:\Program Files\Common Files\SSL"
79- ) else (
80- set OPENSSLDIR = " C:\Program Files (x86)\Common Files\SSL"
81- )
82- if /i " %GITHUB_ACTIONS% " equ " True" (
83- rmdir /s /q %OPENSSLDIR% > nul 2 >& 1
84- )
85- mkdir %OPENSSLDIR%
86- if %errorlevel% neq 0 exit /b 3
87- copy %DEPS_DIR% \template\ssl\openssl.cnf %OPENSSLDIR%
88- if %errorlevel% neq 0 exit /b 3
89- rem set OPENSSL_CONF=%OPENSSLDIR%\openssl.cnf
90- set OPENSSL_CONF =
91- rem set SSLEAY_CONF=
92-
93- rem prepare for OPcache
94- if " %OPCACHE% " equ " 1" set OPCACHE_OPTS = -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=64M -d opcache.jit=tracing
95-
96- rem prepare for enchant
97- mkdir %~d0 \usr\local\lib\enchant-2
98- if %errorlevel% neq 0 exit /b 3
99- copy %DEPS_DIR% \bin\libenchant2_hunspell.dll %~d0 \usr\local\lib\enchant-2
100- if %errorlevel% neq 0 exit /b 3
101- mkdir %~d0 \usr\local\share\enchant\hunspell
102- if %errorlevel% neq 0 exit /b 3
103- echo Fetching enchant dicts
104- pushd %~d0 \usr\local\share\enchant\hunspell
105- powershell -Command wget https://downloads.php.net/~windows/qa/appveyor/ext/enchant/dict.zip -OutFile dict.zip
106- unzip dict.zip
107- del /q dict.zip
108- popd
109-
110- rem prepare for snmp
111- set MIBDIRS = %DEPS_DIR% \share\mibs
112- sed -i " s/exec HexTest .*/exec HexTest cscript\.exe \/nologo %GITHUB_WORKSPACE:\ =\/ % \/ext\/snmp\/tests\/bigtest\.js/g" %GITHUB_WORKSPACE% \ext\snmp\tests\snmpd.conf
113- start %DEPS_DIR% \bin\snmpd.exe -C -c %GITHUB_WORKSPACE% \ext\snmp\tests\snmpd.conf -Ln
8+ echo === True Async Extension Tests ===
1149
115- set PHP_BUILD_DIR = %PHP_BUILD_OBJ_DIR% \Release
116- if " %THREAD_SAFE% " equ " 1 " set PHP_BUILD_DIR = %PHP_BUILD_DIR% _TS
10+ rem Set build directory where PHP was compiled
11+ set PHP_BUILD_DIR = C:\obj\Release_TS
11712
118- rem prepare for mail
119- curl -sLo hMailServer.exe https://www.hmailserver.com/download_file/?downloadid=271
120- hMailServer.exe /verysilent
121- cd %APPVEYOR_BUILD_FOLDER%
122- %PHP_BUILD_DIR% \php.exe -dextension_dir=%PHP_BUILD_DIR% -dextension=com_dotnet .github\setup_hmailserver.php
123-
124- rem prepare for com_dotnet
125- nmake register_comtest
126-
127- mkdir %PHP_BUILD_DIR% \test_file_cache
128- rem generate php.ini
129- echo extension_dir=%PHP_BUILD_DIR% > %PHP_BUILD_DIR% \php.ini
130- echo opcache.file_cache=%PHP_BUILD_DIR% \test_file_cache >> %PHP_BUILD_DIR% \php.ini
131- if " %OPCACHE% " equ " 1" echo zend_extension=php_opcache.dll >> %PHP_BUILD_DIR% \php.ini
132- rem work-around for some spawned PHP processes requiring OpenSSL and sockets
133- echo extension=php_openssl.dll >> %PHP_BUILD_DIR% \php.ini
134- echo extension=php_sockets.dll >> %PHP_BUILD_DIR% \php.ini
135-
136- rem remove ext dlls for which tests are not supported
137- for %%i in (ldap) do (
138- del %PHP_BUILD_DIR% \php_%%i .dll
139- )
140-
141- rem reduce excessive stack reserve for testing
142- editbin /stack:8388608 %PHP_BUILD_DIR% \php.exe
143- editbin /stack:8388608 %PHP_BUILD_DIR% \php-cgi.exe
144-
145- set TEST_PHPDBG_EXECUTABLE = %PHP_BUILD_DIR% \phpdbg.exe
146-
147- copy /-y %DEPS_DIR% \bin\*.dll %PHP_BUILD_DIR% \*
148-
149- if " %ASAN% " equ " 1" set ASAN_OPTS = --asan
150-
151- mkdir c:\tests_tmp
13+ echo Build directory: %PHP_BUILD_DIR%
14+ echo Contents:
15+ dir %PHP_BUILD_DIR% \php*.exe
16+ dir %PHP_BUILD_DIR% \php*.dll
15217
18+ echo .
15319echo Testing PHP executable...
154-
155- echo Trying to run PHP...
156- %PHP_BUILD_DIR% \php.exe --version 2 >& 1
20+ cd /d %PHP_BUILD_DIR%
21+ php.exe --version
15722set PHP_EXIT_CODE = %errorlevel%
158- echo PHP exit code: %PHP_EXIT_CODE%
15923
16024if %PHP_EXIT_CODE% neq 0 (
161- echo PHP failed! Checking what went wrong...
162-
163- echo Checking recent Application Event Log errors...
164- powershell -Command " Get-WinEvent -FilterHashtable @{LogName='Application'; Level=2; StartTime=(Get-Date).AddMinutes(-1)} -MaxEvents 5 -ErrorAction SilentlyContinue | Select-Object TimeCreated, Id, LevelDisplayName, Message"
165-
166- echo Checking DLL dependencies...
167- dumpbin /dependents %PHP_BUILD_DIR% \php.exe
168-
169- exit /b %PHP_EXIT_CODE%
25+ echo ERROR: PHP failed to start (exit code: %PHP_EXIT_CODE% )
26+ echo Checking dependencies:
27+ dumpbin /dependents php.exe | findstr " \.dll"
28+ exit /b 1
17029)
17130
172- echo Running async extension tests...
173- %PHP_BUILD_DIR% \php.exe run-tests.php --no-progress -q --show-diff --temp-source c:\tests_tmp --temp-target c:\tests_tmp ext\async\tests
174-
175- set EXIT_CODE = %errorlevel%
31+ echo .
32+ echo PHP working! Checking if async extension is loaded...
33+ php.exe -m | findstr async
34+ if %errorlevel% neq 0 (
35+ echo WARNING: async extension not found in module list
36+ ) else (
37+ echo SUCCESS: async extension is loaded
38+ )
17639
177- nmake unregister_comtest
178- taskkill /f /im snmpd.exe
40+ echo .
41+ echo Running async extension tests...
42+ if exist ..\ext\async\tests (
43+ php.exe run-tests.php --no-progress --show-diff ..\ext\async\tests
44+ ) else if exist ext\async\tests (
45+ php.exe run-tests.php --no-progress --show-diff ext\async\tests
46+ ) else (
47+ echo ERROR: Cannot find async tests directory
48+ exit /b 1
49+ )
17950
180- exit /b %EXIT_CODE%
51+ set TEST_EXIT_CODE = %errorlevel%
52+ echo .
53+ echo Tests completed with exit code: %TEST_EXIT_CODE%
54+ exit /b %TEST_EXIT_CODE%
0 commit comments