xref: /PHP-7.4/appveyor/test_task.bat (revision fb86a176)
1@echo off
2
3set NO_INTERACTION=1
4set REPORT_EXIT_STATUS=1
5set SKIP_IO_CAPTURE_TESTS=1
6
7if /i "%APPVEYOR_REPO_BRANCH:~0,4%" equ "php-" (
8	set BRANCH=%APPVEYOR_REPO_BRANCH:~4,3%
9	set STABILITY=stable
10) else (
11	set BRANCH=master
12	set STABILITY=staging
13)
14set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%BRANCH%-%PHP_SDK_VS%-%PHP_SDK_ARCH%
15if not exist "%DEPS_DIR%" (
16	echo "%DEPS_DIR%" doesn't exist
17	exit /b 3
18)
19
20rem setup MySQL related exts
21set MYSQL_PWD=Password12!
22set MYSQL_TEST_PASSWD=%MYSQL_PWD%
23set MYSQL_TEST_USER=root
24set MYSQL_TEST_HOST=127.0.0.1
25set MYSQL_TEST_PORT=3306
26set PDO_MYSQL_TEST_USER=%MYSQL_TEST_USER%
27set PDO_MYSQL_TEST_PASS=%MYSQL_PWD%
28set PDO_MYSQL_TEST_HOST=%MYSQL_TEST_HOST%
29set PDO_MYSQL_TEST_PORT=%MYSQL_TEST_PORT%
30set PDO_MYSQL_TEST_DSN=mysql:host=%PDO_MYSQL_TEST_HOST%;port=%PDO_MYSQL_TEST_PORT%;dbname=test
31"C:\Program Files\MySql\MySQL Server 5.7\bin\mysql.exe" --user=%MYSQL_TEST_USER% -e "CREATE DATABASE IF NOT EXISTS test"
32if %errorlevel% neq 0 exit /b 3
33
34rem setup PostgreSQL related exts
35set PGUSER=postgres
36set PGPASSWORD=Password12!
37rem set PGSQL_TEST_CONNSTR=host=127.0.0.1 dbname=test port=5432 user=postgres password=Password12!
38echo ^<?php $conn_str = "host=127.0.0.1 dbname=test port=5432 user=%PGUSER% password=%PGPASSWORD%"; ?^> >> "./ext/pgsql/tests/config.inc"
39set PDO_PGSQL_TEST_DSN=pgsql:host=127.0.0.1 port=5432 dbname=test user=%PGUSER% password=%PGPASSWORD%
40"C:\Program Files\PostgreSQL\10\bin\createdb.exe" test
41if %errorlevel% neq 0 exit /b 3
42
43rem setup ODBC related exts
44set ODBC_TEST_USER=sa
45set ODBC_TEST_PASS=Password12!
46set ODBC_TEST_DSN=Driver={ODBC Driver 13 for SQL Server};Server=(local)\SQL2017;Database=master;uid=%ODBC_TEST_USER%;pwd=%ODBC_TEST_PASS%
47set PDOTEST_DSN=odbc:%ODBC_TEST_DSN%
48
49rem prepare for ext/openssl
50if "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-Win32 >NUL 2>NUL
51if "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-Win64 >NUL 2>NUL
52if "%PLATFORM%" == "x64" (
53	set OPENSSLDIR="C:\Program Files\Common Files\SSL"
54) else (
55	set OPENSSLDIR="C:\Program Files (x86)\Common Files\SSL"
56)
57mkdir %OPENSSLDIR%
58if %errorlevel% neq 0 exit /b 3
59copy %DEPS_DIR%\template\ssl\openssl.cnf %OPENSSLDIR%
60if %errorlevel% neq 0 exit /b 3
61rem set OPENSSL_CONF=%OPENSSLDIR%\openssl.cnf
62set OPENSSL_CONF=
63rem set SSLEAY_CONF=
64
65rem prepare for Opcache
66if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1
67
68rem prepare for enchant
69mkdir c:\enchant_plugins
70if %errorlevel% neq 0 exit /b 3
71copy %DEPS_DIR%\bin\libenchant_ispell.dll c:\enchant_plugins
72if %errorlevel% neq 0 exit /b 3
73copy %DEPS_DIR%\bin\libenchant_myspell.dll c:\enchant_plugins
74if %errorlevel% neq 0 exit /b 3
75reg add HKEY_CURRENT_USER\SOFTWARE\Enchant\Config /v Module_Dir /t REG_SZ /d c:\enchant_plugins
76if %errorlevel% neq 0 exit /b 3
77set PHP_BUILD_CACHE_ENCHANT_DICT_DIR=%PHP_BUILD_CACHE_BASE_DIR%\enchant_dict
78if not exist "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%" (
79	echo Creating %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%
80	mkdir "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%"
81)
82if not exist "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\en_US.aff" (
83	echo Fetching enchant dicts
84	pushd %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%
85	del /q *
86	powershell -Command wget http://windows.php.net/downloads/qa/appveyor/ext/enchant/dict.zip -OutFile dict.zip
87	unzip dict.zip
88	del /q dict.zip
89	popd
90)
91mkdir %USERPROFILE%\enchant\myspell
92copy %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\* %USERPROFILE%\enchant\myspell
93
94set TEST_PHPDBG_EXECUTABLE=%PHP_BUILD_OBJ_DIR%\Release
95if "%THREAD_SAFE%" equ "1" set TEST_PHPDBG_EXECUTABLE=%TEST_PHPDBG_EXECUTABLE%_TS
96set TEST_PHPDBG_EXECUTABLE=%TEST_PHPDBG_EXECUTABLE%\phpdbg.exe
97
98mkdir c:\tests_tmp
99
100set TEST_PHP_JUNIT=c:\junit.out.xml
101
102cd "%APPVEYOR_BUILD_FOLDER%"
103nmake test TESTS="%OPCACHE_OPTS% -q --offline --show-diff --show-slow 1000 --set-timeout 120 -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP --temp-source c:\tests_tmp --temp-target c:\tests_tmp %PARALLEL%"
104
105set EXIT_CODE=%errorlevel%
106
107appveyor PushArtifact %TEST_PHP_JUNIT%
108
109exit /b %EXIT_CODE%
110