?? rtest
字號:
#!/bin/sh# # Regression tester for mSQL.## This script just drives the individual tests in the rtest.src# directory. Run it as "rtest <db>" where db is the name of a database.# The database will be created and destroyed during the testing so don't# use anything that already exists (the scripts wont let you anyway).## bambi.# If you want to do the testing on a machine other than the local box# (or you want to force a TCP connection) set the variable below to the# hostname of the box running the server##MSQLHOST="-h fawn"## Use a fresh DB ?FRESH=Y# Do not uncomment this variable. It is used to reset the test results# after a major change to the test suite or output format of msql#RESET=1DB=$1if test "$DB." = "."then echo echo "Bad usage. Read the intro to the script for details!" echo exit 1fi## Where are the programs we need##MSQLADMIN="/usr/local/Hughes/bin/msqladmin"MSQLADMIN="../../msqladmin/msqladmin"#MSQL="/usr/local/Hughes/bin/msql $MSQLHOST"MSQL="../../msql/msql"## How can we echo without a newline?#if echo '\c' | grep -s c >/dev/null 2>&1then ECHO_N="echo -n" ECHO_C=""else ECHO_N="echo" ECHO_C='\c'fi## Find out the names of the tests#cd rtest.srcTESTS=`ls [0-9]*.test | sort -n | sed "s/\.test\$//"`rm -f *.resCOUNT=0## Setup a clean database#if test ".$FRESH" = ".Y"then $MSQLADMIN -q drop $DB > /dev/null $MSQLADMIN create $DB if test $? -ne 0 then echo echo echo "Couldn't setup new database for testing." echo exit 1 fifi## Run through the tests and bail out if there's an error.#total_q=0echoif test "$RESET." = "."then echo "Starting tests."else echo "Starting tests in reset mode"fifor I in $TESTSdo $ECHO_N "Running test $I.$ECHO_C" if test "$RESET." = "." then #$MSQL $MSQHOST $DB < $I.test > $I.res 2>&1 $MSQL $MSQHOST $DB < $I.test > $I.res diff $I.out $I.res > /dev/null if test $? -ne 0 then echo " FAILED !!!" echo echo echo "ERROR : Regression test failed on test \"$I\"." echo "Test results have been saved in rtest.src/*.res" echo exit 1 fi num_q=`grep "\\g" $I.test | wc -l` echo " Passed. All $num_q queries ran correctly." total_q=`expr $total_q + $num_q` else echo $MSQL $MSQHOST $DB < $I.test > $I.out 2>&1 fi COUNT=`expr $COUNT + 1`doneechoechoecho "All $COUNT tests have passed. $total_q queries executed."echo "Results of the individual tests can be found in rtest.src/*.res"echoexit 0
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -