summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Baratz <adambaratz@php.net>2021-01-11 21:46:41 -0500
committerAdam Baratz <adambaratz@php.net>2021-01-11 21:46:41 -0500
commitb5696980954007c75ca7fa1627897dfafb3d7fd7 (patch)
tree111fe83ed2a03c3d5a412af3a50682755dac77d7
parent65c789148b72e62d22fb23abaa1e0c97ba74c6da (diff)
downloadphp-git-b5696980954007c75ca7fa1627897dfafb3d7fd7.tar.gz
Add MSSQL setup to Azure Pipelines build
-rw-r--r--azure/apt.yml1
-rw-r--r--azure/configure.yml1
-rw-r--r--azure/coverage_job.yml1
-rw-r--r--azure/file_cache_job.yml1
-rw-r--r--azure/job.yml1
-rw-r--r--azure/mssql.yml5
-rw-r--r--azure/setup.yml1
-rw-r--r--azure/test.yml3
-rw-r--r--ext/pdo/tests/bug_73234.phpt11
-rw-r--r--ext/pdo_dblib/tests/README.md11
-rw-r--r--ext/pdo_dblib/tests/bug_45876.phpt2
-rw-r--r--ext/pdo_dblib/tests/pdo_dblib_param_str_natl.phpt2
-rw-r--r--ext/pdo_dblib/tests/types.phpt2
13 files changed, 38 insertions, 4 deletions
diff --git a/azure/apt.yml b/azure/apt.yml
index 8a28e6bcdb..8c21d1c45f 100644
--- a/azure/apt.yml
+++ b/azure/apt.yml
@@ -40,6 +40,7 @@ steps:
postgresql-contrib \
snmpd \
snmp-mibs-downloader \
+ freetds-dev \
unixodbc-dev \
llvm \
libc-client-dev \
diff --git a/azure/configure.yml b/azure/configure.yml
index 3f5f98f596..2f7b28e15d 100644
--- a/azure/configure.yml
+++ b/azure/configure.yml
@@ -63,6 +63,7 @@ steps:
--with-imap-ssl \
--with-pdo-odbc=unixODBC,/usr \
--with-pdo-firebird \
+ --with-pdo-dblib \
--enable-werror \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d
diff --git a/azure/coverage_job.yml b/azure/coverage_job.yml
index 184ebcfafa..2b8ff10efc 100644
--- a/azure/coverage_job.yml
+++ b/azure/coverage_job.yml
@@ -10,6 +10,7 @@ jobs:
pool:
vmImage: 'ubuntu-18.04'
steps:
+ - template: mssql.yml
- template: apt.yml
- script: |
sudo -H pip install gcovr
diff --git a/azure/file_cache_job.yml b/azure/file_cache_job.yml
index 7c8b392a66..1c5fda3f80 100644
--- a/azure/file_cache_job.yml
+++ b/azure/file_cache_job.yml
@@ -10,6 +10,7 @@ jobs:
pool:
vmImage: 'ubuntu-18.04'
steps:
+ - template: mssql.yml
- template: apt.yml
- template: configure.yml
parameters:
diff --git a/azure/job.yml b/azure/job.yml
index f85744eede..f354c4d717 100644
--- a/azure/job.yml
+++ b/azure/job.yml
@@ -10,6 +10,7 @@ jobs:
pool:
vmImage: 'ubuntu-20.04'
steps:
+ - template: mssql.yml
- template: apt.yml
- template: configure.yml
parameters:
diff --git a/azure/mssql.yml b/azure/mssql.yml
new file mode 100644
index 0000000000..09b2af9617
--- /dev/null
+++ b/azure/mssql.yml
@@ -0,0 +1,5 @@
+# this template should be included close to the beginning, before setup.yml
+# the container needs time to come up or the sqlcmd operation in setup.yml will have a login timeout
+steps:
+ - script: docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=<YourStrong@Passw0rd>" -p 1433:1433 --name sql1 -h sql1 -d mcr.microsoft.com/mssql/server:2019-CU8-ubuntu-16.04
+ displayName: 'Start MSSQL container'
diff --git a/azure/setup.yml b/azure/setup.yml
index 489df88159..21fccd415b 100644
--- a/azure/setup.yml
+++ b/azure/setup.yml
@@ -7,6 +7,7 @@ steps:
mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
sudo -u postgres psql -c "CREATE DATABASE test;"
+ docker exec sql1 /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U SA -P "<YourStrong@Passw0rd>" -Q "create login pdo_test with password='password', check_policy=off; create user pdo_test for login pdo_test; grant alter, control to pdo_test;"
displayName: 'Setup'
- script: ./azure/setup-slapd.sh
displayName: 'Configure slapd'
diff --git a/azure/test.yml b/azure/test.yml
index 4a1f97b734..95fa7b4a09 100644
--- a/azure/test.yml
+++ b/azure/test.yml
@@ -9,6 +9,9 @@ steps:
export PDO_MYSQL_TEST_DSN="mysql:host=localhost;dbname=test"
export PDO_MYSQL_TEST_USER=root
export PDO_MYSQL_TEST_PASS=root
+ export PDO_DBLIB_TEST_DSN="dblib:host=127.0.0.1;dbname=master;version=7.0"
+ export PDO_DBLIB_TEST_USER="pdo_test"
+ export PDO_DBLIB_TEST_PASS="password"
export TEST_PHP_JUNIT=junit.xml
export REPORT_EXIT_STATUS=no
export SKIP_IO_CAPTURE_TESTS=1
diff --git a/ext/pdo/tests/bug_73234.phpt b/ext/pdo/tests/bug_73234.phpt
index 7e708d7424..dddf5c5bf0 100644
--- a/ext/pdo/tests/bug_73234.phpt
+++ b/ext/pdo/tests/bug_73234.phpt
@@ -15,7 +15,16 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
-$db->exec('CREATE TABLE test(id INT)');
+
+switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) {
+ case 'dblib':
+ $sql = 'CREATE TABLE test(id INT NULL)';
+ break;
+ default:
+ $sql = 'CREATE TABLE test(id INT)';
+ break;
+}
+$db->exec($sql);
$stmt = $db->prepare('INSERT INTO test VALUES(:value)');
diff --git a/ext/pdo_dblib/tests/README.md b/ext/pdo_dblib/tests/README.md
new file mode 100644
index 0000000000..3b597d6f57
--- /dev/null
+++ b/ext/pdo_dblib/tests/README.md
@@ -0,0 +1,11 @@
+# The pdo_mysql extension tests
+
+This extension can be tested using Microsoft's Docker image for [SQL Server on Linux](https://hub.docker.com/_/microsoft-mssql-server):
+
+```bash
+docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=<YourStrong@Passw0rd>" -p 1433:1433 --name sql1 -h sql1 -d mcr.microsoft.com/mssql/server:2019-latest
+docker exec sql1 /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U SA -P "<YourStrong@Passw0rd>" -Q "create login pdo_test with password='password', check_policy=off; create user pdo_test for login pdo_test; grant alter, control to pdo_test;"
+
+# and then from the root of php-src
+PDO_DBLIB_TEST_DSN="dblib:host=127.0.0.1;dbname=master;version=7.0" PDO_DBLIB_TEST_USER="pdo_test" PDO_DBLIB_TEST_PASS="password" TESTS=ext/pdo_dblib make test
+```
diff --git a/ext/pdo_dblib/tests/bug_45876.phpt b/ext/pdo_dblib/tests/bug_45876.phpt
index 7328cdc9bb..fb5359f1ee 100644
--- a/ext/pdo_dblib/tests/bug_45876.phpt
+++ b/ext/pdo_dblib/tests/bug_45876.phpt
@@ -31,7 +31,7 @@ array(10) {
["native_usertype_id"]=>
int(%d)
["pdo_type"]=>
- int(2)
+ int(3)
["name"]=>
string(13) "TABLE_CATALOG"
["len"]=>
diff --git a/ext/pdo_dblib/tests/pdo_dblib_param_str_natl.phpt b/ext/pdo_dblib/tests/pdo_dblib_param_str_natl.phpt
index 8e4062e359..3c5e721a11 100644
--- a/ext/pdo_dblib/tests/pdo_dblib_param_str_natl.phpt
+++ b/ext/pdo_dblib/tests/pdo_dblib_param_str_natl.phpt
@@ -23,5 +23,5 @@ Key: Name: [6] :value
paramno=-1
name=[6] ":value"
is_param=1
-param_type=1073741826
+param_type=1073741827
NULL
diff --git a/ext/pdo_dblib/tests/types.phpt b/ext/pdo_dblib/tests/types.phpt
index fa336d9fb4..fb32abd340 100644
--- a/ext/pdo_dblib/tests/types.phpt
+++ b/ext/pdo_dblib/tests/types.phpt
@@ -77,6 +77,6 @@ string(19) "2030-01-01 23:59:59"
string(1) "0"
bool(true)
string(4) "1000"
-string(5) "10.50"
+string(7) "10.5000"
string(19) "1950-01-18 23:00:00"
string(1) "1"