mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
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.
This commit is contained in:
parent
037512cfce
commit
7a5cc7aa67
4 changed files with 103 additions and 4 deletions
|
@ -108,3 +108,7 @@ jobs:
|
||||||
configurationName: DEBUG_NTS_REPEAT
|
configurationName: DEBUG_NTS_REPEAT
|
||||||
configurationParameters: '--enable-debug --disable-zts'
|
configurationParameters: '--enable-debug --disable-zts'
|
||||||
runTestsParameters: '--repeat 2'
|
runTestsParameters: '--repeat 2'
|
||||||
|
- template: azure/libmysqlclient_job.yml
|
||||||
|
parameters:
|
||||||
|
configurationName: LIBMYSQLCLIENT_DEBUG_NTS
|
||||||
|
configurationParameters: '--enable-debug --disable-zts'
|
||||||
|
|
35
azure/libmysqlclient_job.yml
Normal file
35
azure/libmysqlclient_job.yml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
parameters:
|
||||||
|
configurationName: ''
|
||||||
|
configurationParameters: ''
|
||||||
|
runTestsParameters: ''
|
||||||
|
timeoutInMinutes: 60
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
- job: ${{ parameters.configurationName }}
|
||||||
|
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
|
||||||
|
pool:
|
||||||
|
vmImage: 'ubuntu-20.04'
|
||||||
|
steps:
|
||||||
|
- script: |
|
||||||
|
sudo apt-get update -y | true
|
||||||
|
sudo apt install bison re2c
|
||||||
|
displayName: 'APT'
|
||||||
|
- script: |
|
||||||
|
set -o
|
||||||
|
sudo service mysql start
|
||||||
|
mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
|
||||||
|
displayName: 'Setup MySQL server'
|
||||||
|
# Does not support caching_sha2_auth :(
|
||||||
|
#- template: libmysqlclient_test.yml
|
||||||
|
# parameters:
|
||||||
|
# configurationName: ${{ parameters.configurationName }} - MySQL 5.6.49
|
||||||
|
# libmysql: mysql-5.6.49-linux-glibc2.12-x86_64.tar.gz
|
||||||
|
- template: libmysqlclient_test.yml
|
||||||
|
parameters:
|
||||||
|
configurationName: ${{ parameters.configurationName }} - MySQL 5.7.31
|
||||||
|
libmysql: mysql-5.7.31-linux-glibc2.12-x86_64.tar.gz
|
||||||
|
- template: libmysqlclient_test.yml
|
||||||
|
parameters:
|
||||||
|
configurationName: ${{ parameters.configurationName }} - MySQL 8.0.21
|
||||||
|
libmysql: mysql-8.0.21-linux-glibc2.12-x86_64.tar.xz
|
||||||
|
configurationParameters: ${{ parameters.configurationParameters }} --enable-werror
|
53
azure/libmysqlclient_test.yml
Normal file
53
azure/libmysqlclient_test.yml
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
parameters:
|
||||||
|
configurationName: ''
|
||||||
|
configurationParameters: ''
|
||||||
|
libmysql: ''
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- script: |
|
||||||
|
set -e
|
||||||
|
LIBMYSQL=${{ parameters.libmysql }}
|
||||||
|
MYSQL_BASE=${LIBMYSQL%%-linux-*}
|
||||||
|
MYSQL_VERSION=${MYSQL_BASE#*-}
|
||||||
|
MYSQL_DIR=$HOME/$MYSQL_BASE
|
||||||
|
mkdir -p $MYSQL_DIR
|
||||||
|
URL=https://cdn.mysql.com/Downloads/MySQL-${MYSQL_VERSION%.*}/$LIBMYSQL
|
||||||
|
wget -nv $URL
|
||||||
|
tar -xf $LIBMYSQL --strip-components=1 -C $MYSQL_DIR
|
||||||
|
PDO_MYSQL=${MYSQL_DIR}
|
||||||
|
MYSQLI=${MYSQL_DIR}/bin/mysql_config
|
||||||
|
./buildconf --force
|
||||||
|
./configure ${{ parameters.configurationParameters }} \
|
||||||
|
--enable-option-checking=fatal \
|
||||||
|
--disable-all \
|
||||||
|
--enable-pdo \
|
||||||
|
--with-pdo-mysql=${PDO_MYSQL} \
|
||||||
|
--with-mysqli=${MYSQLI}
|
||||||
|
make clean
|
||||||
|
make -j$(/usr/bin/nproc) >/dev/null
|
||||||
|
displayName: 'Build ${{ parameters.configurationName }}'
|
||||||
|
condition: or(succeeded(), failed())
|
||||||
|
- script: |
|
||||||
|
export MYSQL_TEST_USER=root
|
||||||
|
export MYSQL_TEST_PASSWD=root
|
||||||
|
export PDO_MYSQL_TEST_DSN="mysql:host=127.0.0.1;dbname=test"
|
||||||
|
export PDO_MYSQL_TEST_HOST=127.0.0.1
|
||||||
|
export PDO_MYSQL_TEST_USER=root
|
||||||
|
export PDO_MYSQL_TEST_PASS=root
|
||||||
|
export TEST_PHP_JUNIT=junit.xml
|
||||||
|
export REPORT_EXIT_STATUS=no
|
||||||
|
rm -rf junit.xml | true
|
||||||
|
sapi/cli/php run-tests.php -P -q \
|
||||||
|
-g FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP \
|
||||||
|
--offline --show-diff --show-slow 1000 --set-timeout 120 \
|
||||||
|
ext/pdo_mysql
|
||||||
|
displayName: 'Test ${{ parameters.configurationName }}'
|
||||||
|
condition: or(succeeded(), failed())
|
||||||
|
- task: PublishTestResults@2
|
||||||
|
inputs:
|
||||||
|
testResultsFormat: 'JUnit'
|
||||||
|
testResultsFiles: junit.xml
|
||||||
|
testRunTitle: '${{ parameters.configurationName }}'
|
||||||
|
failTaskOnFailedTests: true
|
||||||
|
displayName: 'Export ${{ parameters.configurationName }} Results'
|
||||||
|
condition: or(succeeded(), failed())
|
|
@ -47,14 +47,21 @@ MySQLPDOTest::skip();
|
||||||
$db = new PDO($uri, $user, $pass);
|
$db = new PDO($uri, $user, $pass);
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
$expected = array(
|
$expected = array(
|
||||||
"SQLSTATE[HY000] [1049] Unknown database 'letshopeinvalid'",
|
"SQLSTATE[HY000] [1049]",
|
||||||
"SQLSTATE[42000] [1049] Unknown database 'letshopeinvalid'",
|
"SQLSTATE[42000] [1049]",
|
||||||
"SQLSTATE[HY000] [2002] No such file or directory"
|
"SQLSTATE[HY000] [2002]"
|
||||||
);
|
);
|
||||||
|
$isExpected = false;
|
||||||
|
foreach ($expected as $prefix) {
|
||||||
|
if (str_starts_with($e->getMessage(), $prefix)) {
|
||||||
|
$isExpected = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
printf("[003] URI=%s, DSN=%s, File=%s (%d bytes, '%s'), chr(0) test, %s\n",
|
printf("[003] URI=%s, DSN=%s, File=%s (%d bytes, '%s'), chr(0) test, %s\n",
|
||||||
$uri, $dsn,
|
$uri, $dsn,
|
||||||
$file, filesize($file), file_get_contents($file),
|
$file, filesize($file), file_get_contents($file),
|
||||||
(in_array($e->getMessage(), $expected) ? 'EXPECTED ERROR' : $e->getMessage()));
|
($isExpected ? 'EXPECTED ERROR' : $e->getMessage()));
|
||||||
}
|
}
|
||||||
unlink($file);
|
unlink($file);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue