tests: drop mk-bundle exceptions

Using a mixture of techniques to avoid symbols collisions:
- reduce scope.
- add `t*_` / `T*_` prefix.
- move shared functions to `testutil.c`.
  (`suburl()`, `rlim2str()`)
- clone re-used lib*.c sources.
  (lib587, lib645)
- include shared symbols just once in re-used `lib*.c` sources.
  (using `LIB*_C` guards.)
- drop re-used `lib*.c` sources where they were identical or
  unused.
- make macros global.
- #undef macros before use.

What remain is the entry functions `test`, and `unit_setup`,
`unit_stop` in unit tests.

Also:
- fix formatting and other minor things along the way.
- add `const` where possible.
- sync some symbol names between tests.
- drop `mk-bundle-hints.sh` that's no longer necessary.

Closes #17468
This commit is contained in:
Viktor Szakats 2025-05-27 21:20:36 +02:00
parent 9ed34cc45b
commit 6897aeb105
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
142 changed files with 2055 additions and 1893 deletions

View file

@ -48,7 +48,7 @@ static void unit_stop(void)
curl_global_cleanup();
}
static void test_parse(
static void t1663_parse(
const char *input_data,
const char *exp_dev,
const char *exp_iface,
@ -81,17 +81,17 @@ static void test_parse(
UNITTEST_START
{
test_parse("dev", "dev", NULL, NULL, CURLE_OK);
test_parse("if!eth0", NULL, "eth0", NULL, CURLE_OK);
test_parse("host!myname", NULL, NULL, "myname", CURLE_OK);
test_parse("ifhost!eth0!myname", NULL, "eth0", "myname", CURLE_OK);
test_parse("", NULL, NULL, NULL, CURLE_BAD_FUNCTION_ARGUMENT);
test_parse("!", "!", NULL, NULL, CURLE_OK);
test_parse("if!", NULL, NULL, NULL, CURLE_BAD_FUNCTION_ARGUMENT);
test_parse("if!eth0!blubb", NULL, "eth0!blubb", NULL, CURLE_OK);
test_parse("host!", NULL, NULL, NULL, CURLE_BAD_FUNCTION_ARGUMENT);
test_parse("ifhost!", NULL, NULL, NULL, CURLE_BAD_FUNCTION_ARGUMENT);
test_parse("ifhost!eth0", NULL, NULL, NULL, CURLE_BAD_FUNCTION_ARGUMENT);
test_parse("ifhost!eth0!", NULL, NULL, NULL, CURLE_BAD_FUNCTION_ARGUMENT);
t1663_parse("dev", "dev", NULL, NULL, CURLE_OK);
t1663_parse("if!eth0", NULL, "eth0", NULL, CURLE_OK);
t1663_parse("host!myname", NULL, NULL, "myname", CURLE_OK);
t1663_parse("ifhost!eth0!myname", NULL, "eth0", "myname", CURLE_OK);
t1663_parse("", NULL, NULL, NULL, CURLE_BAD_FUNCTION_ARGUMENT);
t1663_parse("!", "!", NULL, NULL, CURLE_OK);
t1663_parse("if!", NULL, NULL, NULL, CURLE_BAD_FUNCTION_ARGUMENT);
t1663_parse("if!eth0!blubb", NULL, "eth0!blubb", NULL, CURLE_OK);
t1663_parse("host!", NULL, NULL, NULL, CURLE_BAD_FUNCTION_ARGUMENT);
t1663_parse("ifhost!", NULL, NULL, NULL, CURLE_BAD_FUNCTION_ARGUMENT);
t1663_parse("ifhost!eth0", NULL, NULL, NULL, CURLE_BAD_FUNCTION_ARGUMENT);
t1663_parse("ifhost!eth0!", NULL, NULL, NULL, CURLE_BAD_FUNCTION_ARGUMENT);
}
UNITTEST_STOP