aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/runtests.16
-rwxr-xr-xtests/runtests.pl34
2 files changed, 34 insertions, 6 deletions
diff --git a/tests/runtests.1 b/tests/runtests.1
index 45f878333..0de38f69a 100644
--- a/tests/runtests.1
+++ b/tests/runtests.1
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -53,6 +53,10 @@ Provide a custom curl binary to run the tests with. Default is the curl
executable in the build tree.
.IP "-d"
Enable protocol debug: have the servers display protocol output.
+.IP "-e"
+Run the test event-based (if possible). This will make runtests invoke curl
+with --test-event option. This option only works if both curl and libcurl were
+built debug-enabled.
.IP "-g"
Run the given test(s) with gdb. This is best used on a single test case and
curl built --disable-shared. This then fires up gdb with command line set to
diff --git a/tests/runtests.pl b/tests/runtests.pl
index 96df8d524..5c50337e3 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -274,6 +274,7 @@ my $gdbxwin; # use windowed gdb when using gdb
my $keepoutfiles; # keep stdout and stderr files after tests
my $listonly; # only list the tests
my $postmortem; # display detailed info about failed tests
+my $run_event_based; # run curl with --test-event to test the event API
my %run; # running server
my %doesntrun; # servers that don't work, identified by pidfile
@@ -2710,7 +2711,11 @@ sub timestampskippedevents {
# Run a single specified test case
#
sub singletest {
- my ($testnum, $count, $total)=@_;
+ my ($evbased, # 1 means switch on if possible (and "curl" is tested)
+ # returns "not a test" if it can't be used for this test
+ $testnum,
+ $count,
+ $total)=@_;
my @what;
my $why;
@@ -3127,6 +3132,7 @@ sub singletest {
my $CMDLINE;
my $cmdargs;
my $cmdtype = $cmdhash{'type'} || "default";
+ my $fail_due_event_based = $evbased;
if($cmdtype eq "perl") {
# run the command line prepended with "perl"
$cmdargs ="$cmd";
@@ -3142,15 +3148,22 @@ sub singletest {
$disablevalgrind=1;
}
elsif(!$tool) {
- # run curl, add --verbose for debug information output
+ # run curl, add suitable command line options
$cmd = "-1 ".$cmd if(exists $feature{"SSL"} && ($has_axtls));
my $inc="";
if((!$cmdhash{'option'}) || ($cmdhash{'option'} !~ /no-include/)) {
- $inc = "--include ";
+ $inc = " --include";
}
- $cmdargs ="$out $inc--trace-ascii log/trace$testnum --trace-time $cmd";
+ $cmdargs = "$out$inc ";
+ $cmdargs .= "--trace-ascii log/trace$testnum ";
+ $cmdargs .= "--trace-time ";
+ if($evbased) {
+ $cmdargs .= "--test-event ";
+ $fail_due_event_based--;
+ }
+ $cmdargs .= $cmd;
}
else {
$cmdargs = " $cmd"; # $cmd is the command line for the test file
@@ -3171,6 +3184,11 @@ sub singletest {
$DBGCURL=$CMDLINE;
}
+ if($fail_due_event_based) {
+ logmsg "This test cannot run event based\n";
+ return -1;
+ }
+
my @stdintest = getpart("client", "stdin");
if(@stdintest) {
@@ -3755,6 +3773,8 @@ sub singletest {
else {
$ok .= "-"; # valgrind not checked
}
+ # add 'E' for event-based
+ $ok .= $evbased ? "E" : "-";
logmsg "$ok " if(!$short);
@@ -4454,6 +4474,10 @@ while(@ARGV) {
# continue anyway, even if a test fail
$anyway=1;
}
+ elsif($ARGV[0] eq "-e") {
+ # run the tests cases event based if possible
+ $run_event_based=1;
+ }
elsif($ARGV[0] eq "-p") {
$postmortem=1;
}
@@ -4825,7 +4849,7 @@ foreach $testnum (@at) {
$lasttest = $testnum if($testnum > $lasttest);
$count++;
- my $error = singletest($testnum, $count, scalar(@at));
+ my $error = singletest($run_event_based, $testnum, $count, scalar(@at));
if($error < 0) {
# not a test we can run
next;