From: Viktor Szakats Date: Mon, 29 Dec 2025 02:44:27 +0000 (+0100) Subject: tests: include headers only when used X-Git-Tag: curl-8_18_0~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=352f3f140c832f300baed6d735d19a7b7c727c54;p=thirdparty%2Fcurl.git tests: include headers only when used Cherry-picked from #20106 Closes #20131 --- diff --git a/tests/libtest/lib758.c b/tests/libtest/lib758.c index 12f476e9c7..f6f371948e 100644 --- a/tests/libtest/lib758.c +++ b/tests/libtest/lib758.c @@ -30,8 +30,6 @@ #include "first.h" -#include "testtrace.h" - #ifdef USE_OPENSSL #include @@ -43,6 +41,8 @@ #ifdef T578_ENABLED +#include "testtrace.h" + static struct t758_ctx { int socket_calls; int max_socket_calls; diff --git a/tests/tunit/tool1604.c b/tests/tunit/tool1604.c index de665bbc5e..ec23984869 100644 --- a/tests/tunit/tool1604.c +++ b/tests/tunit/tool1604.c @@ -23,10 +23,11 @@ ***************************************************************************/ #include "unitcheck.h" +#if defined(_WIN32) || defined(MSDOS) + #include "tool_cfgable.h" #include "tool_doswin.h" -#if defined(_WIN32) || defined(MSDOS) static char *getflagstr(int flags) { char *buf = curlx_malloc(256); diff --git a/tests/unit/unit1304.c b/tests/unit/unit1304.c index 3e09a0c277..3438c97104 100644 --- a/tests/unit/unit1304.c +++ b/tests/unit/unit1304.c @@ -22,10 +22,11 @@ * ***************************************************************************/ #include "unitcheck.h" -#include "netrc.h" #ifndef CURL_DISABLE_NETRC +#include "netrc.h" + static void t1304_stop(char **password, char **login) { Curl_safefree(*password); diff --git a/tests/unit/unit1307.c b/tests/unit/unit1307.c index 5c147c6eda..146d5ae714 100644 --- a/tests/unit/unit1307.c +++ b/tests/unit/unit1307.c @@ -23,10 +23,10 @@ ***************************************************************************/ #include "unitcheck.h" -#include "curl_fnmatch.h" - #ifndef CURL_DISABLE_FTP +#include "curl_fnmatch.h" + /* CURL_FNMATCH_MATCH 0 CURL_FNMATCH_NOMATCH 1 diff --git a/tests/unit/unit1656.c b/tests/unit/unit1656.c index 7cdca884b8..cdd0df9bb2 100644 --- a/tests/unit/unit1656.c +++ b/tests/unit/unit1656.c @@ -23,10 +23,10 @@ ***************************************************************************/ #include "unitcheck.h" -#include "vtls/x509asn1.h" - #if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_MBEDTLS) +#include "vtls/x509asn1.h" + struct test_spec { const char *input; const char *exp_output; diff --git a/tests/unit/unit1657.c b/tests/unit/unit1657.c index 850b3ef730..515e2b595a 100644 --- a/tests/unit/unit1657.c +++ b/tests/unit/unit1657.c @@ -23,10 +23,10 @@ ***************************************************************************/ #include "unitcheck.h" -#include "vtls/x509asn1.h" - #if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_MBEDTLS) +#include "vtls/x509asn1.h" + struct test1657_spec { CURLcode (*setbuf)(const struct test1657_spec *spec, struct dynbuf *buf); size_t n; diff --git a/tests/unit/unit1660.c b/tests/unit/unit1660.c index 77d72a0631..3ba81d939b 100644 --- a/tests/unit/unit1660.c +++ b/tests/unit/unit1660.c @@ -23,18 +23,11 @@ ***************************************************************************/ #include "unitcheck.h" +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_HSTS) + #include "urldata.h" #include "hsts.h" -#if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_HSTS) -static CURLcode test_unit1660(const char *arg) -{ - UNITTEST_BEGIN_SIMPLE - puts("nothing to do when HTTP or HSTS are disabled"); - UNITTEST_END_SIMPLE -} -#else - static void showsts(struct stsentry *e, const char *chost) { if(!e) @@ -168,4 +161,11 @@ static CURLcode test_unit1660(const char *arg) UNITTEST_END(curl_global_cleanup()) } +#else +static CURLcode test_unit1660(const char *arg) +{ + UNITTEST_BEGIN_SIMPLE + puts("nothing to do when HTTP or HSTS are disabled"); + UNITTEST_END_SIMPLE +} #endif diff --git a/tests/unit/unit2603.c b/tests/unit/unit2603.c index 0afa26edeb..fbe5f89420 100644 --- a/tests/unit/unit2603.c +++ b/tests/unit/unit2603.c @@ -23,11 +23,12 @@ ***************************************************************************/ #include "unitcheck.h" +#ifndef CURL_DISABLE_HTTP + #include "urldata.h" #include "http1.h" #include "curl_trc.h" -#ifndef CURL_DISABLE_HTTP static void check_eq(const char *s, const char *exp_s, const char *name) { if(s && exp_s) {