- name: event-based
install_packages: libssh-dev
configure: --enable-debug --disable-shared --disable-threaded-resolver --with-libssh --with-openssl
- tflags: -n -e '!TLS-SRP'
+ tflags: -n --test-event '!TLS-SRP'
+
+ - name: duphandle
+ install_packages: libssh-dev
+ configure: --enable-debug --disable-shared --disable-threaded-resolver --with-libssh --with-openssl
+ tflags: -n --test-duphandle '!TLS-SRP'
- name: rustls valgrind
install_packages: valgrind
compiler: clang
configure: --enable-debug --with-openssl=$(brew --prefix openssl)
macos-version-min: '10.9'
- tflags: -e
+ tflags: --test-event
- name: 'OpenSSL libssh2 !ldap 10.15'
compiler: clang
configure: --enable-debug --disable-ldap --with-openssl=$(brew --prefix openssl)
long ms_per_transfer; /* start next transfer after (at least) this
many milliseconds */
#ifdef DEBUGBUILD
+ bool test_duphandle;
bool test_event_based;
#endif
bool parallel;
{"tcp-fastopen", ARG_BOOL, ' ', C_TCP_FASTOPEN},
{"tcp-nodelay", ARG_BOOL, ' ', C_TCP_NODELAY},
{"telnet-option", ARG_STRG, 't', C_TELNET_OPTION},
+#ifdef DEBUGBUILD
+ {"test-duphandle", ARG_BOOL, ' ', C_TEST_DUPHANDLE},
{"test-event", ARG_BOOL, ' ', C_TEST_EVENT},
+#endif
{"tftp-blksize", ARG_STRG, ' ', C_TFTP_BLKSIZE},
{"tftp-no-options", ARG_BOOL, ' ', C_TFTP_NO_OPTIONS},
{"time-cond", ARG_STRG, 'z', C_TIME_COND},
case C_SASL_IR: /* --sasl-ir */
config->sasl_ir = toggle;
break;
- case C_TEST_EVENT: /* --test-event */
#ifdef DEBUGBUILD
+ case C_TEST_DUPHANDLE: /* --test-duphandle */
+ global->test_duphandle = toggle;
+ break;
+ case C_TEST_EVENT: /* --test-event */
global->test_event_based = toggle;
-#else
- warnf(global, "--test-event is ignored unless a debug build");
-#endif
break;
+#endif
case C_UNIX_SOCKET: /* --unix-socket */
config->abstract_unix_socket = FALSE;
err = getstr(&config->unix_socket_path, nextarg, DENY_BLANK);
C_TCP_FASTOPEN,
C_TCP_NODELAY,
C_TELNET_OPTION,
+ C_TEST_DUPHANDLE,
C_TEST_EVENT,
C_TFTP_BLKSIZE,
C_TFTP_NO_OPTIONS,
if(getenv("CURL_FORBID_REUSE"))
(void)curl_easy_setopt(per->curl, CURLOPT_FORBID_REUSE, 1L);
+ if(global->test_duphandle) {
+ CURL *dup = curl_easy_duphandle(per->curl);
+ curl_easy_cleanup(per->curl);
+ per->curl = dup;
+ if(!dup) {
+ result = CURLE_OUT_OF_MEMORY;
+ break;
+ }
+ /* a duplicate needs the share re-added */
+ (void)curl_easy_setopt(per->curl, CURLOPT_SHARE, share);
+ }
if(global->test_event_based)
result = curl_easy_perform_ev(per->curl);
else
Brief test case description, shown when the test runs.
### `<setenv>`
+
variable1=contents1
variable2=contents2
variable3
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
<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>
<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>
<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>
<command>
-x http://%HOSTIP:%PROXYPORT http://this.hsts.example:%HTTPSPORT/%TESTNUMBER --hsts %LOGDIR/input%TESTNUMBER -k
</command>
+<disable>
+test-duphandle
+</disable>
</client>
<verify>
<command>
-x http://%HOSTIP:%PROXYPORT http://this.hsts.example:%HTTPSPORT/%TESTNUMBER --hsts %LOGDIR/input%TESTNUMBER -k
</command>
+<disable>
+test-duphandle
+</disable>
</client>
<verify>
<command>
-x http://%HOSTIP:%PROXYPORT http://this.hsts.example:%HTTPSPORT/%TESTNUMBER --hsts %LOGDIR/input%TESTNUMBER -k
</command>
+<disable>
+test-duphandle
+</disable>
</client>
<verify>
<command>
-x http://%HOSTIP:%PROXYPORT http://this.hsts.example:%HTTPSPORT/%TESTNUMBER --hsts %LOGDIR/input%TESTNUMBER -k
</command>
+<disable>
+test-duphandle
+</disable>
</client>
<verify>
$PROXYIN
$pwd
$randseed
+ $run_duphandle
$run_event_based
$SERVERCMD
$SERVERIN
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
$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 ";
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
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.
"*\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);
# 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;
'--include' => 6,
# for tests and debug only, can remain hidden
+ '--test-duphandle' => 6,
'--test-event' => 6,
'--wdebug' => 6,
);