From b6b03c8ab95236215492ea1c819751c8bd155871 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Sun, 27 Jul 2008 02:34:27 +0000 Subject: Added feature in runtests.pl to select tests based on key word. --- tests/FILEFORMAT | 7 +++++-- tests/runtests.1 | 7 +++++-- tests/runtests.pl | 20 ++++++++++++++++---- 3 files changed, 26 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/FILEFORMAT b/tests/FILEFORMAT index c2ee7ae40..555cee52d 100644 --- a/tests/FILEFORMAT +++ b/tests/FILEFORMAT @@ -28,8 +28,11 @@ Main sections are 'info', 'reply', 'client' and 'verify'. A newline-separated list of keywords describing what this test case uses and -tests. Try to use an already used keyword. These keywords will be used for -statistical/informational purposes. +tests. Try to use an already used keyword. These keywords will be used for +statistical/informational purposes and for choosing or skipping classes +of tests. "Keywords" must begin with an alphabetic character, "-", "[" +or "{" and may actually consist of multiple words separated by spaces +which are treated together as a single identifier. diff --git a/tests/runtests.1 b/tests/runtests.1 index a24b6a3c6..c09741ce7 100644 --- a/tests/runtests.1 +++ b/tests/runtests.1 @@ -25,7 +25,7 @@ .SH NAME runtests.pl \- run one or more test cases .SH SYNOPSIS -.B runtests.pl [options] [test number] +.B runtests.pl [options] [test number] [!test number] [key word] [!key word] .SH DESCRIPTION \fIruntests.pl\fP runs one, several or all the existing test cases in curl's test suite. It is often called from the root Makefile of the curl package with @@ -39,7 +39,10 @@ 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". +key word or phrase, like "!HTTP NTLM auth". Likewise, tests to run can +be specified simply by specifying the unadorned key words, like "FTPS". +Remember that the exclamation marks and spaces will need to be quoted somehow +when entered at many command shells. .SH OPTIONS .IP "-a" Continue running the rest of the test cases even if one test fails. By diff --git a/tests/runtests.pl b/tests/runtests.pl index 8d86cdce6..de300df4d 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -45,7 +45,7 @@ # to do with cookies, those that set environment variables, or those that # do more than touch the file system in a or # section). These can be added to the $TESTCASES line below, -# e.g. $TESTCASES="!8 !31 !63..." +# e.g. $TESTCASES="!8 !31 !63 !cookies..." # # Finally, to properly support -g and -n, checktestcmd needs to change # to check the remote system's PATH, and the places in the code where @@ -197,6 +197,7 @@ 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 +my %enabled_keywords; # key words of tests to run my $sshdid; # for socks server, ssh daemon version id my $sshdvernum; # for socks server, ssh daemon version number @@ -1820,13 +1821,20 @@ sub singletest { if(!$why) { my @keywords = getpart("info", "keywords"); + my $match; my $k; for $k (@keywords) { chomp $k; if ($disabled_keywords{$k}) { $why = "disabled by keyword"; + } elsif ($enabled_keywords{$k}) { + $match = 1; } } + + if(!$why && !$match && %enabled_keywords) { + $why = "disabled by missing keyword"; + } } if(!$why) { @@ -2781,7 +2789,7 @@ while(@ARGV) { elsif($ARGV[0] eq "-h") { # show help text print < $b } @cmds) { if($disabled{$n}) { # skip disabled test cases -- cgit v1.2.3