Improved the test harness to allow running test servers on other than

the default port numbers, allowing more than one test suite to run
simultaneously on the same host.
This commit is contained in:
Dan Fandrich 2007-04-30 20:15:33 +00:00
parent 1228ec9fbb
commit 5187faeeb9
7 changed files with 44 additions and 8 deletions

View File

@ -6,6 +6,11 @@
Changelog Changelog
Dan F (30 April 2007)
- Improved the test harness to allow running test servers on other than
the default port numbers, allowing more than one test suite to run
simultaneously on the same host.
Daniel S (28 April 2007) Daniel S (28 April 2007)
- Peter O'Gorman fixed libcurl to not init GnuTLS as early as we did before, - Peter O'Gorman fixed libcurl to not init GnuTLS as early as we did before,
since it then inits libgcrypt and libgcrypt is being evil and EXITS the since it then inits libgcrypt and libgcrypt is being evil and EXITS the

View File

@ -265,6 +265,7 @@ advanced. Example: "s/^EPRT .*/EPRT stripped/"
the protocol dump curl should transmit, if 'nonewline' is set, we will cut the protocol dump curl should transmit, if 'nonewline' is set, we will cut
off the trailing newline of this given data before comparing with the one off the trailing newline of this given data before comparing with the one
actually sent by the client actually sent by the client
Variables are substituted as in the <command> section.
</protocol> </protocol>
<stdout [mode="text"]> <stdout [mode="text"]>
This verifies that this data was passed to stdout. This verifies that this data was passed to stdout.

View File

@ -12,7 +12,7 @@ Requires:
stunnel (for HTTPS and FTPS tests) stunnel (for HTTPS and FTPS tests)
sshd (for SCP and SFTP tests; OpenSSH ver. 3.8 is known to work) sshd (for SCP and SFTP tests; OpenSSH ver. 3.8 is known to work)
TCP ports used: TCP ports used by default:
- 8990 on localhost for HTTP tests - 8990 on localhost for HTTP tests
- 8991 on localhost for HTTPS tests - 8991 on localhost for HTTPS tests
@ -27,7 +27,11 @@ TCP ports used:
The test suite runs simple FTP, HTTP and TFTP servers on these ports to The test suite runs simple FTP, HTTP and TFTP servers on these ports to
which it makes requests. For SSL tests, it runs stunnel to handle which it makes requests. For SSL tests, it runs stunnel to handle
encryption to the regular servers. For SSH, it runs a standard OpenSSH encryption to the regular servers. For SSH, it runs a standard OpenSSH
server. server.
The base port number shown above can be changed using runtests' -b option
to allow running more than one instance of the test suite simultaneously
on one machine.
Run: Run:
'make test'. This invokes the 'runtests.pl' perl script. Edit the top 'make test'. This invokes the 'runtests.pl' perl script. Edit the top

View File

@ -26,6 +26,11 @@ HTTP, urlglob retrieval with bad range
<command option="no-output"> <command option="no-output">
"http://%HOSTIP:%HTTPPORT/[2-1]" -o "log/weee#1.dump" --stderr - "http://%HOSTIP:%HTTPPORT/[2-1]" -o "log/weee#1.dump" --stderr -
</command> </command>
# The error message on stdout implicitly depends on the length of the
# URL, so refuse to run if the length is unexpected.
<precheck>
perl %SRCDIR/libtest/test75.pl http://%HOSTIP:%HTTPPORT/ 22
</precheck>
</client> </client>
# #

View File

@ -35,7 +35,7 @@ INCLUDES = -I$(top_srcdir)/include/curl \
LIBDIR = $(top_builddir)/lib LIBDIR = $(top_builddir)/lib
EXTRA_DIST = test307.pl EXTRA_DIST = test75.pl test307.pl test610.pl
# files used only in some libcurl test programs # files used only in some libcurl test programs
TESTUTIL = testutil.c testutil.h TESTUTIL = testutil.c testutil.h

13
tests/libtest/test75.pl Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env perl
# Check that the length of a given URL is correct
if ( $#ARGV != 1 )
{
print "Usage: $0 string length\n";
exit 3;
}
if (length(@ARGV[0]) != @ARGV[1])
{
print "Given host IP and port not supported\n";
exit 1;
}
exit 0;

View File

@ -2253,6 +2253,12 @@ do {
# verbose output # verbose output
$verbose=1; $verbose=1;
} }
elsif($ARGV[0] =~ /^-b(.*)/) {
my $portno=$1;
if($portno =~ s/(\d+)$//) {
$base = int $1;
}
}
elsif ($ARGV[0] eq "-c") { elsif ($ARGV[0] eq "-c") {
# use this path to curl instead of default # use this path to curl instead of default
$DBGCURL=$CURL=$ARGV[1]; $DBGCURL=$CURL=$ARGV[1];
@ -2309,20 +2315,22 @@ do {
elsif($ARGV[0] eq "-h") { elsif($ARGV[0] eq "-h") {
# show help text # show help text
print <<EOHELP print <<EOHELP
Usage: runtests.pl [options] Usage: runtests.pl [options] [test number(s)]
-a continue even if a test fails -a continue even if a test fails
-bN use base port number N for test servers (default $base)
-c path use this curl executable
-d display server debug info -d display server debug info
-g run the test case with gdb -g run the test case with gdb
-h this help text -h this help text
-k keep stdout and stderr files present after tests -k keep stdout and stderr files present after tests
-l list all test case names/descriptions -l list all test case names/descriptions
-n No valgrind -n no valgrind
-p Print log file contents when a test fails -p print log file contents when a test fails
-s short output -s short output
-t torture -t[N] torture (simulate memory alloc failures); N means fail Nth alloc
-v verbose output -v verbose output
[num] like "5 6 9" or " 5 to 22 " to run those tests only [num] like "5 6 9" or " 5 to 22 " to run those tests only
![num] like "!5 !6 !9" to disable those tests [!num] like "!5 !6 !9" to disable those tests
EOHELP EOHELP
; ;
exit; exit;