diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-18 11:32:05 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-12-18 12:52:54 +0100 |
commit | 7a5cc7aa67388ea44b9157665dba6cc425ec988c (patch) | |
tree | 6d0754acc4a5317da924d223657b11853fc4ebfc | |
parent | 037512cfce6048aae3d3900abb12310e66bc97a5 (diff) | |
download | php-git-7a5cc7aa67388ea44b9157665dba6cc425ec988c.tar.gz |
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.
-rw-r--r-- | azure-pipelines.yml | 4 | ||||
-rw-r--r-- | azure/libmysqlclient_job.yml | 35 | ||||
-rw-r--r-- | azure/libmysqlclient_test.yml | 53 | ||||
-rw-r--r-- | ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt | 15 |
4 files changed, 103 insertions, 4 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7517e58bf2..49840e893c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -108,3 +108,7 @@ jobs: configurationName: DEBUG_NTS_REPEAT configurationParameters: '--enable-debug --disable-zts' runTestsParameters: '--repeat 2' + - template: azure/libmysqlclient_job.yml + parameters: + configurationName: LIBMYSQLCLIENT_DEBUG_NTS + configurationParameters: '--enable-debug --disable-zts' diff --git a/azure/libmysqlclient_job.yml b/azure/libmysqlclient_job.yml new file mode 100644 index 0000000000..72be92780f --- /dev/null +++ b/azure/libmysqlclient_job.yml @@ -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 diff --git a/azure/libmysqlclient_test.yml b/azure/libmysqlclient_test.yml new file mode 100644 index 0000000000..c163345dc4 --- /dev/null +++ b/azure/libmysqlclient_test.yml @@ -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()) diff --git a/ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt b/ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt index 99cd631a4a..55b923be71 100644 --- a/ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt @@ -47,14 +47,21 @@ MySQLPDOTest::skip(); $db = new PDO($uri, $user, $pass); } catch (PDOException $e) { $expected = array( - "SQLSTATE[HY000] [1049] Unknown database 'letshopeinvalid'", - "SQLSTATE[42000] [1049] Unknown database 'letshopeinvalid'", - "SQLSTATE[HY000] [2002] No such file or directory" + "SQLSTATE[HY000] [1049]", + "SQLSTATE[42000] [1049]", + "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", $uri, $dsn, $file, filesize($file), file_get_contents($file), - (in_array($e->getMessage(), $expected) ? 'EXPECTED ERROR' : $e->getMessage())); + ($isExpected ? 'EXPECTED ERROR' : $e->getMessage())); } unlink($file); } |