Commit 26dcc9d0 authored by Christopher Alfeld's avatar Christopher Alfeld
Browse files

Added -exitonfail option which causes tbtest to exit on the first test

failure.
parent b0786167
......@@ -29,6 +29,7 @@ The test directory holds the following files:
tests/<test>/
test.log Main log of everything.
nsfile.ns The NS file used.
db.txt *** The state of the database.
* Any files created by tbsetup stuff.
test.log Master log file. Output of tbtest.
configure.log Log of 'configure'
......@@ -46,6 +47,7 @@ The test directory holds the following files:
* - Appears only in frontend (default) mode.
** - Appears only in full mode.
*** - Only exists for failed tests.
# - Empty except under error conditions.
Note: cleanup.log, unavailable.log, and free.log appear only in full
......@@ -150,6 +152,7 @@ Options:
-path <path> - Path to directory to store test files.
-frontend - Run in frontend mode.
-full - Run in full mode.
-exitonfail - Exit on any failure.
Mode:
run <db> <testdir> [<pid> <eid> <num>]
init <db> [<pid> <eid> <num>]
......@@ -190,6 +193,11 @@ tests.
-single can take a list of tests.
-exitonfail is best used in conjunction with -leavedb. It causes
tbtest to exit on the first test failure, thus no later tests will
corrupt the DB. The user of this option is a matter of taste, as you
can always use tests/<test>/db.txt to restore the database state.
Test Format
-----------
......
......@@ -16,6 +16,7 @@
# -full - Do full testing.
# -frontend - Do frontend only testing.#
# -leavedb - Avoids removing the DB on exit.
# -exitonfail - Exit on the first failure.
#
# <mode> is one of:
# run <db> <testdir> [<pid> <eid> <num>] - Do everything.
......@@ -68,6 +69,7 @@ sub show_help {
print STDERR " -path <path> - Path to directory to store test files.\n";
print STDERR " -frontend - Run in frontend mode.\n";
print STDERR " -full - Run in full mode.\n";
print STDERR " -exitonfail - Exit on any failure.\n";
print STDERR "Mode:\n";
print STDERR " run <db> <testdir> [<pid> <eid> <num>]\n";
print STDERR " init <db> [<pid> <eid> <num>]\n";
......@@ -85,6 +87,7 @@ sub show_help {
$mode = "";
$leavedb = 0;
$exitonfail = 0;
while (($#ARGV > -1) && ($mode eq "")) {
$arg = shift;
......@@ -97,6 +100,8 @@ while (($#ARGV > -1) && ($mode eq "")) {
$type = "full";
} elsif ($arg eq "-leavedb") {
$leavedb = 1;
} elsif ($arg eq "-exitonfail") {
$exitonfail = 1;
} else {
$mode = $arg;
}
......@@ -520,6 +525,7 @@ sub step_test {
if (tbexect("cat $testdir/$test/dbstate | mysql $testdb",TESTLOG)) {
prints "FAIL - Could not evaluate dbstate.\n";
$fail++;
if ($exitonfail) {doexit(1);}
next;
}
}
......@@ -550,6 +556,7 @@ sub step_test {
prints "ERROR: Could not grab copy of database.\n";
doexit(1);
}
if ($exitonfail) {doexit(1);}
} else {
$unknown++;
$status = "UKNONW";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment