build: untangle UNITTESTS and DEBUGBUILD macros

- fix `DEBUGBUILD` guards that should be `UNITTESTS`, in libcurl code
  used by unit tests.
- fix guards for libcurl functions used in unit tests only.
- sync `UNITTEST` attribute between declarations and definitions.
- drop `DEBUGBUILD` guard from test `unit2600`.
- fix guards for libcurl HSTS code used by both a unit test (`unit1660`)
  and `test0446`.
- update an existing AppVeyor CI job to test the issues fixed.

This fixes building tests with `CURLDEBUG` enabled but `DEBUGBUILD`
disabled. This can happen when building tests with CMake with
`ENABLE_DEBUG=ON` in Release config, or with `ENABLE_CURLDEBUG=ON`
and _without_ `ENABLE_DEBUG=ON`. Possibly also with autotools
when using `--enable-curldebug` without `--enable-debug`.

Test results:
- before:
  https://ci.appveyor.com/project/curlorg/curl/builds/49835609
  https://ci.appveyor.com/project/curlorg/curl/builds/49898529/job/k8qpbs8idby70smw
  https://github.com/curl/curl/actions/runs/9259078835/job/25470318167?pr=13798#step:13:821
- after: https://ci.appveyor.com/project/curlorg/curl/builds/49839255
  (the two failures are unrelated, subject to PR #13705)

Ref: #13592 (issue discovery)
Ref: #13689 (CI testing this PR with `DEBUGBUILD`/`CURLDEBUG` combinations)
Closes #13694
This commit is contained in:
Viktor Szakats 2024-05-16 13:49:22 +02:00
parent 8373783098
commit fc8e0dee30
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
15 changed files with 50 additions and 48 deletions

View file

@ -72,8 +72,6 @@ static void unit_stop(void)
curl_global_cleanup();
}
#ifdef DEBUGBUILD
struct test_case {
int id;
const char *url;
@ -329,8 +327,6 @@ static void test_connect(struct test_case *tc)
check_result(tc, &tr);
}
#endif /* DEBUGBUILD */
/*
* How these test cases work:
* - replace the creation of the TCP socket filter with our test filter
@ -385,15 +381,10 @@ static struct test_case TEST_CASES[] = {
UNITTEST_START
#if defined(DEBUGBUILD)
size_t i;
for(i = 0; i < sizeof(TEST_CASES)/sizeof(TEST_CASES[0]); ++i) {
test_connect(&TEST_CASES[i]);
}
#else
(void)TEST_CASES;
(void)test_connect;
#endif
UNITTEST_STOP