#! /bin/sh # This is slapped together as a quick way to run the tests and # is not meant for prime time. Please hack at it and submit # changes, though, so we can gradually turn it into something # that will run on all platforms (or incorporate it into the # standard mysql-test-run). # All paths below must be relative to $test_data_dir top_builddir=../.. mysql_test_dir=$top_builddir/mysql-test examples=$top_builddir/libmysqld/examples mysqltest=$examples/mysqltest_embedded datadir=$mysql_test_dir/var/master-data test_data_dir=test gdb=0 list=0 run= tests= start= clean=1 cr=" " er="\b\b\b\b\b\b\b\b" usage () { cat <&2 exit 1 fi test -n "$tests" || tests=`/bin/ls -1 "$mysql_test_dir"/t/*.test | grep -v '^.*/rpl[^/]*$' | \ sed -e 's,^.*/,,' -e 's,.test$,,'` echo "cleaning data directory '$datadir/$test_data_dir'" if test $clean = 1 then rm -f $datadir/ib_* $datadir/ibdata* rm -f $datadir/log.00* rm -f $datadir/test/*.db fi rm -f $datadir/../tmp/* rm -f test-gdbinit TZ=GMT-3; export TZ # At least one of the tests needs the following environment variable MYSQL_TEST_DIR=`( cd $mysql_test_dir ; pwd )` ; export MYSQL_TEST_DIR skip=1 test -z "$start" && skip=0 for b in $tests do test $list -eq 1 && { echo " $b"; continue; } test $skip -eq 1 && test -n "$start" && test "$start" = "$b" && skip=0 test $skip -eq 1 && { echo "skipping '$b'"; continue; } t="t/$b.test" r="r/$b.result" # Only test if $t exists; there is no $r for some tests test -f $mysql_test_dir/$t || { echo "test '$mysql_test_dir/$t' doesn't exist" >&2 continue } args="$init_args -v --basedir=$mysql_test_dir/ -R $r -x $t --server-arg=--datadir=$datadir" if test -f "$mysql_test_dir/t/$b-master.opt" ; then args="$args --server-file=t/$b-master.opt" fi args="$args $test_data_dir" # Add database last echo "set args $args$run" > test-gdbinit #if false && test -n "$run" if test -n "$run" -o $gdb -eq 1 then echo -e "$er>>> $b" else echo -e "$er>>> $b> \c" read junk fi if test $gdb -eq 1 then if [ -x "$top_builddir/libtool" ]; then $top_builddir/libtool gdb -x test-gdbinit -q $mysqltest else gdb -x test-gdbinit -q $mysqltest fi res=$? rm -f test-gdbinit else $mysqltest $args res=$? fi test $res -eq 0 -o $res -eq 2 || echo "!!! error: $res" done