aboutsummaryrefslogtreecommitdiff
path: root/tests/runtests.pl
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2013-08-10 22:55:59 +0200
committerDaniel Stenberg <daniel@haxx.se>2013-08-20 11:56:06 +0200
commit6cf8413e31629183b3c749aa2a17d24be14cbca1 (patch)
tree4eefcd397f973dee660b823af175ebd7188d4901 /tests/runtests.pl
parent062e5bfd9c3a05b9234144dc782e232804916b5e (diff)
curl_easy_perform_ev: debug/test function
This function is meant to work *exactly* as curl_easy_perform() but will use the event-based libcurl API internally instead of curl_multi_perform(). To avoid relying on an actual event-based library and to not use non-portable functions (like epoll or similar), there's a rather inefficient emulation layer implemented on top of Curl_poll() instead. There's currently some convenience logging done in curl_easy_perform_ev which helps when tracking down problems. They may be suitable to remove or change once things seem to be fine enough. curl has a new --test-event option when built with debug enabled that then uses curl_easy_perform_ev() instead of curl_easy_perform(). If built without debug, using --test-event will only output a warning message. NOTE: curl_easy_perform_ev() is not part if the public API on purpose. It is only present in debug builds of libcurl and MUST NOT be considered stable even then. Use it for libcurl-testing purposes only. runtests.pl now features an -e command line option that makes it use --test-event for all curl command line tests. The man page is updated.
Diffstat (limited to 'tests/runtests.pl')
-rwxr-xr-xtests/runtests.pl34
1 files changed, 29 insertions, 5 deletions
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;