⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rtest

📁 《嵌入式Linux应用开发详解》中的源代码
💻
字号:
#!/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 + -