From 2fce1f3e9711a3f4b08339f476849ef68606d239 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Thu, 11 Oct 2007 21:15:09 +0000 Subject: [PATCH] Fixed the -l option of runtests.pl Added support for skipping tests based on key words. --- CHANGES | 5 +++++ tests/runtests.1 | 15 +++++++++++---- tests/runtests.pl | 36 ++++++++++++++++++++++++------------ 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/CHANGES b/CHANGES index 49fac02cd..1fe68b576 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,11 @@ Changelog +Dan F (11 October 2007) +- Fixed the -l option of runtests.pl + +- Added support for skipping tests based on key words. + Daniel S (9 October 2007) - Michal Marek removed the no longer existing return codes from the curl.1 man page. diff --git a/tests/runtests.1 b/tests/runtests.1 index a3871c0ec..f272ac241 100644 --- a/tests/runtests.1 +++ b/tests/runtests.1 @@ -5,7 +5,7 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * Copyright (C) 1998 - 2005, Daniel Stenberg, , et al. +.\" * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. .\" * .\" * This software is licensed as described in the file COPYING, which .\" * you should have received as part of this distribution. The terms @@ -21,7 +21,7 @@ .\" * $Id$ .\" ************************************************************************** .\" -.TH runtests.pl 1 "17 Mar 2005" "Curl 7.13.2" "runtests" +.TH runtests.pl 1 "11 Oct 2007" "Curl 7.17.1" "runtests" .SH NAME runtests.pl \- run one or more test cases .SH SYNOPSIS @@ -34,11 +34,18 @@ test suite. It is often called from the root Makefile of the curl package with If no test case number is given, all existing tests that the script can find will be considered for running. You can specify single test cases to run, space-separated, like "1 3 5 7 11", and you can specify a range like "45 to -67". +67". You can also specify only the tests you don't want to run by listing +the numbers with a leading exclamation point, like "!66". +.P +It is also possible to specify tests to skip based on a key word describing +the test. These are specified with a leading exclamation point and the +key word or phrase, like "!HTTP NTLM auth". .SH OPTIONS .IP "-a" Continue running the rest of the test cases even if one test fails. By default, the test script stops as soon as an error is detected. +.IP "-bN" +Use N as the base TCP/UDP port number on which to start the test servers. .IP "-c " Provide a custom curl binary to run the tests with. Default is the curl executable in the build tree. @@ -78,7 +85,7 @@ Enable verbose output. Speaks more than default. .SH "RUNNING TESTS" Many tests have conditions that must be met before the test case can run fine. They could depend on built-in features in libcurl or features present in -the operating system or even in 3rd party libraries that curl may or may not +the operating system or even in third-party libraries that curl may or may not use. The test script checks this by itself, why it is safe to attempt to run all diff --git a/tests/runtests.pl b/tests/runtests.pl index ef73dad97..71a02c9f6 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -171,6 +171,7 @@ my @protocols; # array of supported protocols my $skipped=0; # number of tests skipped; reported in main loop my %skipped; # skipped{reason}=counter, reasons for skip my @teststat; # teststat[testnum]=reason, reasons for skip +my %disabled_keywords; # key words of tests to skip ####################################################################### # variables the command line options may set @@ -1543,6 +1544,17 @@ sub singletest { $why = serverfortest($testnum); } + if(!$why) { + my @keywords = getpart("info", "keywords"); + my $k; + for $k (@keywords) { + chomp $k; + if ($disabled_keywords{$k}) { + $why = "disabled by keyword"; + } + } + } + if(!$why) { my @precheck = getpart("client", "precheck"); $cmd = $precheck[0]; @@ -1558,7 +1570,7 @@ sub singletest { } } - if($why) { + if($why && !$listonly) { # there's a problem, count it as "skipped" $skipped++; $skipped{$why}++; @@ -2358,15 +2370,6 @@ sub startservers { sub serverfortest { my ($testnum)=@_; - # load the test case file definition - if(loadtest("${TESTDIR}/test${testnum}")) { - if($verbose) { - # this is not a test - logmsg "$testnum doesn't look like a test case\n"; - } - return "no test"; - } - my @what = getpart("client", "server"); if(!$what[0]) { @@ -2393,7 +2396,7 @@ my $number=0; my $fromnum=-1; my @testthis; my %disabled; -do { +while(@ARGV) { if ($ARGV[0] eq "-v") { # verbose output $verbose=1; @@ -2476,6 +2479,7 @@ Usage: runtests.pl [options] [test number(s)] -v verbose output [num] like "5 6 9" or " 5 to 22 " to run those tests only [!num] like "!5 !6 !9" to disable those tests + [!keyword] like "!cookies !IPv6" to disable tests with those key words EOHELP ; exit; @@ -2499,7 +2503,15 @@ EOHELP $fromnum = -1; $disabled{$1}=$1; } -} while(shift @ARGV); + elsif($ARGV[0] =~ /^!(.+)/) { + $disabled_keywords{$1}=$1; + } + else { + print "Unknown option: $ARGV[0]\n"; + exit; + } + shift @ARGV; +} if($testthis[0] ne "") { $TESTCASES=join(" ", @testthis);