|
| 1 | +if /i "%GITHUB_ACTIONS%" neq "True" ( |
| 2 | + echo for CI only |
| 3 | + exit /b 3 |
| 4 | +) |
| 5 | + |
| 6 | +set NO_INTERACTION=1 |
| 7 | +set REPORT_EXIT_STATUS=1 |
| 8 | +set SKIP_IO_CAPTURE_TESTS=1 |
| 9 | + |
| 10 | +call %~dp0find-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 |
| 114 | + |
| 115 | +set PHP_BUILD_DIR=%PHP_BUILD_OBJ_DIR%\Release |
| 116 | +if "%THREAD_SAFE%" equ "1" set PHP_BUILD_DIR=%PHP_BUILD_DIR%_TS |
| 117 | + |
| 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 |
| 152 | + |
| 153 | +nmake test TESTS="%OPCACHE_OPTS% -g FAIL,BORK,LEAK,XLEAK %ASAN_OPTS% --no-progress -q --offline --show-diff --show-slow 1000 --set-timeout 120 --temp-source c:\tests_tmp --temp-target c:\tests_tmp %PARALLEL%" |
| 154 | + |
| 155 | +set EXIT_CODE=%errorlevel% |
| 156 | + |
| 157 | +nmake unregister_comtest |
| 158 | +taskkill /f /im snmpd.exe |
| 159 | + |
| 160 | +exit /b %EXIT_CODE% |
0 commit comments