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: ...@@ -29,6 +29,7 @@ The test directory holds the following files:
tests/<test>/ tests/<test>/
test.log Main log of everything. test.log Main log of everything.
nsfile.ns The NS file used. nsfile.ns The NS file used.
db.txt *** The state of the database.
* Any files created by tbsetup stuff. * Any files created by tbsetup stuff.
test.log Master log file. Output of tbtest. test.log Master log file. Output of tbtest.
configure.log Log of 'configure' configure.log Log of 'configure'
...@@ -46,6 +47,7 @@ The test directory holds the following files: ...@@ -46,6 +47,7 @@ The test directory holds the following files:
* - Appears only in frontend (default) mode. * - Appears only in frontend (default) mode.
** - Appears only in full mode. ** - Appears only in full mode.
*** - Only exists for failed tests.
# - Empty except under error conditions. # - Empty except under error conditions.
Note: cleanup.log, unavailable.log, and free.log appear only in full Note: cleanup.log, unavailable.log, and free.log appear only in full
...@@ -150,6 +152,7 @@ Options: ...@@ -150,6 +152,7 @@ Options:
-path <path> - Path to directory to store test files. -path <path> - Path to directory to store test files.
-frontend - Run in frontend mode. -frontend - Run in frontend mode.
-full - Run in full mode. -full - Run in full mode.
-exitonfail - Exit on any failure.
Mode: Mode:
run <db> <testdir> [<pid> <eid> <num>] run <db> <testdir> [<pid> <eid> <num>]
init <db> [<pid> <eid> <num>] init <db> [<pid> <eid> <num>]
...@@ -190,6 +193,11 @@ tests. ...@@ -190,6 +193,11 @@ tests.
-single can take a list of 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 Test Format
----------- -----------
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
# -full - Do full testing. # -full - Do full testing.
# -frontend - Do frontend only testing.# # -frontend - Do frontend only testing.#
# -leavedb - Avoids removing the DB on exit. # -leavedb - Avoids removing the DB on exit.
# -exitonfail - Exit on the first failure.
# #
# <mode> is one of: # <mode> is one of:
# run <db> <testdir> [<pid> <eid> <num>] - Do everything. # run <db> <testdir> [<pid> <eid> <num>] - Do everything.
...@@ -68,6 +69,7 @@ sub show_help { ...@@ -68,6 +69,7 @@ sub show_help {
print STDERR " -path <path> - Path to directory to store test files.\n"; print STDERR " -path <path> - Path to directory to store test files.\n";
print STDERR " -frontend - Run in frontend mode.\n"; print STDERR " -frontend - Run in frontend mode.\n";
print STDERR " -full - Run in full mode.\n"; print STDERR " -full - Run in full mode.\n";
print STDERR " -exitonfail - Exit on any failure.\n";
print STDERR "Mode:\n"; print STDERR "Mode:\n";
print STDERR " run <db> <testdir> [<pid> <eid> <num>]\n"; print STDERR " run <db> <testdir> [<pid> <eid> <num>]\n";
print STDERR " init <db> [<pid> <eid> <num>]\n"; print STDERR " init <db> [<pid> <eid> <num>]\n";
...@@ -85,6 +87,7 @@ sub show_help { ...@@ -85,6 +87,7 @@ sub show_help {
$mode = ""; $mode = "";
$leavedb = 0; $leavedb = 0;
$exitonfail = 0;
while (($#ARGV > -1) && ($mode eq "")) { while (($#ARGV > -1) && ($mode eq "")) {
$arg = shift; $arg = shift;
...@@ -97,6 +100,8 @@ while (($#ARGV > -1) && ($mode eq "")) { ...@@ -97,6 +100,8 @@ while (($#ARGV > -1) && ($mode eq "")) {
$type = "full"; $type = "full";
} elsif ($arg eq "-leavedb") { } elsif ($arg eq "-leavedb") {
$leavedb = 1; $leavedb = 1;
} elsif ($arg eq "-exitonfail") {
$exitonfail = 1;
} else { } else {
$mode = $arg; $mode = $arg;
} }
...@@ -520,6 +525,7 @@ sub step_test { ...@@ -520,6 +525,7 @@ sub step_test {
if (tbexect("cat $testdir/$test/dbstate | mysql $testdb",TESTLOG)) { if (tbexect("cat $testdir/$test/dbstate | mysql $testdb",TESTLOG)) {
prints "FAIL - Could not evaluate dbstate.\n"; prints "FAIL - Could not evaluate dbstate.\n";
$fail++; $fail++;
if ($exitonfail) {doexit(1);}
next; next;
} }
} }
...@@ -550,6 +556,7 @@ sub step_test { ...@@ -550,6 +556,7 @@ sub step_test {
prints "ERROR: Could not grab copy of database.\n"; prints "ERROR: Could not grab copy of database.\n";
doexit(1); doexit(1);
} }
if ($exitonfail) {doexit(1);}
} else { } else {
$unknown++; $unknown++;
$status = "UKNONW"; $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