Skip to content

tests: merge clients into libtests, drop duplicate code#18079

Closed
vszakats wants to merge 66 commits intocurl:masterfrom
vszakats:mergecli
Closed

tests: merge clients into libtests, drop duplicate code#18079
vszakats wants to merge 66 commits intocurl:masterfrom
vszakats:mergecli

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Jul 29, 2025

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.

  • double-check if cli test entries can be simplified by using URL arg.
  • prepare/check for cli tests now build with CURLDEBUG. And maybe disable it.
  • fix cli test return value to be CURLcode. Change types, add casts, swap
    to valid enum values, possibly adapt pytest for these.
  • fix to not swallow the first arg for cli tests, or never swallow and adjust
    libtests, tunit, units. [skip, it's okay]

/cc @icing

@vszakats vszakats added the tests label Jul 29, 2025
@vszakats vszakats marked this pull request as draft July 29, 2025 12:42
@github-actions github-actions bot added the CI Continuous Integration label Jul 29, 2025
@vszakats vszakats force-pushed the mergecli branch 2 times, most recently from 4643cd3 to f200448 Compare July 29, 2025 14:02
@vszakats

This comment was marked as resolved.

@vszakats vszakats force-pushed the mergecli branch 2 times, most recently from 51f0d2e to 6c6fb3d Compare July 29, 2025 14:46
@vszakats vszakats marked this pull request as ready for review July 29, 2025 14:46
@vszakats vszakats changed the title tests: merge clients into libtests, drop duplicate logic tests: merge clients into libtests, drop duplicate code Jul 29, 2025
vszakats added 10 commits July 29, 2025 22:58
```
 URL: https://localhost:56789/push/data1
E   =================================================================
E   ==67234==ERROR: AddressSanitizer: stack-use-after-return on address 0x7f8d60f000e0 at pc 0x55ed61e18b5a bp 0x7fff19e724f0 sp 0x7fff19e724e8
E   READ of size 4 at 0x7f8d60f000e0 thread T0
E   /usr/bin/llvm-symbolizer-18: /home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4: no version information available (required by /usr/bin/llvm-symbolizer-18)
E   /usr/bin/llvm-symbolizer-18: symbol lookup error: /home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4: undefined symbol: __asan_option_detect_stack_use_after_return
E   ==67234==WARNING: Can't read from symbolizer at fd 5
E   <<-------------------------------------------------------
```
https://github.com/curl/curl/actions/runs/16598378195/job/46950868217?pr=18079
@vszakats vszakats marked this pull request as draft July 29, 2025 21:38
@vszakats vszakats marked this pull request as ready for review July 30, 2025 00:05
@vszakats vszakats closed this in 00887ae Jul 30, 2025
@vszakats vszakats deleted the mergecli branch July 30, 2025 00:40
jhauga added a commit to jhauga/curl that referenced this pull request Jul 30, 2025
* 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 curl#18079

* cmake: defer building `unitprotos.h` till a test target needs it

Follow-up to c9bb9cd curl#17750
Ref: curl#17750 (comment)
Closes curl#18086

* curl: add -h cheat-sheet using curl-cheat-sheet as text

Resolve failing checks.

---------

Co-authored-by: Viktor Szakats <commit@vsz.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration tests

Development

Successfully merging this pull request may close these issues.

1 participant

Comments