Skip to content

Commit 7a5cc7a

Browse files
committed
Add basic libmysqlclient CI job
This tests that mysqli and pdo_mysql build against libmysqlclient, and that tests pass for pdo_mysql. mysqli has too many test failures. This is not an officially supported configuration.
1 parent 037512c commit 7a5cc7a

File tree

4 files changed

+103
-4
lines changed

4 files changed

+103
-4
lines changed

azure-pipelines.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,7 @@ jobs:
108108
configurationName: DEBUG_NTS_REPEAT
109109
configurationParameters: '--enable-debug --disable-zts'
110110
runTestsParameters: '--repeat 2'
111+
- template: azure/libmysqlclient_job.yml
112+
parameters:
113+
configurationName: LIBMYSQLCLIENT_DEBUG_NTS
114+
configurationParameters: '--enable-debug --disable-zts'

azure/libmysqlclient_job.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
parameters:
2+
configurationName: ''
3+
configurationParameters: ''
4+
runTestsParameters: ''
5+
timeoutInMinutes: 60
6+
7+
jobs:
8+
- job: ${{ parameters.configurationName }}
9+
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
10+
pool:
11+
vmImage: 'ubuntu-20.04'
12+
steps:
13+
- script: |
14+
sudo apt-get update -y | true
15+
sudo apt install bison re2c
16+
displayName: 'APT'
17+
- script: |
18+
set -o
19+
sudo service mysql start
20+
mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
21+
displayName: 'Setup MySQL server'
22+
# Does not support caching_sha2_auth :(
23+
#- template: libmysqlclient_test.yml
24+
# parameters:
25+
# configurationName: ${{ parameters.configurationName }} - MySQL 5.6.49
26+
# libmysql: mysql-5.6.49-linux-glibc2.12-x86_64.tar.gz
27+
- template: libmysqlclient_test.yml
28+
parameters:
29+
configurationName: ${{ parameters.configurationName }} - MySQL 5.7.31
30+
libmysql: mysql-5.7.31-linux-glibc2.12-x86_64.tar.gz
31+
- template: libmysqlclient_test.yml
32+
parameters:
33+
configurationName: ${{ parameters.configurationName }} - MySQL 8.0.21
34+
libmysql: mysql-8.0.21-linux-glibc2.12-x86_64.tar.xz
35+
configurationParameters: ${{ parameters.configurationParameters }} --enable-werror

azure/libmysqlclient_test.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
parameters:
2+
configurationName: ''
3+
configurationParameters: ''
4+
libmysql: ''
5+
6+
steps:
7+
- script: |
8+
set -e
9+
LIBMYSQL=${{ parameters.libmysql }}
10+
MYSQL_BASE=${LIBMYSQL%%-linux-*}
11+
MYSQL_VERSION=${MYSQL_BASE#*-}
12+
MYSQL_DIR=$HOME/$MYSQL_BASE
13+
mkdir -p $MYSQL_DIR
14+
URL=https://cdn.mysql.com/Downloads/MySQL-${MYSQL_VERSION%.*}/$LIBMYSQL
15+
wget -nv $URL
16+
tar -xf $LIBMYSQL --strip-components=1 -C $MYSQL_DIR
17+
PDO_MYSQL=${MYSQL_DIR}
18+
MYSQLI=${MYSQL_DIR}/bin/mysql_config
19+
./buildconf --force
20+
./configure ${{ parameters.configurationParameters }} \
21+
--enable-option-checking=fatal \
22+
--disable-all \
23+
--enable-pdo \
24+
--with-pdo-mysql=${PDO_MYSQL} \
25+
--with-mysqli=${MYSQLI}
26+
make clean
27+
make -j$(/usr/bin/nproc) >/dev/null
28+
displayName: 'Build ${{ parameters.configurationName }}'
29+
condition: or(succeeded(), failed())
30+
- script: |
31+
export MYSQL_TEST_USER=root
32+
export MYSQL_TEST_PASSWD=root
33+
export PDO_MYSQL_TEST_DSN="mysql:host=127.0.0.1;dbname=test"
34+
export PDO_MYSQL_TEST_HOST=127.0.0.1
35+
export PDO_MYSQL_TEST_USER=root
36+
export PDO_MYSQL_TEST_PASS=root
37+
export TEST_PHP_JUNIT=junit.xml
38+
export REPORT_EXIT_STATUS=no
39+
rm -rf junit.xml | true
40+
sapi/cli/php run-tests.php -P -q \
41+
-g FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP \
42+
--offline --show-diff --show-slow 1000 --set-timeout 120 \
43+
ext/pdo_mysql
44+
displayName: 'Test ${{ parameters.configurationName }}'
45+
condition: or(succeeded(), failed())
46+
- task: PublishTestResults@2
47+
inputs:
48+
testResultsFormat: 'JUnit'
49+
testResultsFiles: junit.xml
50+
testRunTitle: '${{ parameters.configurationName }}'
51+
failTaskOnFailedTests: true
52+
displayName: 'Export ${{ parameters.configurationName }} Results'
53+
condition: or(succeeded(), failed())

ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,21 @@ MySQLPDOTest::skip();
4747
$db = new PDO($uri, $user, $pass);
4848
} catch (PDOException $e) {
4949
$expected = array(
50-
"SQLSTATE[HY000] [1049] Unknown database 'letshopeinvalid'",
51-
"SQLSTATE[42000] [1049] Unknown database 'letshopeinvalid'",
52-
"SQLSTATE[HY000] [2002] No such file or directory"
50+
"SQLSTATE[HY000] [1049]",
51+
"SQLSTATE[42000] [1049]",
52+
"SQLSTATE[HY000] [2002]"
5353
);
54+
$isExpected = false;
55+
foreach ($expected as $prefix) {
56+
if (str_starts_with($e->getMessage(), $prefix)) {
57+
$isExpected = true;
58+
}
59+
}
60+
5461
printf("[003] URI=%s, DSN=%s, File=%s (%d bytes, '%s'), chr(0) test, %s\n",
5562
$uri, $dsn,
5663
$file, filesize($file), file_get_contents($file),
57-
(in_array($e->getMessage(), $expected) ? 'EXPECTED ERROR' : $e->getMessage()));
64+
($isExpected ? 'EXPECTED ERROR' : $e->getMessage()));
5865
}
5966
unlink($file);
6067
}

0 commit comments

Comments
 (0)