1#!/bin/sh 2 3# Copyright (c) 2010, 2021, Oracle and/or its affiliates. 4# 5# This program is free software; you can redistribute it and/or modify 6# it under the terms of the GNU General Public License, version 2.0, 7# as published by the Free Software Foundation. 8# 9# This program is also distributed with certain software (including 10# but not limited to OpenSSL) that is licensed under separate terms, 11# as designated in a particular file or component or in included license 12# documentation. The authors of MySQL hereby grant you an additional 13# permission to link the program and your derivative works with the 14# separately licensed software that they have included with MySQL. 15# 16# This program is distributed in the hope that it will be useful, 17# but WITHOUT ANY WARRANTY; without even the implied warranty of 18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19# GNU General Public License, version 2.0, for more details. 20# 21# You should have received a copy of the GNU General Public License 22# along with this program; if not, write to the Free Software 23# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 24 25# 26# Use like this in the ATRT test file: 27# 28# max-time: 180 29# cmd: atrt-mysqltest 30# args: --test-file=suite/ndb/t/smoke.test 31# 32set -x 33RUN_DIR=`pwd` 34 35RESULT_FILE="$RUN_DIR/mysqltest.out" 36MYSQL_TEST_DIR=$MYSQL_BASE_DIR/mysql-test 37RUN_LOG="$RUN_DIR/ndb_testrun.log" 38 39# Expected subdirectory by tests written for MTR. 40mkdir -p $RUN_DIR/tmp 41 42$MYSQL_BASE_DIR/bin/ndb_waiter -c $NDB_CONNECTSTRING > $RESULT_FILE 43 44cd $MYSQL_BASE_DIR/mysql-test 45 46NDB_MGM="$MYSQL_BASE_DIR/storage/ndb/src/mgmclient/ndb_mgm" 47if [ -f "$MYSQL_BASE_DIR/bin/ndb_mgm" ]; then 48 NDB_MGM="$MYSQL_BASE_DIR/bin/ndb_mgm" 49fi 50 51NDB_NDBD="$MYSQL_BASE_DIR/bin/ndbd" 52if [ -f "$MYSQL_BASE_DIR/bin/ndbmtd" ]; then 53 NDB_NDBD="$MYSQL_BASE_DIR/bin/ndbmtd" 54fi 55if [ -f "$MYSQL_BASE_DIR/storage/ndb/src/kernel/ndbd" ]; then 56 NDB_NDBD="$MYSQL_BASE_DIR/storage/ndb/src/kernel/ndbd" 57fi 58if [ -f "$MYSQL_BASE_DIR/storage/ndb/src/kernel/ndbmtd" ]; then 59 NDB_NDBD="$MYSQL_BASE_DIR/storage/ndb/src/kernel/ndbmtd" 60fi 61 62NDB_TOOLS_DIR="$MYSQL_BASE_DIR/bin" 63if [ -e "$MYSQL_BASE_DIR/storage/ndb/tools" ]; then 64 NDB_TOOLS_DIR="$MYSQL_BASE_DIR/storage/ndb/tools" 65fi 66 67NDB_EXAMPLES_DIR="$MYSQL_BASE_DIR/bin" 68if [ -e "$MYSQL_BASE_DIR/storage/ndb/ndbapi-examples" ]; then 69 NDB_EXAMPLES_DIR="$MYSQL_BASE_DIR/storage/ndb/ndbapi-examples" 70fi 71 72NDB_EXAMPLES_BINARY="$MYSQL_BASE_DIR/bin/ndbapi_simple" 73if [ -f "$MYSQL_BASE_DIR/storage/ndb/ndbapi-examples/ndbapi_simple/ndbapi_simple" ]; then 74 NDB_EXAMPLES_BINARY="$MYSQL_BASE_DIR/storage/ndb/ndbapi-examples/ndbapi_simple/ndbapi_simple" 75fi 76 77echo "Default group suffix: $MYSQL_GROUP_SUFFIX" 78 79# MYSQL_GROUP_SUFFIX: This is a MySQL client, started as a NDB API client by ATRT. 80NDB_CONNECTSTRING=$NDB_CONNECTSTRING MYSQL_TEST_DIR=$MYSQL_BASE_DIR/mysql-test \ 81NDB_TOOLS_OUTPUT=$RUN_LOG NDB_EXAMPLES_OUTPUT=$RUN_LOG NDB_MGM=$NDB_MGM NDB_NDBD=NDB_NDBD \ 82NDB_TOOLS_DIR=$NDB_TOOLS_DIR NDB_EXAMPLES_DIR=$NDB_EXAMPLES_DIR NDB_EXAMPLES_BINARY=$NDB_EXAMPLES_BINARY \ 83MYSQLTEST_VARDIR=$RUN_DIR MYSQL_GROUP_SUFFIX=.1.4node \ 84 $MYSQL_BASE_DIR/bin/mysqltest --defaults-file=$MYSQL_HOME/my.cnf \ 85 --tmpdir=$RUN_DIR \ 86 --logdir=$RUN_DIR \ 87 --basedir=$MYSQL_BASE_DIR/mysql-test/ \ 88 --ps-protocol \ 89 --tail-lines=20 \ 90 --database=test \ 91 --nowarnings \ 92 --skip-safemalloc $* | tee -a $RESULT_FILE 93 94# Could be added, but would then also need the mtr database: 95# --include=include/mtr_check.sql \ 96# We could also run the bootstrap scripts 97 98echo "Run complete, result code: '$?'" 99 100r=$? 101f=`grep -c '\[ fail \]' $RESULT_FILE` 102o=`grep -c '\[ pass \]' $RESULT_FILE` 103 104if [ ( $r -eq 0 ) -o ( $o -gt 0 -a $f -eq 0 ) ] 105then 106 echo "NDBT_ProgramExit: OK" 107 exit 0 108fi 109 110echo "NDBT_ProgramExit: Failed" 111exit 1 112