mirror of
https://github.com/curl/curl.git
synced 2026-08-26 02:03:32 +03:00
curl: --test-duphandle in debug builds runs "duphandled"
Using this option (only available in debug builds) makes curl always call curl_easy_duphandle() on the handle before using it. To help us catch curl_easy_duphandle() mistakes better. Add a CI job using this. Bonus: the previous runtests option -e is now also supported as --test-event Closes #15504
This commit is contained in:
parent
354f3f96a1
commit
cbafcec50b
19 changed files with 93 additions and 10 deletions
|
|
@ -522,6 +522,7 @@ the `unit/` directory (if the tool name starts with `unit`).
|
|||
Brief test case description, shown when the test runs.
|
||||
|
||||
### `<setenv>`
|
||||
|
||||
variable1=contents1
|
||||
variable2=contents2
|
||||
variable3
|
||||
|
|
@ -606,6 +607,11 @@ Pass this given data on stdin to the tool.
|
|||
If `nonewline` is set, we cut off the trailing newline of this given data
|
||||
before comparing with the one actually received by the client
|
||||
|
||||
## `<disable>`
|
||||
|
||||
If `test-duphandle` is a listed item here, this is not run when
|
||||
`--test-duphandle` is used.
|
||||
|
||||
## `<verify>`
|
||||
### `<errorcode>`
|
||||
numerical error code curl is supposed to return. Specify a list of accepted
|
||||
|
|
|
|||
|
|
@ -44,6 +44,10 @@ HSTS with trailing-dot host name in URL but none in hsts file
|
|||
<command>
|
||||
-x http://%HOSTIP:%HTTPPORT http://this.hsts.example./%TESTNUMBER --hsts %LOGDIR/input%TESTNUMBER -w '%{url_effective}\n'
|
||||
</command>
|
||||
|
||||
<disable>
|
||||
test-duphandle
|
||||
</disable>
|
||||
</client>
|
||||
|
||||
<verify>
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@ HSTS with no t-dot host name in URL but t-dot in file
|
|||
<command>
|
||||
-x http://%HOSTIP:%HTTPPORT http://this.hsts.example/%TESTNUMBER --hsts %LOGDIR/input%TESTNUMBER -w '%{url_effective}\n'
|
||||
</command>
|
||||
<disable>
|
||||
test-duphandle
|
||||
</disable>
|
||||
</client>
|
||||
|
||||
<verify>
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@ HSTS and %{url_effective} after upgrade
|
|||
<command>
|
||||
-x http://%HOSTIP:%HTTPPORT http://this.hsts.example/%TESTNUMBER --hsts %LOGDIR/input%TESTNUMBER -w '%{url_effective}\n'
|
||||
</command>
|
||||
<disable>
|
||||
test-duphandle
|
||||
</disable>
|
||||
</client>
|
||||
|
||||
<verify>
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@ HSTS with updated expiry in response
|
|||
<command>
|
||||
-x http://%HOSTIP:%PROXYPORT http://this.hsts.example:%HTTPSPORT/%TESTNUMBER --hsts %LOGDIR/input%TESTNUMBER -k
|
||||
</command>
|
||||
<disable>
|
||||
test-duphandle
|
||||
</disable>
|
||||
</client>
|
||||
|
||||
<verify>
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@ HSTS update expiry, with parent includeSubDomains domain present
|
|||
<command>
|
||||
-x http://%HOSTIP:%PROXYPORT http://this.hsts.example:%HTTPSPORT/%TESTNUMBER --hsts %LOGDIR/input%TESTNUMBER -k
|
||||
</command>
|
||||
<disable>
|
||||
test-duphandle
|
||||
</disable>
|
||||
</client>
|
||||
|
||||
<verify>
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@ HSTS update expiry, with two includeSubDomains domains present
|
|||
<command>
|
||||
-x http://%HOSTIP:%PROXYPORT http://this.hsts.example:%HTTPSPORT/%TESTNUMBER --hsts %LOGDIR/input%TESTNUMBER -k
|
||||
</command>
|
||||
<disable>
|
||||
test-duphandle
|
||||
</disable>
|
||||
</client>
|
||||
|
||||
<verify>
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@ HSTS update expiry, removing includesubdomains in update
|
|||
<command>
|
||||
-x http://%HOSTIP:%PROXYPORT http://this.hsts.example:%HTTPSPORT/%TESTNUMBER --hsts %LOGDIR/input%TESTNUMBER -k
|
||||
</command>
|
||||
<disable>
|
||||
test-duphandle
|
||||
</disable>
|
||||
</client>
|
||||
|
||||
<verify>
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ BEGIN {
|
|||
$PROXYIN
|
||||
$pwd
|
||||
$randseed
|
||||
$run_duphandle
|
||||
$run_event_based
|
||||
$SERVERCMD
|
||||
$SERVERIN
|
||||
|
|
@ -83,6 +84,7 @@ our $verbose; # 1 to show verbose test output
|
|||
our $torture; # 1 to enable torture testing
|
||||
our $proxy_address; # external HTTP proxy address
|
||||
our $listonly; # only list the tests
|
||||
our $run_duphandle; # run curl with --test-duphandle to verify handle duplication
|
||||
our $run_event_based; # run curl with --test-event to test the event API
|
||||
our $automakestyle; # use automake-like test status output format
|
||||
our $anyway; # continue anyway, even if a test fail
|
||||
|
|
|
|||
|
|
@ -894,6 +894,18 @@ sub singletest_run {
|
|||
$cmdargs .= "--test-event ";
|
||||
$fail_due_event_based--;
|
||||
}
|
||||
if($run_duphandle) {
|
||||
$cmdargs .= "--test-duphandle ";
|
||||
my @dis = getpart("client", "disable");
|
||||
if(@dis) {
|
||||
chomp $dis[0] if($dis[0]);
|
||||
if($dis[0] eq "test-duphandle") {
|
||||
# marked to not run with duphandle
|
||||
logmsg "test $testnum: IGNORED: can't run test-duphandle\n";
|
||||
return (-1, 0, 0, "", "", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
$cmdargs .= $cmd;
|
||||
if ($proxy_address) {
|
||||
$cmdargs .= " --proxy $proxy_address ";
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ exclusion, the second field contains a pattern and the final field contains
|
|||
the reason why matching tests should be skipped. The exclusion types are
|
||||
*keyword*, *test*, and *tool*.
|
||||
|
||||
## `-e`
|
||||
## `-e` or `--test-event`
|
||||
|
||||
Run the test event-based (if possible). This makes runtests invoke curl with
|
||||
--test-event option. This option only works if both curl and libcurl were
|
||||
|
|
@ -263,6 +263,19 @@ the allocation with that number to be set to fail at once instead of looping
|
|||
through everyone, which is handy when debugging and then often in combination
|
||||
with *-g*.
|
||||
|
||||
## `--test-duphandle`
|
||||
|
||||
Passes the `--test-duphandle` option to curl when invoked. This command line
|
||||
option only exists in debug builds and runs curl normally, but duplicates the
|
||||
easy handle before the transfer and use the duplicate instead of the original
|
||||
handle. This verifies that the duplicate works exactly as good as the original
|
||||
handle.
|
||||
|
||||
Because of how the curl tool uses a share object to store and keep some data,
|
||||
not everything is however perfectly copied in the duplicate. In particular
|
||||
HSTS data is not. A specific test case can be set to avoid using
|
||||
`--test-duphandle` by disabling it on a per test basis.
|
||||
|
||||
## `-u`
|
||||
|
||||
Error instead of warning on server unexpectedly alive.
|
||||
|
|
|
|||
|
|
@ -871,7 +871,8 @@ sub checksystemfeatures {
|
|||
"*\n");
|
||||
}
|
||||
|
||||
logmsg sprintf("* Env: %s%s%s%s", $valgrind?"Valgrind ":"",
|
||||
logmsg sprintf("* Env: %s%s%s%s%s", $valgrind?"Valgrind ":"",
|
||||
$run_duphandle?"test-duphandle ":"",
|
||||
$run_event_based?"event-based ":"",
|
||||
$bundle?"bundle ":"",
|
||||
$nghttpx_h3);
|
||||
|
|
@ -2270,10 +2271,14 @@ while(@ARGV) {
|
|||
# have the servers display protocol output
|
||||
$debugprotocol=1;
|
||||
}
|
||||
elsif($ARGV[0] eq "-e") {
|
||||
elsif(($ARGV[0] eq "-e") || ($ARGV[0] eq "--test-event")) {
|
||||
# run the tests cases event based if possible
|
||||
$run_event_based=1;
|
||||
}
|
||||
elsif($ARGV[0] eq "--test-duphandle") {
|
||||
# run the tests with --test-duphandle
|
||||
$run_duphandle=1;
|
||||
}
|
||||
elsif($ARGV[0] eq "-f") {
|
||||
# force - run the test case even if listed in DISABLED
|
||||
$run_disabled=1;
|
||||
|
|
|
|||
|
|
@ -180,6 +180,7 @@ my %opts = (
|
|||
'--include' => 6,
|
||||
|
||||
# for tests and debug only, can remain hidden
|
||||
'--test-duphandle' => 6,
|
||||
'--test-event' => 6,
|
||||
'--wdebug' => 6,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue