xref: /PHP-7.0/appveyor/test_task.bat (revision 4a39d33e)
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_VC%-%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 user=%PDO_MYSQL_TEST_USER% password=%MYSQL_PW%
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\9.5\bin\createdb.exe" test
41if %errorlevel% neq 0 exit /b 3
42
43rem prepare for ext/openssl
44if "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-Win32 >NUL 2>NUL
45if "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-Win64 >NUL 2>NUL
46mkdir c:\usr\local\ssl
47if %errorlevel% neq 0 exit /b 3
48copy %DEPS_DIR%\template\ssl\openssl.cnf c:\usr\local\ssl
49if %errorlevel% neq 0 exit /b 3
50set OPENSSL_CONF=c:\usr\local\ssl\openssl.cnf
51rem set OPENSSL_CONF=
52rem set SSLEAY_CONF=
53
54rem prepare for Opcache
55if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enabled=1 -d opcache.enable_cli=1
56
57rem prepare for enchant
58mkdir c:\enchant_plugins
59if %errorlevel% neq 0 exit /b 3
60copy %DEPS_DIR%\bin\libenchant_ispell.dll c:\enchant_plugins
61if %errorlevel% neq 0 exit /b 3
62copy %DEPS_DIR%\bin\libenchant_myspell.dll c:\enchant_plugins
63if %errorlevel% neq 0 exit /b 3
64reg add HKEY_CURRENT_USER\SOFTWARE\Enchant\Config /v Module_Dir /t REG_SZ /d c:\enchant_plugins
65if %errorlevel% neq 0 exit /b 3
66set PHP_BUILD_CACHE_ENCHANT_DICT_DIR=%PHP_BUILD_CACHE_BASE_DIR%\enchant_dict
67if not exist "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%" (
68	echo Creating %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%
69	mkdir "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%"
70)
71if not exist "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\en_US.aff" (
72	echo Fetching enchant dicts
73	pushd %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%
74	del /q *
75	powershell -Command wget http://windows.php.net/downloads/qa/appveyor/ext/enchant/dict.zip -OutFile dict.zip
76	unzip dict.zip
77	del /q dict.zip
78	popd
79)
80mkdir %USERPROFILE%\enchant\myspell
81copy %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\* %USERPROFILE%\enchant\myspell
82
83mkdir c:\tests_tmp
84
85cd "%APPVEYOR_BUILD_FOLDER%"
86nmake test TESTS="%OPCACHE_OPTS% -q --offline --show-diff --set-timeout 120 -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP --temp-source c:\tests_tmp --temp-target c:\tests_tmp"
87
88exit /b %errorlevel%
89
90