Add 'timeout' and 'delay' attributes support for the test harness <command> subsection
This commit is contained in:
8
CHANGES
8
CHANGES
@@ -7,9 +7,17 @@
|
|||||||
Changelog
|
Changelog
|
||||||
|
|
||||||
|
|
||||||
|
Yang Tse (25 Apr 2008)
|
||||||
|
- Added 'timeout' and 'delay' attributes support for the test harness
|
||||||
|
<command> subsection.
|
||||||
|
|
||||||
Daniel Fandrich (24 Apr 2008)
|
Daniel Fandrich (24 Apr 2008)
|
||||||
- Made --stderr able to redirect all stderr messages.
|
- Made --stderr able to redirect all stderr messages.
|
||||||
|
|
||||||
|
Yang Tse (23 Apr 2008)
|
||||||
|
- Improve synchronization between test harness runtests.pl script
|
||||||
|
and test harness servers to minimize risk of false test failures.
|
||||||
|
|
||||||
Daniel Fandrich (22 Apr 2008)
|
Daniel Fandrich (22 Apr 2008)
|
||||||
- Added support for running on Symbian OS.
|
- Added support for running on Symbian OS.
|
||||||
|
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ command is run. They are cleared again after the command has been run.
|
|||||||
Variables are first substituted as in the <command> section.
|
Variables are first substituted as in the <command> section.
|
||||||
</setenv>
|
</setenv>
|
||||||
|
|
||||||
<command [option="no-output"]>
|
<command [option="no-output"] [timeout="secs"] [delay="secs"]>
|
||||||
command line to run, there's a bunch of %variables that get replaced
|
command line to run, there's a bunch of %variables that get replaced
|
||||||
accordingly.
|
accordingly.
|
||||||
|
|
||||||
@@ -217,6 +217,19 @@ Set option="no-output" to prevent the test script to slap on the --output
|
|||||||
argument that directs the output to a file. The --output is also not added if
|
argument that directs the output to a file. The --output is also not added if
|
||||||
the verify/stdout section is used.
|
the verify/stdout section is used.
|
||||||
|
|
||||||
|
Set timeout="secs" to override default server logs advisor read lock timeout.
|
||||||
|
This timeout is used by the test harness, once that the command has completed
|
||||||
|
execution, to wait for the test server to write out server side log files and
|
||||||
|
remove the lock that advised not to read them. The "secs" parameter is the not
|
||||||
|
negative integer number of seconds for the timeout. This 'timeout' attribute
|
||||||
|
is documented for completeness sake, but is deep test harness stuff and only
|
||||||
|
needed for very singular and specific test cases. Avoid using it.
|
||||||
|
|
||||||
|
Set delay="secs" to introduce a time delay once that the command has completed
|
||||||
|
execution and before the <postcheck> section runs. The "secs" parameter is the
|
||||||
|
not negative integer number of seconds for the delay. This 'delay' attribute
|
||||||
|
is intended for very specific test cases, and normally not needed.
|
||||||
|
|
||||||
Available substitute variables include:
|
Available substitute variables include:
|
||||||
%CLIENTIP - IPv4 address of the client running curl
|
%CLIENTIP - IPv4 address of the client running curl
|
||||||
%CLIENT6IP - IPv6 address of the client running curl
|
%CLIENT6IP - IPv6 address of the client running curl
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ ftp
|
|||||||
<name>
|
<name>
|
||||||
FTP download with strict timeout and slow CWD
|
FTP download with strict timeout and slow CWD
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command timeout="1">
|
||||||
ftp://%HOSTIP:%FTPPORT/path/to/file/190 -m %FTPTIME2
|
ftp://%HOSTIP:%FTPPORT/path/to/file/190 -m %FTPTIME2
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|||||||
@@ -203,9 +203,8 @@ my $sshdvernum; # for socks server, ssh daemon version number
|
|||||||
my $sshdverstr; # for socks server, ssh daemon version string
|
my $sshdverstr; # for socks server, ssh daemon version string
|
||||||
my $sshderror; # for socks server, ssh daemon version error
|
my $sshderror; # for socks server, ssh daemon version error
|
||||||
|
|
||||||
my $EXP_big_delay = 300;
|
my $defserverlogslocktimeout = 20; # timeout to await server logs lock removal
|
||||||
my $EXP_max_delay = 0;
|
my $defpostcommanddelay = 0; # delay between command and postcheck sections
|
||||||
my $EXP_max_testn = 0;
|
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# variables the command line options may set
|
# variables the command line options may set
|
||||||
@@ -1991,6 +1990,22 @@ sub singletest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $serverlogslocktimeout = $defserverlogslocktimeout;
|
||||||
|
if($cmdhash{'timeout'}) {
|
||||||
|
# test is allowed to override default server logs lock timeout
|
||||||
|
if($cmdhash{'timeout'} =~ /(\d+)/) {
|
||||||
|
$serverlogslocktimeout = $1 if($1 >= 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my $postcommanddelay = $defpostcommanddelay;
|
||||||
|
if($cmdhash{'delay'}) {
|
||||||
|
# test is allowed to specify a delay after command is executed
|
||||||
|
if($cmdhash{'delay'} =~ /(\d+)/) {
|
||||||
|
$postcommanddelay = $1 if($1 > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
my $cmdargs;
|
my $cmdargs;
|
||||||
if(!$tool) {
|
if(!$tool) {
|
||||||
# run curl, add -v for debug information output
|
# run curl, add -v for debug information output
|
||||||
@@ -2106,21 +2121,24 @@ sub singletest {
|
|||||||
# including server request log files used for protocol verification.
|
# including server request log files used for protocol verification.
|
||||||
# So, if the lock file exists the script waits here a certain amount
|
# So, if the lock file exists the script waits here a certain amount
|
||||||
# of time until the server removes it, or the given time expires.
|
# of time until the server removes it, or the given time expires.
|
||||||
|
|
||||||
|
if($serverlogslocktimeout) {
|
||||||
|
my $lockretry = $serverlogslocktimeout * 4;
|
||||||
|
while((-f $SERVERLOGS_LOCK) && $lockretry--) {
|
||||||
|
select(undef, undef, undef, 0.25);
|
||||||
|
}
|
||||||
|
if(($lockretry < 0) &&
|
||||||
|
($serverlogslocktimeout >= $defserverlogslocktimeout)) {
|
||||||
|
logmsg "Warning: server logs lock timeout ",
|
||||||
|
"($serverlogslocktimeout seconds) expired\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Test harness ssh server does not have this synchronization mechanism,
|
# Test harness ssh server does not have this synchronization mechanism,
|
||||||
# this implies that some ssh server based tests might need a small delay
|
# this implies that some ssh server based tests might need a small delay
|
||||||
# in the postcheck section to avoid false test failures.
|
# once that the client command has run to avoid false test failures.
|
||||||
|
|
||||||
my $lockretry = ($testnum == 190) ? 10 : $EXP_big_delay ;
|
sleep($postcommanddelay) if($postcommanddelay);
|
||||||
while((-f $SERVERLOGS_LOCK) && $lockretry--) {
|
|
||||||
sleep(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($testnum != 190) {
|
|
||||||
if($EXP_big_delay - $lockretry > $EXP_max_delay) {
|
|
||||||
$EXP_max_delay = $EXP_big_delay - $lockretry;
|
|
||||||
$EXP_max_testn = $testnum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# run the postcheck command
|
# run the postcheck command
|
||||||
my @postcheck= getpart("client", "postcheck");
|
my @postcheck= getpart("client", "postcheck");
|
||||||
@@ -2224,22 +2242,8 @@ sub singletest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(@protocol) {
|
if(@protocol) {
|
||||||
my @out;
|
# Verify the sent request
|
||||||
my $retry = 5;
|
my @out = loadarray($SERVERIN);
|
||||||
|
|
||||||
# Verify the sent request. Sometimes, like in test 513 on some hosts,
|
|
||||||
# curl will return back faster than the server writes down the request
|
|
||||||
# to its file, so we might need to wait here for a while to see if the
|
|
||||||
# file gets written a bit later.
|
|
||||||
|
|
||||||
while($retry--) {
|
|
||||||
@out = loadarray($SERVERIN);
|
|
||||||
|
|
||||||
if(!$out[0]) {
|
|
||||||
# nothing there yet, wait a while and try again
|
|
||||||
sleep(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# what to cut off from the live protocol sent by curl
|
# what to cut off from the live protocol sent by curl
|
||||||
my @strip = getpart("verify", "strip");
|
my @strip = getpart("verify", "strip");
|
||||||
@@ -3147,8 +3151,6 @@ if($skipped) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logmsg "EXPERIMENTAL: lock max delay ($EXP_max_delay seconds) for test # $EXP_max_testn \n";
|
|
||||||
|
|
||||||
if($total && ($ok != $total)) {
|
if($total && ($ok != $total)) {
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user