From 5187faeeb97321343cd0a1f3ad9aa10992513e99 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Mon, 30 Apr 2007 20:15:33 +0000 Subject: [PATCH] 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. --- CHANGES | 5 +++++ tests/FILEFORMAT | 1 + tests/README | 8 ++++++-- tests/data/test75 | 5 +++++ tests/libtest/Makefile.am | 2 +- tests/libtest/test75.pl | 13 +++++++++++++ tests/runtests.pl | 18 +++++++++++++----- 7 files changed, 44 insertions(+), 8 deletions(-) create mode 100755 tests/libtest/test75.pl diff --git a/CHANGES b/CHANGES index 4130e21eb..54514b2df 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,11 @@ 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) - 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 diff --git a/tests/FILEFORMAT b/tests/FILEFORMAT index d0cb8b44e..3264ef5f7 100644 --- a/tests/FILEFORMAT +++ b/tests/FILEFORMAT @@ -265,6 +265,7 @@ advanced. Example: "s/^EPRT .*/EPRT stripped/" 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 actually sent by the client +Variables are substituted as in the section. This verifies that this data was passed to stdout. diff --git a/tests/README b/tests/README index 56ebab952..8eaeee21f 100644 --- a/tests/README +++ b/tests/README @@ -12,7 +12,7 @@ Requires: stunnel (for HTTPS and FTPS tests) 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 - 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 which it makes requests. For SSL tests, it runs stunnel to handle 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: 'make test'. This invokes the 'runtests.pl' perl script. Edit the top diff --git a/tests/data/test75 b/tests/data/test75 index f0309e8f4..63695f500 100644 --- a/tests/data/test75 +++ b/tests/data/test75 @@ -26,6 +26,11 @@ HTTP, urlglob retrieval with bad range "http://%HOSTIP:%HTTPPORT/[2-1]" -o "log/weee#1.dump" --stderr - +# The error message on stdout implicitly depends on the length of the +# URL, so refuse to run if the length is unexpected. + +perl %SRCDIR/libtest/test75.pl http://%HOSTIP:%HTTPPORT/ 22 + # diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am index 35709b8ec..276ec85eb 100644 --- a/tests/libtest/Makefile.am +++ b/tests/libtest/Makefile.am @@ -35,7 +35,7 @@ INCLUDES = -I$(top_srcdir)/include/curl \ LIBDIR = $(top_builddir)/lib -EXTRA_DIST = test307.pl +EXTRA_DIST = test75.pl test307.pl test610.pl # files used only in some libcurl test programs TESTUTIL = testutil.c testutil.h diff --git a/tests/libtest/test75.pl b/tests/libtest/test75.pl new file mode 100755 index 000000000..01a53ff15 --- /dev/null +++ b/tests/libtest/test75.pl @@ -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; diff --git a/tests/runtests.pl b/tests/runtests.pl index 851de6f5a..76adec161 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -2253,6 +2253,12 @@ do { # verbose output $verbose=1; } + elsif($ARGV[0] =~ /^-b(.*)/) { + my $portno=$1; + if($portno =~ s/(\d+)$//) { + $base = int $1; + } + } elsif ($ARGV[0] eq "-c") { # use this path to curl instead of default $DBGCURL=$CURL=$ARGV[1]; @@ -2309,20 +2315,22 @@ do { elsif($ARGV[0] eq "-h") { # show help text print <