Added <postcheck> support to the test harness.

This commit is contained in:
Dan Fandrich 2007-04-23 22:58:45 +00:00
parent 37171809f6
commit 28dde78dde
3 changed files with 35 additions and 7 deletions

View File

@ -105,8 +105,8 @@ NOSAVE
- Don't actually save what is received - Don't actually save what is received
SLOWDOWN SLOWDOWN
- Send FTP responses with 0.1 sec delay between each byte - Send FTP responses with 0.1 sec delay between each byte
PASVBADIP - makes PASV send back an illegal IP in its 227 response PASVBADIP
- Send back a bad IP in the PASV response - makes PASV send back an illegal IP in its 227 response
For HTTP/HTTPS: For HTTP/HTTPS:
auth_required - if this is set and a POST/PUT is made without auth, the auth_required - if this is set and a POST/PUT is made without auth, the
@ -173,6 +173,12 @@ output is displayed by the command, the test will be skipped and the
Variables are substituted as in the <command> section. Variables are substituted as in the <command> section.
</precheck> </precheck>
<postcheck>
A command line that if set gets run by the test script after the test. If
the command exists with a non-zero status code, the test will be considered
to have failed. Variables are substituted as in the <command> section.
</postcheck>
<tool> <tool>
Name of tool to use instead of "curl". This tool must be built and exist Name of tool to use instead of "curl". This tool must be built and exist
in the libtest/ directory. in the libtest/ directory.

View File

@ -81,16 +81,18 @@ TEST CASE NUMBERS
So far, I've used this system: So far, I've used this system:
1 - 99 HTTP 1 - 99 HTTP
100 - 199 FTP 100 - 199 FTP*
200 - 299 FILE 200 - 299 FILE*
300 - 399 HTTPS 300 - 399 HTTPS
400 - 499 FTPS 400 - 499 FTPS
500 - 599 libcurl source code tests, not using the curl command tool 500 - 599 libcurl source code tests, not using the curl command tool
600 - 699 SCP/SFTP 600 - 699 SCP/SFTP
700 - 799 miscellanous*
Since 30-apr-2003, there's nothing in the system that requires us to keep Since 30-apr-2003, there's nothing in the system that requires us to keep
within these number series. Each test case now specifies its own server within these number series, and those sections marked with * actually
requirements, independent of test number. contain tests for a variety of protocols. Each test case now specifies
its own server requirements, independent of test number.
TODO: TODO:

View File

@ -1633,6 +1633,7 @@ sub singletest {
my $dumped_core; my $dumped_core;
my $cmdres; my $cmdres;
# Apr 2007: precommand isn't being used and could be removed
my @precommand= getpart("client", "precommand"); my @precommand= getpart("client", "precommand");
if($precommand[0]) { if($precommand[0]) {
# this is pure perl to eval! # this is pure perl to eval!
@ -1654,7 +1655,7 @@ sub singletest {
} }
# run the command line we built # run the command line we built
if ($torture) { if ($torture) {
return torture($CMDLINE, $cmdres = torture($CMDLINE,
"$gdb --directory libtest $DBGCURL -x log/gdbcmd"); "$gdb --directory libtest $DBGCURL -x log/gdbcmd");
} }
elsif($gdbthis) { elsif($gdbthis) {
@ -1692,6 +1693,20 @@ sub singletest {
} }
} }
# run the postcheck command
my @postcheck= getpart("client", "postcheck");
$cmd = $postcheck[0];
chomp $cmd;
subVariables \$cmd;
if($cmd) {
my $rc = system("$cmd");
if($rc != 0) {
logmsg "postcheck failure\n";
return 1;
}
logmsg "postchecked $cmd\n" if($verbose);
}
# remove the special FTP command file after each test! # remove the special FTP command file after each test!
unlink($FTPDCMD); unlink($FTPDCMD);
@ -1700,6 +1715,11 @@ sub singletest {
$ENV{$e}=""; # clean up $ENV{$e}=""; # clean up
} }
# Don't bother doing verification on torture tests
if ($torture) {
return $cmdres;
}
my @err = getpart("verify", "errorcode"); my @err = getpart("verify", "errorcode");
my $errorcode = $err[0] || "0"; my $errorcode = $err[0] || "0";
my $ok=""; my $ok="";