tests: include headers only when used

Cherry-picked from #20106

Closes #20131
This commit is contained in:
Viktor Szakats 2025-12-29 03:44:27 +01:00
parent 7ad830bb58
commit 352f3f140c
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
8 changed files with 23 additions and 20 deletions

View file

@ -30,8 +30,6 @@
#include "first.h"
#include "testtrace.h"
#ifdef USE_OPENSSL
#include <openssl/ssl.h>
@ -43,6 +41,8 @@
#ifdef T578_ENABLED
#include "testtrace.h"
static struct t758_ctx {
int socket_calls;
int max_socket_calls;

View file

@ -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);

View file

@ -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);

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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) {