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:
Daniel Stenberg 2024-11-07 10:22:32 +01:00
parent 354f3f96a1
commit cbafcec50b
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
19 changed files with 93 additions and 10 deletions

View file

@ -312,7 +312,10 @@ static const struct LongShort aliases[]= {
{"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},
@ -1653,13 +1656,14 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
case C_SASL_IR: /* --sasl-ir */
config->sasl_ir = toggle;
break;
case C_TEST_EVENT: /* --test-event */
#ifdef DEBUGBUILD
global->test_event_based = toggle;
#else
warnf(global, "--test-event is ignored unless a debug build");
#endif
case C_TEST_DUPHANDLE: /* --test-duphandle */
global->test_duphandle = toggle;
break;
case C_TEST_EVENT: /* --test-event */
global->test_event_based = toggle;
break;
#endif
case C_UNIX_SOCKET: /* --unix-socket */
config->abstract_unix_socket = FALSE;
err = getstr(&config->unix_socket_path, nextarg, DENY_BLANK);