2018-02-11 11:33:40 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2018-02-11 12:33:39 +00:00
|
|
|
whoami
|
|
|
|
|
2018-02-27 11:38:19 +00:00
|
|
|
# Clone gh-ost-ci-env
|
|
|
|
# Only clone if not already running locally at latest commit
|
|
|
|
remote_commit=$(git ls-remote https://github.com/github/gh-ost-ci-env.git HEAD | cut -f1)
|
2018-02-27 11:40:46 +00:00
|
|
|
local_commit="unknown"
|
|
|
|
[ -d "gh-ost-ci-env" ] && local_commit=$(cd gh-ost-ci-env && git log --format="%H" -n 1)
|
2018-02-27 11:39:19 +00:00
|
|
|
|
2018-02-27 11:41:54 +00:00
|
|
|
echo "remote commit is: $remote_commit"
|
|
|
|
echo "local commit is: $local_commit"
|
2018-02-27 11:39:19 +00:00
|
|
|
|
2018-02-27 11:38:19 +00:00
|
|
|
if [ "$remote_commit" != "$local_commit" ] ; then
|
|
|
|
rm -rf ./gh-ost-ci-env
|
|
|
|
git clone https://github.com/github/gh-ost-ci-env.git
|
|
|
|
fi
|
2018-02-11 12:05:05 +00:00
|
|
|
|
2018-02-26 12:43:11 +00:00
|
|
|
test_mysql_version() {
|
|
|
|
local mysql_version
|
|
|
|
mysql_version="$1"
|
2018-02-11 12:15:38 +00:00
|
|
|
|
2018-02-26 13:22:57 +00:00
|
|
|
echo "##### Testing $mysql_version"
|
|
|
|
|
|
|
|
echo "### Setting up sandbox for $mysql_version"
|
2018-02-26 12:48:48 +00:00
|
|
|
|
2018-02-26 12:43:11 +00:00
|
|
|
find sandboxes -name "stop_all" | bash
|
2018-02-11 12:05:05 +00:00
|
|
|
|
2018-02-26 12:43:11 +00:00
|
|
|
mkdir -p sandbox/binary
|
|
|
|
rm -rf sandbox/binary/*
|
2018-02-27 11:30:36 +00:00
|
|
|
gh-ost-ci-env/bin/linux/dbdeployer unpack gh-ost-ci-env/mysql-tarballs/"$mysql_version".tar.gz --unpack-version="$mysql_version" --sandbox-binary ${PWD}/sandbox/binary
|
2018-02-11 11:33:40 +00:00
|
|
|
|
2018-02-26 12:43:11 +00:00
|
|
|
mkdir -p sandboxes
|
|
|
|
rm -rf sandboxes/*
|
2018-02-26 13:41:21 +00:00
|
|
|
|
|
|
|
if echo "$mysql_version" | egrep "5[.]5[.]" ; then
|
|
|
|
gtid=""
|
|
|
|
else
|
|
|
|
gtid="--gtid"
|
|
|
|
fi
|
2018-02-27 11:30:36 +00:00
|
|
|
gh-ost-ci-env/bin/linux/dbdeployer deploy replication "$mysql_version" --nodes 2 --sandbox-binary ${PWD}/sandbox/binary --sandbox-home ${PWD}/sandboxes ${gtid} --my-cnf-options log_slave_updates --my-cnf-options log_bin --my-cnf-options binlog_format=ROW --sandbox-directory rsandbox
|
2018-02-11 11:46:27 +00:00
|
|
|
|
2018-02-26 12:43:11 +00:00
|
|
|
sed '/sandboxes/d' -i gh-ost-ci-env/bin/gh-ost-test-mysql-master
|
2018-02-26 13:11:48 +00:00
|
|
|
echo 'sandboxes/rsandbox/m "$@"' >> gh-ost-ci-env/bin/gh-ost-test-mysql-master
|
2018-02-11 11:33:40 +00:00
|
|
|
|
2018-02-26 12:43:11 +00:00
|
|
|
sed '/sandboxes/d' -i gh-ost-ci-env/bin/gh-ost-test-mysql-replica
|
2018-02-26 13:11:48 +00:00
|
|
|
echo 'sandboxes/rsandbox/s1 "$@"' >> gh-ost-ci-env/bin/gh-ost-test-mysql-replica
|
2018-02-11 12:21:38 +00:00
|
|
|
|
2018-02-26 12:43:11 +00:00
|
|
|
export PATH="${PWD}/gh-ost-ci-env/bin/:${PATH}"
|
2018-02-11 12:21:38 +00:00
|
|
|
|
2018-02-26 12:43:11 +00:00
|
|
|
gh-ost-test-mysql-master -uroot -e "grant all on *.* to 'gh-ost'@'%' identified by 'gh-ost'"
|
2018-02-11 12:14:43 +00:00
|
|
|
|
2018-02-26 13:22:57 +00:00
|
|
|
echo "### Running gh-ost tests for $mysql_version"
|
2018-02-26 12:43:11 +00:00
|
|
|
./localtests/test.sh -b bin/gh-ost
|
|
|
|
|
|
|
|
find sandboxes -name "stop_all" | bash
|
|
|
|
}
|
|
|
|
|
2018-02-26 12:48:48 +00:00
|
|
|
echo "Building..."
|
|
|
|
. script/build
|
2018-02-26 12:43:11 +00:00
|
|
|
# Test all versions:
|
2018-02-26 16:46:54 +00:00
|
|
|
find gh-ost-ci-env/mysql-tarballs/ -name "*.tar.gz" | while read f ; do basename $f ".tar.gz" ; done | sort -r | while read mysql_version ; do
|
2018-02-26 12:43:11 +00:00
|
|
|
test_mysql_version "$mysql_version"
|
|
|
|
done
|