diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
commit | 3f619478f796eddbba6e39502fe941b285dd97b1 (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /storage/mroonga/tools/travis | |
parent | Initial commit. (diff) | |
download | mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'storage/mroonga/tools/travis')
-rwxr-xr-x | storage/mroonga/tools/travis/before_script.sh | 95 | ||||
-rwxr-xr-x | storage/mroonga/tools/travis/install.sh | 157 | ||||
-rwxr-xr-x | storage/mroonga/tools/travis/script.sh | 136 |
3 files changed, 388 insertions, 0 deletions
diff --git a/storage/mroonga/tools/travis/before_script.sh b/storage/mroonga/tools/travis/before_script.sh new file mode 100755 index 00000000..a6491d0c --- /dev/null +++ b/storage/mroonga/tools/travis/before_script.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# +# Copyright(C) 2012-2016 Kouhei Sutou <kou@clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +# set -x +set -e + +if [ "${MROONGA_BUNDLED}" = "yes" ]; then + cmake_args=(-DCMAKE_BUILD_TYPE=Debug -DWITH_UNIT_TESTS=FALSE) + cmake_args=("${cmake_args[@]}" -DWITH_EMBEDDED_SERVER=TRUE) + cmake_args=("${cmake_args[@]}" -DWITHOUT_ARCHIVE=TRUE) + cmake_args=("${cmake_args[@]}" -DWITHOUT_BLACKHOLE=TRUE) + cmake_args=("${cmake_args[@]}" -DWITHOUT_CONNECT=TRUE) + cmake_args=("${cmake_args[@]}" -DWITHOUT_CSV=TRUE) + cmake_args=("${cmake_args[@]}" -DWITHOUT_EXAMPLE=TRUE) + cmake_args=("${cmake_args[@]}" -DWITHOUT_FEDERATED=TRUE) + cmake_args=("${cmake_args[@]}" -DWITHOUT_FEDERATEDX=TRUE) + cmake_args=("${cmake_args[@]}" -DWITHOUT_HEAP=TRUE) + cmake_args=("${cmake_args[@]}" -DWITHOUT_MYISAMMRG=TRUE) + cmake_args=("${cmake_args[@]}" -DWITHOUT_OQGRAPH=TRUE) + cmake_args=("${cmake_args[@]}" -DWITHOUT_SEQUENCE=TRUE) + cmake_args=("${cmake_args[@]}" -DWITHOUT_SPHINX=TRUE) + cmake_args=("${cmake_args[@]}" -DWITHOUT_SPIDER=TRUE) + cmake_args=("${cmake_args[@]}" -DWITHOUT_TEST_SQL_DISCOVERY=TRUE) + if [ "${MROONGA_TEST_EMBEDDED}" = "yes" ]; then + cmake_args=("${cmake_args[@]}" -DWITH_EMBEDDED_SERVER=TRUE) + cmake_args=("${cmake_args[@]}" -DMRN_BUILD_FOR_EMBEDDED_SERVER=TRUE) + fi + cmake . "${cmake_args[@]}" +else + ./autogen.sh + + if [ -d /opt/mysql/ ]; then + PATH=$(echo /opt/mysql/server-*/bin/):$PATH + fi + configure_args=("--with-mysql-source=$PWD/vendor/mysql") + case "${MYSQL_VERSION}" in + mysql-5.6) + configure_args=("${configure_args[@]}" --enable-fast-mutexes) + ;; + mysql-5.7) + boost_archive=boost_1_59_0.tar.gz + curl -L -O http://downloads.sourceforge.net/project/boost/boost/1.59.0/${boost_archive} + sudo mkdir -p /usr/global/share + sudo mv ${boost_archive} /usr/global/share/ + (cd vendor/mysql && sudo debian/rules override_dh_auto_configure) + ;; + mariadb-5.5) + (cd vendor/mysql && sudo debian/rules configure) + configure_args=("${configure_args[@]}" + "--with-mysql-build=$PWD/vendor/mysql/builddir") + ;; + percona-server-5.6) + (cd vendor/mysql && \ + sudo debian/rules configure SKIP_DEBUG_BINARY=yes && \ + cd builddir/libservices && \ + sudo make > /dev/null && \ + cd ../extra && \ + sudo make > /dev/null) + configure_args=("${configure_args[@]}" + "--enable-fast-mutexes" + "--with-mysql-build=$PWD/vendor/mysql/builddir" + "--with-mysql-config=$PWD/vendor/mysql/builddir/scripts/mysql_config") + ;; + percona-server-5.7) + (cd vendor/mysql && \ + sudo debian/rules override_dh_auto_configure SKIP_DEBUG_BINARY=yes && \ + cd builddir/libservices && \ + sudo make > /dev/null && \ + cd ../extra && \ + sudo make > /dev/null) + configure_args=("${configure_args[@]}" + "--with-mysql-build=$PWD/vendor/mysql/builddir" + "--with-mysql-config=$PWD/vendor/mysql/builddir/scripts/mysql_config") + ;; + *) + : + ;; + esac + ./configure "${configure_args[@]}" +fi diff --git a/storage/mroonga/tools/travis/install.sh b/storage/mroonga/tools/travis/install.sh new file mode 100755 index 00000000..2c8cdbb8 --- /dev/null +++ b/storage/mroonga/tools/travis/install.sh @@ -0,0 +1,157 @@ +#!/bin/sh +# +# Copyright(C) 2012-2017 Kouhei Sutou <kou@clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +set -x +set -e + +# export GROONGA_MASTER=yes +# export GROONGA_NORMALIZER_MYSQL_MASTER=yes + +#mariadb_download_base=http://mirror.jmu.edu/pub/mariadb +mariadb_download_base=http://ftp.osuosl.org/pub/mariadb + +version=$(echo "$MYSQL_VERSION" | sed -r -e 's/^(mysql|mariadb|percona-server)-//') +series=$(echo "$version" | sed -r -e 's/^([0-9]+\.[0-9]+).*$/\1/g') + +setup_mariadb_apt() +{ + distribution=$(lsb_release --short --id | tr 'A-Z' 'a-z') + code_name=$(lsb_release --short --codename) + component=main + apt_url_base="${mariadb_download_base}/repo/${series}" + cat <<EOF | sudo tee /etc/apt/sources.list.d/mariadb.list +deb ${apt_url_base}/${distribution}/ ${code_name} ${component} +deb-src ${apt_url_base}/${distribution}/ ${code_name} ${component} +EOF + sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db + sudo apt-get -qq update +} + +setup_percona_apt() +{ + code_name=$(lsb_release --short --codename) + release_deb_version=0.1-4 + release_deb=percona-release_${release_deb_version}.${code_name}_all.deb + wget http://www.percona.com/downloads/percona-release/ubuntu/${release_deb_version}/${release_deb} + sudo dpkg -i ${release_deb} + sudo apt-get -qq update +} + +if [ "${MROONGA_BUNDLED}" = "yes" ]; then + mkdir -p .mroonga + mv * .mroonga/ + mv .mroonga/tools ./ + setup_mariadb_apt + sudo apt-get -qq -y build-dep mariadb-server + # Support MariaDB for now. + download_base=${mariadb_download_base}/${MYSQL_VERSION} + tar_gz=${MYSQL_VERSION}.tar.gz + curl -O ${download_base}/source/${tar_gz} + tar xzf $tar_gz + mv ${MYSQL_VERSION}/* ./ + rm -rf storage/mroonga + mv .mroonga storage/mroonga + rm -rf ${MYSQL_VERSION} + git clone --recursive --depth 1 \ + https://github.com/groonga/groonga.git \ + storage/mroonga/vendor/groonga + git clone --recursive --depth 1 \ + https://github.com/groonga/groonga-normalizer-mysql.git \ + storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql +else + curl --silent --location \ + https://raw.githubusercontent.com/groonga/groonga/master/data/travis/setup.sh | sh + curl --silent --location \ + https://raw.githubusercontent.com/groonga/groonga-normalizer-mysql/master/data/travis/setup.sh | sh + # curl --silent --location \ + # https://raw.githubusercontent.com/clear-code/cutter/master/data/travis/setup.sh | sh + + if [ ! -f /usr/lib/groonga/plugins/tokenizers/mecab.so ]; then + sudo apt-get -qq -y install groonga-tokenizer-mecab + fi + + mkdir -p vendor + cd vendor + + case "$MYSQL_VERSION" in + mysql-*) + sudo apt-get -qq update + sudo apt-get -qq -y build-dep mysql-server + if [ "$version" = "system" ]; then + sudo apt-get -y remove --purge \ + mysql-server-5.6 \ + mysql-server-core-5.6 \ + mysql-client-5.6 \ + mysql-client-core-5.6 + sudo rm -rf /var/lib/mysql + sudo apt-get -y install \ + mysql-server \ + mysql-client \ + mysql-testsuite \ + libmysqld-dev + apt-get source mysql-server + ln -s $(find . -maxdepth 1 -type d | sort | tail -1) mysql + else + repository_deb=mysql-apt-config_0.8.3-1_all.deb + curl -O http://repo.mysql.com/${repository_deb} + sudo env MYSQL_SERVER_VERSION=mysql-${series} \ + dpkg -i ${repository_deb} + sudo apt-get -qq update + sudo apt-get -qq -y remove --purge mysql-common + sudo apt-get -qq -y build-dep mysql-server + sudo apt-get -qq -y install \ + mysql-server \ + libmysqlclient-dev \ + libmysqld-dev \ + mysql-testsuite + apt-get -qq source mysql-server + ln -s $(find . -maxdepth 1 -type d | sort | tail -1) mysql + fi + ;; + mariadb-*) + sudo apt-get -y remove --purge \ + mysql-server-5.6 \ + mysql-server-core-5.6 \ + mysql-client-5.6 \ + mysql-client-core-5.6 \ + mysql-common + sudo rm -rf /var/lib/mysql + setup_mariadb_apt + sudo apt-get -qq -y build-dep mariadb-server + sudo apt-get -y install \ + mariadb-server \ + mariadb-client \ + mariadb-test \ + libmariadbclient-dev + apt-get source mariadb-server + ln -s $(find . -maxdepth 1 -type d | sort | tail -1) mysql + ;; + percona-server-*) + setup_percona_apt + sudo apt-get -qq -y build-dep percona-server-server-${series} + sudo apt-get -qq -y install \ + percona-server-server-${series} \ + percona-server-client-${series} \ + percona-server-test-${series} + apt-get -qq source percona-server-server-${series} + ln -s $(find . -maxdepth 1 -type d | sort | tail -1) mysql + ;; + esac + + cd .. +fi diff --git a/storage/mroonga/tools/travis/script.sh b/storage/mroonga/tools/travis/script.sh new file mode 100755 index 00000000..1c0121e0 --- /dev/null +++ b/storage/mroonga/tools/travis/script.sh @@ -0,0 +1,136 @@ +#!/bin/bash +# +# Copyright(C) 2012-2016 Kouhei Sutou <kou@clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +# set -x +set -e + +base_dir="$(cd $(dirname $0); pwd)" +top_dir="${base_dir}/../.." + +bundled_mroonga_dir="${top_dir}/storage/mroonga" +if [ -f "${bundled_mroonga_dir}/config.sh" ]; then + mroonga_dir="${bundled_mroonga_dir}" + . "${bundled_mroonga_dir}/config.sh" +else + mroonga_dir="${top_dir}" + . "${top_dir}/config.sh" +fi + +n_processors="$(grep '^processor' /proc/cpuinfo | wc -l)" +if [ "${MROONGA_BUNDLED}" = "yes" ]; then + max_n_processors=2 +else + max_n_processors=4 +fi +if (( $n_processors > $max_n_processors )); then + n_processors=$max_n_processors +fi + +build() +{ + make -j${n_processors} > /dev/null +} + +run_unit_test() +{ + if [ "${MROONGA_BUNDLED}" != "yes" ]; then + NO_MAKE=yes ${mroonga_dir}/test/run-unit-test.sh + fi +} + +prepare_mysql_test_dir() +{ + mysql_test_dir=/usr/mysql-test + if [ -d /usr/lib/mysql-testsuite/ ]; then + sudo cp -a /usr/lib/mysql-testsuite/ ${mysql_test_dir}/ + elif [ -d /usr/lib/mysql-test/ ]; then + sudo cp -a /usr/lib/mysql-test/ ${mysql_test_dir}/ + elif [ -d /usr/share/mysql/mysql-test/ ]; then + sudo cp -a /usr/share/mysql/mysql-test/ ${mysql_test_dir}/ + elif [ -d /usr/share/mysql-test/ ]; then + sudo cp -a /usr/share/mysql-test/ ${mysql_test_dir}/ + elif [ -d /opt/mysql/ ]; then + mysql_test_dir=$(echo /opt/mysql/server-*/mysql-test) + else + sudo cp -a ${MYSQL_SOURCE_DIR}/mysql-test/ ${mysql_test_dir}/ + fi + sudo chown -R $(id -u):$(id -g) ${mysql_test_dir}/ + + cp -a ${mroonga_dir}/mysql-test/mroonga/ ${mysql_test_dir}/suite/ +} + +collect_test_suite_names() +{ + cd ${mysql_test_dir}/suite/ + test_suite_names="" + for test_suite_name in $(find mroonga -type d '!' -name '[tr]'); do + if [ -n "${test_suite_names}" ]; then + test_suite_names="${test_suite_names}," + fi + test_suite_names="${test_suite_names}${test_suite_name}" + done + cd - +} + +prepare_sql_test() +{ + sudo make install > /dev/null + prepare_mysql_test_dir + collect_test_suite_names +} + +run_sql_test() +{ + test_args=() + if [ "${MROONGA_TEST_EMBEDDED}" = "yes" ]; then + test_args=("${test_args[@]}" "--embedded-server") + fi + if [ "${MROONGA_TEST_PS_PROTOCOL}" = "yes" ]; then + test_args=("${test_args[@]}" "--ps-protocol") + fi + + if [ "${MROONGA_BUNDLED}" = "yes" ]; then + # Plugins aren't supported. + cd ${mroonga_dir}/mysql-test/mroonga/storage + rm -rf alter_table/add_index/token_filters/ + rm -rf alter_table/t/change_token_filter.test + rm -rf create/table/token_filters/ + rm -rf fulltext/token_filters/ + cd - + + ${mroonga_dir}/test/run-sql-test.sh \ + "${test_args[@]}" \ + --parallel="${n_processors}" \ + --retry=3 + else + prepare_sql_test + + cd ${mysql_test_dir}/ + perl ./mysql-test-run.pl \ + "${test_args[@]}" \ + --no-check-testcases \ + --parallel="${n_processors}" \ + --retry=3 \ + --suite="${test_suite_names}" \ + --force + fi +} + +build +# run_unit_test +run_sql_test |