3
# Copyright (C) 2001, 2006 MySQL AB
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; version 2 of the License.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
18
# This is slapped together as a quick way to run the tests and
19
# is not meant for prime time. Please hack at it and submit
20
# changes, though, so we can gradually turn it into something
21
# that will run on all platforms (or incorporate it into the
22
# standard mysql-test-run).
24
# All paths below must be relative to $test_data_dir
26
mysql_test_dir=$top_builddir/mysql-test
27
examples=$top_builddir/libmysqld/examples
28
mysqltest=$examples/mysqltest_embedded
29
datadir=$mysql_test_dir/var/master-data
44
usage: $0 [-g|-h|-r] [test-name ...]
46
-C | --noclean Do not remove old innodb and bdb files at start.
47
-g | --gdb run $mysqltest in gdb
48
-h | --help show this help
49
-l | --list ) list all available tests
50
-r | --run automatically 'run' program in gdb
51
-s t | --start=t start with test t (skip all tests before t)
55
init_args="--server-arg=--language=$top_builddir/sql/share/english"
61
--?*=* ) arg=`echo "$1" | sed -e 's,^[^=][^=]*=,,'`; argset=1 ;;
65
-g | --gdb ) gdb=1; shift;;
66
-h | --help | -\? ) usage; exit 0;;
67
-l | --list ) list=1 ; shift ;;
68
-r | --run ) run="${cr}run"; shift;;
69
--debug) init_args="$init_args --debug" ; shift ;;
70
-C | --noclean) clean=0 ; shift ;;
72
test $argset -eq 0 && { shift; arg="$1"; }
77
* ) tests="$tests $1"; shift;;
81
if test ! -d "$datadir/$test_data_dir"
83
echo "bad setup (is '$datadir/$test_data_dir'', missing ?)" >&2
88
tests=`/bin/ls -1 "$mysql_test_dir"/t/*.test | grep -v '^.*/rpl[^/]*$' | \
89
sed -e 's,^.*/,,' -e 's,.test$,,'`
91
echo "cleaning data directory '$datadir/$test_data_dir'"
94
rm -f $datadir/ib_* $datadir/ibdata*
95
rm -f $datadir/log.00*
96
rm -f $datadir/test/*.db
98
rm -f $datadir/../tmp/*
103
# At least one of the tests needs the following environment variable
104
MYSQL_TEST_DIR=`( cd $mysql_test_dir ; pwd )` ; export MYSQL_TEST_DIR
107
test -z "$start" && skip=0
111
test $list -eq 1 && { echo " $b"; continue; }
112
test $skip -eq 1 && test -n "$start" && test "$start" = "$b" && skip=0
113
test $skip -eq 1 && { echo "skipping '$b'"; continue; }
118
# Only test if $t exists; there is no $r for some tests
119
test -f $mysql_test_dir/$t || {
120
echo "test '$mysql_test_dir/$t' doesn't exist" >&2
123
args="$init_args -v --basedir=$mysql_test_dir/ -R $r -x $t --server-arg=--datadir=$datadir"
124
if test -f "$mysql_test_dir/t/$b-master.opt" ; then
125
args="$args --server-file=t/$b-master.opt"
128
args="$args $test_data_dir" # Add database last
129
echo "set args $args$run" > test-gdbinit
130
#if false && test -n "$run"
131
if test -n "$run" -o $gdb -eq 1
135
echo -e "$er>>> $b> \c"
140
if [ -x "$top_builddir/libtool" ]; then
141
$top_builddir/libtool gdb -x test-gdbinit -q $mysqltest
143
gdb -x test-gdbinit -q $mysqltest
152
test $res -eq 0 -o $res -eq 2 || echo "!!! error: $res"