1#!/bin/sh 2 3# Copyright (c) 2003, 2005, 2006 MySQL AB 4# Use is subject to license terms 5# 6# This program is free software; you can redistribute it and/or 7# modify it under the terms of the GNU Library General Public 8# License as published by the Free Software Foundation; version 2 9# of the License. 10# 11# This program is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14# Library General Public License for more details. 15# 16# You should have received a copy of the GNU Library General Public 17# License along with this library; if not, write to the Free 18# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19# MA 02110-1335 USA 20 21if [ ! -x ./ft-test-run.sh ] ; then 22 echo "Usage: ./ft-test-run.sh" 23 exit 1 24fi 25 26BASE=`pwd` 27DATA=$BASE/var 28ROOT=`cd ../..; pwd` 29MYSQLD=$ROOT/sql/mysqld 30MYSQL=$ROOT/client/mysql 31MYSQLADMIN=$ROOT/client/mysqladmin 32SOCK=$DATA/mysql.sock 33PID=$DATA/mysql.pid 34H=../ftdefs.h 35OPTS="--no-defaults --socket=$SOCK --character-sets-dir=$ROOT/sql/share/charsets" 36DELAY=10 37 38stop_myslqd() 39{ 40 [ -S $SOCK ] && $MYSQLADMIN $OPTS shutdown 41 [ -f $PID ] && kill `cat $PID` && sleep 15 && [ -f $PID ] && kill -9 `cat $PID` 42} 43 44if [ ! -d t/BEST ] ; then 45 echo "No ./t/BEST directory! Aborting..." 46 exit 1 47fi 48rm -f t/BEST/report.txt 49if [ -w $H ] ; then 50 echo "$H is writeable! Aborting..." 51 exit 1 52fi 53 54stop_myslqd 55rm -rf var > /dev/null 2>&1 56mkdir var 57mkdir var/test 58 59for batch in t/* ; do 60 [ ! -d $batch ] && continue 61 [ $batch -ef t/BEST -a $batch != t/BEST ] && continue 62 63 rm -rf var/test/* > /dev/null 2>&1 64 rm -f $H 65 if [ -f $BASE/$batch/ftdefs.h ] ; then 66 cat $BASE/$batch/ftdefs.h > $H 67 chmod a-wx $H 68 else 69 bk get -q $H 70 fi 71 OPTS="--defaults-file=$BASE/$batch/my.cnf --socket=$SOCK --character-sets-dir=$ROOT/sql/share/charsets" 72 stop_myslqd 73 rm -f $MYSQLD 74 echo "building $batch" 75 echo "============== $batch ===============" >> var/ft_test.log 76 (cd $ROOT; gmake) >> var/ft_test.log 2>&1 77 78 for prog in $MYSQLD $MYSQL $MYSQLADMIN ; do 79 if [ ! -x $prog ] ; then 80 echo "build failed: no $prog" 81 exit 1 82 fi 83 done 84 85 echo "=====================================" >> var/ft_test.log 86 $MYSQLD $OPTS --basedir=$BASE --pid-file=$PID \ 87 --language=$ROOT/sql/share/english \ 88 --skip-grant-tables --skip-innodb \ 89 --skip-networking --tmpdir=$DATA >> var/ft_test.log 2>&1 & 90 91 sleep $DELAY 92 $MYSQLADMIN $OPTS ping 93 if [ $? != 0 ] ; then 94 echo "$MYSQLD refused to start" 95 exit 1 96 fi 97 for test in `cd data; echo *.r|sed "s/\.r//g"` ; do 98 if [ -f $batch/$test.out ] ; then 99 echo "skipping $batch/$test.out" 100 continue 101 fi 102 echo "testing $batch/$test" 103 FT_MODE=`cat $batch/ft_mode 2>/dev/null` 104 ./Ecreate.pl $test "$FT_MODE" | $MYSQL $OPTS --skip-column-names test >var/$test.eval 105 echo "reporting $batch/$test" 106 ./Ereport.pl var/$test.eval data/$test.r > $batch/$test.out || exit 107 done 108 stop_myslqd 109 rm -f $H 110 bk get -q $H 111 if [ ! $batch -ef t/BEST ] ; then 112 echo "comparing $batch" 113 ./Ecompare.pl t/BEST $batch >> t/BEST/report.txt 114 fi 115done 116 117