tests: merge clients into libtests, drop duplicate code

libtests and clients were built the same way after recent overhauls.
libtests are used by runtests, clients by pytests.

Merge clients into libtests, aligning their entry function signature,
dropping common utility functions, and simplifying the build.

Note: After this patch `CURLDEBUG` applies to cli tests, when enabled.

Also:
- lib552: drop local copy-paste debug callback in favor of testtrace.
- lib552: drop local copy-paste dump function in favor of testtrace.
- clients: use `long` for HTTP version, drop casts.
- clients: replace local dump function in favor of testrace clone.
- sync cli test entry function prototype with libtests'.
- h2_serverpush: replace local trace callback with testtrace.
- de-duplicate 3 websocket close, ping, ping, functions. Kept the pong
  iteration from `ws_pingpong`. Note: the pong clone in `lib2304` was
  returning an error when `curl_ws_recv()` returned non-zero and
  the payload matched the expected one anyway. After this patch, this
  case returns success, as it does in `ws_pingpong`.
  `lib2304` keeps passing, but I'm not sure if the previous behavior
  was intentional.
- display full value in websocket close, ping, pong, drop casts.

Closes #18079
This commit is contained in:
Viktor Szakats 2025-07-29 09:53:14 +02:00
parent 952c929bdf
commit 00887aee8c
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
48 changed files with 541 additions and 1041 deletions

View file

@ -25,14 +25,22 @@
***************************************************************************/
#include "first.h"
void debug_dump(const char *timebuf, const char *text,
FILE *stream, const unsigned char *ptr,
size_t size, int nohex);
struct libtest_trace_cfg {
int tracetime; /* 0 represents FALSE, anything else TRUE */
int nohex; /* 0 represents FALSE, anything else TRUE */
};
extern struct libtest_trace_cfg libtest_debug_config;
extern struct libtest_trace_cfg debug_config;
int libtest_debug_cb(CURL *handle, curl_infotype type,
char *data, size_t size, void *userp);
/* callback for CURLOPT_DEBUGFUNCTION (client tests) */
int cli_debug_cb(CURL *handle, curl_infotype type,
char *data, size_t size, void *userp);
#endif /* HEADER_LIBTEST_TESTTRACE_H */