Skip to content

Commit

Permalink
disable test011 if mysql server<5.7.0 and add more hhvm versions to t…
Browse files Browse the repository at this point in the history
…est matrix
  • Loading branch information
ifsnop committed Oct 11, 2018
1 parent 90753c6 commit 4ac8c6e
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 17 deletions.
44 changes: 39 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ matrix:
- sudo mysql -e "use mysql; update user set authentication_string=PASSWORD('') where User='root'; update user set plugin='mysql_native_password';FLUSH PRIVILEGES;"
- sudo mysql_upgrade -u root
- sudo service mysql restart
- php: hhvm-nightly
- php: hhvm-3.21
sudo: required
services:
- mysql
Expand All @@ -205,8 +205,32 @@ matrix:
- sudo mysql -e "use mysql; update user set authentication_string=PASSWORD('') where User='root'; update user set plugin='mysql_native_password';FLUSH PRIVILEGES;"
- sudo mysql_upgrade -u root
- sudo service mysql restart
- php: 5.3
dist: precise
- php: hhvm-3.24
sudo: required
services:
- mysql
before_script:
- curl -s http://getcomposer.org/installer | php
- php composer.phar install
- mysql -V
- mysqldump -V
- tests/create_users.sh
script:
- php -l src/Ifsnop/Mysqldump/Mysqldump.php
- php src/Ifsnop/Mysqldump/Mysqldump.php
- cd tests && ./test.sh
addons:
apt:
sources:
- mysql-5.7-trusty
packages:
- mysql-server
- mysql-client
before_install:
- sudo mysql -e "use mysql; update user set authentication_string=PASSWORD('') where User='root'; update user set plugin='mysql_native_password';FLUSH PRIVILEGES;"
- sudo mysql_upgrade -u root
- sudo service mysql restart
- php: hhvm-nightly
sudo: required
services:
- mysql
Expand All @@ -220,14 +244,25 @@ matrix:
- php -l src/Ifsnop/Mysqldump/Mysqldump.php
- php src/Ifsnop/Mysqldump/Mysqldump.php
- cd tests && ./test.sh
addons:
apt:
sources:
- mysql-5.7-trusty
packages:
- mysql-server
- mysql-client
before_install:
- sudo mysql -e "use mysql; update user set authentication_string=PASSWORD('') where User='root'; update user set plugin='mysql_native_password';FLUSH PRIVILEGES;"
- php: 5.2
- sudo mysql_upgrade -u root
- sudo service mysql restart
- php: 5.3
dist: precise
sudo: required
services:
- mysql
before_script:
- curl -s http://getcomposer.org/installer | php
- php composer.phar install
- mysql -V
- mysqldump -V
- tests/create_users.sh
Expand All @@ -241,4 +276,3 @@ matrix:
- php: nightly
- php: hhvm-nightly
- php: 5.3
- php: 5.2
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,25 @@ and populates a database using all possible datatypes. Then it exports it
using both mysqldump-php and mysqldump, and compares the output. Only if
it is identical tests are OK.

Some tests are skipped if mysql server doesn't support them.

A couple of tests are only compared between original sql code and
mysqldump-php, because mysqldump doesn't work,

## Bugs (from mysqldump, not from mysqldump-php)

After [this](https://bugs.mysql.com/bug.php?id=80150) bug report, a new
one has been introduced. _binary is appended also when hex-blob option is
used, if the value is empty.

## Backporting

mysqldump-php is not backwards compatible with php 5.2 because we it uses
namespaces. It can be trivially fixed.

## TODO

Write more tests.
Write more tests, test with mariadb also.

## Contributing

Expand Down
51 changes: 40 additions & 11 deletions tests/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/bash

major=`mysql -u travis -e "SELECT @@version\G" | grep version |awk '{print $2}' | awk -F"." '{print $1}'`
medium=`mysql -u travis -e "SELECT @@version\G" | grep version |awk '{print $2}' | awk -F"." '{print $2}'`
minor=`mysql -u travis -e "SELECT @@version\G" | grep version |awk '{print $2}' | awk -F"." '{print $3}'`

echo Testing against mysql server version $major.$medium.$minor

function checksum_test001() {
for i in 000 001 002 003 010 011 015 027 029 033 200; do
mysql -utravis -B -e "CHECKSUM TABLE test${i}" test001 | grep -v -i checksum
Expand Down Expand Up @@ -31,7 +37,12 @@ mysql -utravis < test006.src.sql; ret[((index++))]=$?
mysql -utravis < test008.src.sql; ret[((index++))]=$?
mysql -utravis < test009.src.sql; ret[((index++))]=$?
mysql -utravis < test010.src.sql; ret[((index++))]=$?
mysql -utravis < test011.src.sql; ret[((index++))]=$?
if [[ $major -eq 5 && $medium -ge 7 ]]; then
# test virtual column support, with simple inserts forced to complete (a) and complete inserts (b)
mysql -utravis < test011.src.sql; ret[((index++))]=$?
else
echo "test011 disabled, only valid for mysql server version > 5.7.0"
fi
mysql -utravis < test012.src.sql; ret[((index++))]=$?
#mysql -utravis < test013.src.sql; ret[((index++))]=$?

Expand Down Expand Up @@ -110,7 +121,14 @@ cat test002.src.sql | grep ^INSERT > test002.filtered.sql
cat test005.src.sql | grep ^INSERT > test005.filtered.sql
cat test008.src.sql | grep FOREIGN > test008.filtered.sql
cat test010.src.sql | grep CREATE | grep EVENT > test010.filtered.sql
cat test011.src.sql | egrep "INSERT|GENERATED" > test011.filtered.sql

if [[ $major -eq 5 && $medium -ge 7 ]]; then
# test virtual column support, with simple inserts forced to complete (a) and complete inserts (b)
cat test011.src.sql | egrep "INSERT|GENERATED" > test011.filtered.sql
else
echo "test011 disabled, only valid for mysql server version > 5.7.0"
fi

cat mysqldump_test001.sql | grep ^INSERT > mysqldump_test001.filtered.sql
cat mysqldump_test001_complete.sql | grep ^INSERT > mysqldump_test001_complete.filtered.sql
cat mysqldump_test002.sql | grep ^INSERT > mysqldump_test002.filtered.sql
Expand All @@ -123,8 +141,15 @@ cat mysqldump-php_test002.sql | grep ^INSERT > mysqldump-php_test002.filtered.sq
cat mysqldump-php_test005.sql | grep ^INSERT > mysqldump-php_test005.filtered.sql
cat mysqldump-php_test008.sql | grep FOREIGN > mysqldump-php_test008.filtered.sql
cat mysqldump-php_test010.sql | grep CREATE | grep EVENT > mysqldump-php_test010.filtered.sql
cat mysqldump-php_test011a.sql | egrep "INSERT|GENERATED" > mysqldump-php_test011a.filtered.sql
cat mysqldump-php_test011b.sql | egrep "INSERT|GENERATED" > mysqldump-php_test011b.filtered.sql

if [[ $major -eq 5 && $medium -ge 7 ]]; then
# test virtual column support, with simple inserts forced to complete (a) and complete inserts (b)
cat mysqldump-php_test011a.sql | egrep "INSERT|GENERATED" > mysqldump-php_test011a.filtered.sql
cat mysqldump-php_test011b.sql | egrep "INSERT|GENERATED" > mysqldump-php_test011b.filtered.sql
else
echo "test011 disabled, only valid for mysql server version > 5.7.0"
fi

cat mysqldump-php_test012.sql | grep -E -e '50001 (CREATE|VIEW)' -e '50013 DEFINER' -e 'CREATE.*TRIGGER' > mysqldump-php_test012.filtered.sql
cat mysqldump-php_test013.sql | grep INSERT > mysqldump-php_test013.filtered.sql

Expand Down Expand Up @@ -174,13 +199,17 @@ echo test $index diff test010.filtered.sql mysqldump-php_test010.filtered.sql
diff test010.filtered.sql mysqldump-php_test010.filtered.sql
ret[((index++))]=$?

# test virtual column support, with simple inserts forced to complete (a) and complete inserts (b)
echo test $index diff test011.filtered.sql mysqldump-php_test011a.filtered.sql
diff test011.filtered.sql mysqldump-php_test011a.filtered.sql
ret[((index++))]=$?
echo test $index diff test011.filtered.sql mysqldump-php_test011b.filtered.sql
diff test011.filtered.sql mysqldump-php_test011b.filtered.sql
ret[((index++))]=$?
if [[ $major -eq 5 && $medium -ge 7 ]]; then
# test virtual column support, with simple inserts forced to complete (a) and complete inserts (b)
echo test $index diff test011.filtered.sql mysqldump-php_test011a.filtered.sql
diff test011.filtered.sql mysqldump-php_test011a.filtered.sql
ret[((index++))]=$?
echo test $index diff test011.filtered.sql mysqldump-php_test011b.filtered.sql
diff test011.filtered.sql mysqldump-php_test011b.filtered.sql
ret[((index++))]=$?
else
echo test011 disabled, only valid for mysql server version > 5.7.0
fi

# Test create views, events, trigger
echo test $index diff mysqldump_test012.filtered.sql mysqldump-php_test012.filtered.sql
Expand Down

0 comments on commit 4ac8c6e

Please sign in to comment.