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