diff --git a/lib/doh.c b/lib/doh.c index 68dd083824..09dd0739f5 100644 --- a/lib/doh.c +++ b/lib/doh.c @@ -69,6 +69,11 @@ static const char *doh_strerror(DOHcode code) /* @unittest 1655 */ +UNITTEST DOHcode doh_req_encode(const char *host, + DNStype dnstype, + unsigned char *dnsp, /* buffer */ + size_t len, /* buffer size */ + size_t *olen); /* output length */ UNITTEST DOHcode doh_req_encode(const char *host, DNStype dnstype, unsigned char *dnsp, /* buffer */ @@ -699,6 +704,7 @@ static DOHcode doh_rdata(const unsigned char *doh, return DOH_OK; } +UNITTEST void de_init(struct dohentry *d); UNITTEST void de_init(struct dohentry *de) { int i; @@ -708,6 +714,10 @@ UNITTEST void de_init(struct dohentry *de) curlx_dyn_init(&de->cname[i], DYN_DOH_CNAME); } +UNITTEST DOHcode doh_resp_decode(const unsigned char *doh, + size_t dohlen, + DNStype dnstype, + struct dohentry *d); UNITTEST DOHcode doh_resp_decode(const unsigned char *doh, size_t dohlen, DNStype dnstype, @@ -1025,6 +1035,7 @@ static const char *doh_type2name(DNStype dnstype) } #endif +UNITTEST void de_cleanup(struct dohentry *d); UNITTEST void de_cleanup(struct dohentry *d) { int i = 0; diff --git a/lib/doh.h b/lib/doh.h index 3eba4df26e..8d12fb96ff 100644 --- a/lib/doh.h +++ b/lib/doh.h @@ -25,7 +25,8 @@ ***************************************************************************/ #include "urldata.h" -#ifndef CURL_DISABLE_DOH +/* enums outside of the #ifdef to make the types work in unitprotos.h even on + builds without DoH support */ typedef enum { DOH_OK, @@ -53,6 +54,10 @@ typedef enum { CURL_DNS_TYPE_HTTPS = 65 } DNStype; +struct dohentry; /* forward-declare for non-DoH builds */ + +#ifndef CURL_DISABLE_DOH + enum doh_slot_num { /* Explicit values for first two symbols so as to match hard-coded * constants in existing code @@ -158,21 +163,6 @@ struct dohentry { void Curl_doh_close(struct Curl_easy *data); void Curl_doh_cleanup(struct Curl_easy *data); -#ifdef UNITTESTS -UNITTEST DOHcode doh_req_encode(const char *host, - DNStype dnstype, - unsigned char *dnsp, /* buffer */ - size_t len, /* buffer size */ - size_t *olen); /* output length */ -UNITTEST DOHcode doh_resp_decode(const unsigned char *doh, - size_t dohlen, - DNStype dnstype, - struct dohentry *d); - -UNITTEST void de_init(struct dohentry *d); -UNITTEST void de_cleanup(struct dohentry *d); -#endif - #else /* CURL_DISABLE_DOH */ #define Curl_doh(a, b, c, d, e) NULL #define Curl_doh_is_resolved(x, y) CURLE_COULDNT_RESOLVE_HOST diff --git a/lib/http_aws_sigv4.c b/lib/http_aws_sigv4.c index 492be1ab58..ee838486ce 100644 --- a/lib/http_aws_sigv4.c +++ b/lib/http_aws_sigv4.c @@ -679,6 +679,8 @@ static int compare_func(const void *a, const void *b) return compare; } +UNITTEST CURLcode canon_path(const char *q, size_t len, + struct dynbuf *new_path, bool normalize); UNITTEST CURLcode canon_path(const char *q, size_t len, struct dynbuf *new_path, bool do_uri_encode) @@ -705,6 +707,7 @@ UNITTEST CURLcode canon_path(const char *q, size_t len, return result; } +UNITTEST CURLcode canon_query(const char *query, struct dynbuf *dq); UNITTEST CURLcode canon_query(const char *query, struct dynbuf *dq) { CURLcode result = CURLE_OK; diff --git a/lib/http_aws_sigv4.h b/lib/http_aws_sigv4.h index 25009c6809..7dd002476a 100644 --- a/lib/http_aws_sigv4.h +++ b/lib/http_aws_sigv4.h @@ -31,10 +31,4 @@ /* this is for creating aws_sigv4 header output */ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data); -#ifdef UNITTESTS -UNITTEST CURLcode canon_path(const char *q, size_t len, - struct dynbuf *new_path, bool normalize); -UNITTEST CURLcode canon_query(const char *query, struct dynbuf *dq); -#endif - #endif /* HEADER_CURL_HTTP_AWS_SIGV4_H */ diff --git a/lib/noproxy.c b/lib/noproxy.c index ee03fd35b9..a80db15684 100644 --- a/lib/noproxy.c +++ b/lib/noproxy.c @@ -41,6 +41,9 @@ * Curl_cidr4_match() returns TRUE if the given IPv4 address is within the * specified CIDR address range. */ +UNITTEST bool Curl_cidr4_match(const char *ipv4, /* 1.2.3.4 address */ + const char *network, /* 1.2.3.4 address */ + unsigned int bits); UNITTEST bool Curl_cidr4_match(const char *ipv4, /* 1.2.3.4 address */ const char *network, /* 1.2.3.4 address */ unsigned int bits) @@ -74,6 +77,9 @@ UNITTEST bool Curl_cidr4_match(const char *ipv4, /* 1.2.3.4 address */ return address == check; } +UNITTEST bool Curl_cidr6_match(const char *ipv6, + const char *network, + unsigned int bits); UNITTEST bool Curl_cidr6_match(const char *ipv6, const char *network, unsigned int bits) diff --git a/lib/noproxy.h b/lib/noproxy.h index 71ae7eaafa..e16c139bb5 100644 --- a/lib/noproxy.h +++ b/lib/noproxy.h @@ -26,17 +26,6 @@ #include "curl_setup.h" #ifndef CURL_DISABLE_PROXY - -#ifdef UNITTESTS - -UNITTEST bool Curl_cidr4_match(const char *ipv4, /* 1.2.3.4 address */ - const char *network, /* 1.2.3.4 address */ - unsigned int bits); -UNITTEST bool Curl_cidr6_match(const char *ipv6, - const char *network, - unsigned int bits); -#endif - bool Curl_check_noproxy(const char *name, const char *no_proxy); #endif diff --git a/lib/progress.c b/lib/progress.c index 6cde5678be..db3e25a583 100644 --- a/lib/progress.c +++ b/lib/progress.c @@ -129,6 +129,8 @@ static void pgrs_speedinit(struct Curl_easy *data) /* * @unittest: 1606 */ +UNITTEST CURLcode pgrs_speedcheck(struct Curl_easy *data, + const struct curltime *pnow); UNITTEST CURLcode pgrs_speedcheck(struct Curl_easy *data, const struct curltime *pnow) { diff --git a/lib/progress.h b/lib/progress.h index 9cb0924ddc..43ec5a0764 100644 --- a/lib/progress.h +++ b/lib/progress.h @@ -82,9 +82,4 @@ void Curl_pgrsTimeWas(struct Curl_easy *data, timerid timer, void Curl_pgrsEarlyData(struct Curl_easy *data, curl_off_t sent); -#ifdef UNITTESTS -UNITTEST CURLcode pgrs_speedcheck(struct Curl_easy *data, - const struct curltime *pnow); -#endif - #endif /* HEADER_CURL_PROGRESS_H */ diff --git a/lib/uint-bset.c b/lib/uint-bset.c index 5efdbea282..268bbedbd1 100644 --- a/lib/uint-bset.c +++ b/lib/uint-bset.c @@ -68,6 +68,7 @@ void Curl_uint32_bset_destroy(struct uint32_bset *bset) } #ifdef UNITTESTS +UNITTEST uint32_t Curl_uint32_bset_capacity(struct uint32_bset *bset); UNITTEST uint32_t Curl_uint32_bset_capacity(struct uint32_bset *bset) { return bset->nslots * 64; diff --git a/lib/uint-bset.h b/lib/uint-bset.h index 7455c427df..ce0450c53c 100644 --- a/lib/uint-bset.h +++ b/lib/uint-bset.h @@ -56,9 +56,6 @@ CURLcode Curl_uint32_bset_resize(struct uint32_bset *bset, uint32_t nmax); /* Destroy the bitset, freeing all resources. */ void Curl_uint32_bset_destroy(struct uint32_bset *bset); -/* Get the bitset capacity, e.g. can hold numbers from 0 to capacity - 1. */ -uint32_t Curl_uint32_bset_capacity(struct uint32_bset *bset); - /* Get the cardinality of the bitset, e.g. numbers present in the set. */ uint32_t Curl_uint32_bset_count(struct uint32_bset *bset); diff --git a/lib/uint-hash.c b/lib/uint-hash.c index 2377840200..d9aeffdf2c 100644 --- a/lib/uint-hash.c +++ b/lib/uint-hash.c @@ -181,7 +181,8 @@ void *Curl_uint32_hash_get(struct uint_hash *h, uint32_t id) return NULL; } -static void uint_hash_clear(struct uint_hash *h) +UNITTEST void uint_hash_clear(struct uint_hash *h); +UNITTEST void uint_hash_clear(struct uint_hash *h) { if(h && h->table) { struct uint_hash_entry *he, **he_anchor; @@ -198,13 +199,6 @@ static void uint_hash_clear(struct uint_hash *h) } } -#ifdef UNITTESTS -UNITTEST void Curl_uint32_hash_clear(struct uint_hash *h) -{ - uint_hash_clear(h); -} -#endif - void Curl_uint32_hash_destroy(struct uint_hash *h) { DEBUGASSERT(h->init == CURL_UINT32_HASHINIT); diff --git a/lib/uint-hash.h b/lib/uint-hash.h index 56d7104355..3cbcf8f8f1 100644 --- a/lib/uint-hash.h +++ b/lib/uint-hash.h @@ -44,8 +44,6 @@ void Curl_uint32_hash_init(struct uint_hash *h, uint32_t slots, Curl_uint32_hash_dtor *dtor); void Curl_uint32_hash_destroy(struct uint_hash *h); -void Curl_uint32_hash_clear(struct uint_hash *h); - bool Curl_uint32_hash_set(struct uint_hash *h, uint32_t id, void *value); bool Curl_uint32_hash_remove(struct uint_hash *h, uint32_t id); void *Curl_uint32_hash_get(struct uint_hash *h, uint32_t id); diff --git a/lib/urlapi-int.h b/lib/urlapi-int.h index 29d4fe5f39..dc4323f939 100644 --- a/lib/urlapi-int.h +++ b/lib/urlapi-int.h @@ -32,11 +32,6 @@ CURLUcode Curl_url_set_authority(CURLU *u, const char *authority); CURLUcode Curl_junkscan(const char *url, size_t *urllen, bool allowspace); -#ifdef UNITTESTS -UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, struct dynbuf *host, - bool has_scheme); -#endif - #define U_CURLU_URLDECODE (unsigned int)CURLU_URLDECODE #define U_CURLU_PATH_AS_IS (unsigned int)CURLU_PATH_AS_IS diff --git a/lib/urlapi.c b/lib/urlapi.c index e9262b42fc..a300477a1b 100644 --- a/lib/urlapi.c +++ b/lib/urlapi.c @@ -332,6 +332,8 @@ out: return result; } +UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, struct dynbuf *host, + bool has_scheme); UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, struct dynbuf *host, bool has_scheme) { diff --git a/lib/vtls/x509asn1.c b/lib/vtls/x509asn1.c index 3000eb04ff..57f5f09a91 100644 --- a/lib/vtls/x509asn1.c +++ b/lib/vtls/x509asn1.c @@ -160,10 +160,6 @@ static const struct Curl_OID OIDtable[] = { * Please note there is no pretension here to rewrite a full SSL library. */ -static const char *getASN1Element(struct Curl_asn1Element *elem, - const char *beg, const char *end) - WARN_UNUSED_RESULT; - #define CURL_ASN1_MAX_RECURSIONS 16 static const char *getASN1Element_(struct Curl_asn1Element *elem, @@ -233,8 +229,13 @@ static const char *getASN1Element_(struct Curl_asn1Element *elem, return elem->end; } -static const char *getASN1Element(struct Curl_asn1Element *elem, - const char *beg, const char *end) +/* + * unit test @1657 + */ +UNITTEST const char *getASN1Element(struct Curl_asn1Element *elem, + const char *beg, const char *end); +UNITTEST const char *getASN1Element(struct Curl_asn1Element *elem, + const char *beg, const char *end) { return getASN1Element_(elem, beg, end, 0); } @@ -255,17 +256,6 @@ static const struct Curl_OID *searchOID(const char *oid) return NULL; } -#ifdef UNITTESTS -/* used by unit1657.c */ -CURLcode Curl_x509_getASN1Element(struct Curl_asn1Element *elem, - const char *beg, const char *end) -{ - if(getASN1Element(elem, beg, end)) - return CURLE_OK; - return CURLE_BAD_FUNCTION_ARGUMENT; -} -#endif - /* * Convert an ASN.1 Boolean value into its string representation. * @@ -427,6 +417,7 @@ static CURLcode utf8asn1str(struct dynbuf *to, int type, const char *from, * * @unittest 1666 */ +UNITTEST CURLcode encodeOID(struct dynbuf *buf, const char *b, const char *e); UNITTEST CURLcode encodeOID(struct dynbuf *store, const char *beg, const char *end) { @@ -511,8 +502,13 @@ static CURLcode OID2str(struct dynbuf *store, return result; } -static CURLcode GTime2str(struct dynbuf *store, - const char *beg, const char *end) +/* + * Unit test @1656 + */ +UNITTEST CURLcode GTime2str(struct dynbuf *store, + const char *beg, const char *end); +UNITTEST CURLcode GTime2str(struct dynbuf *store, + const char *beg, const char *end) { const char *tzp; const char *fracp; @@ -589,15 +585,6 @@ static CURLcode GTime2str(struct dynbuf *store, sep, (int)tzl, tzp); } -#ifdef UNITTESTS -/* used by unit1656.c */ -CURLcode Curl_x509_GTime2str(struct dynbuf *store, - const char *beg, const char *end) -{ - return GTime2str(store, beg, end); -} -#endif - /* * Convert an ASN.1 UTC time to a printable string. * diff --git a/lib/vtls/x509asn1.h b/lib/vtls/x509asn1.h index f26297b664..61ea452bcd 100644 --- a/lib/vtls/x509asn1.h +++ b/lib/vtls/x509asn1.h @@ -26,6 +26,8 @@ ***************************************************************************/ #include "curl_setup.h" +struct Curl_asn1Element; + #if defined(USE_GNUTLS) || defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || \ defined(USE_MBEDTLS) || defined(USE_RUSTLS) @@ -75,23 +77,6 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data, int certnum, const char *beg, const char *end); CURLcode Curl_verifyhost(struct Curl_cfilter *cf, struct Curl_easy *data, const char *beg, const char *end); - -#ifdef UNITTESTS -UNITTEST CURLcode encodeOID(struct dynbuf *store, - const char *beg, const char *end); - -#if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_MBEDTLS) || \ - defined(USE_RUSTLS) - -/* used by unit1656.c */ -CURLcode Curl_x509_GTime2str(struct dynbuf *store, - const char *beg, const char *end); -/* used by unit1657.c */ -CURLcode Curl_x509_getASN1Element(struct Curl_asn1Element *elem, - const char *beg, const char *end); -#endif /* USE_GNUTLS || USE_SCHANNEL || USE_MBEDTLS || RUSTLS */ -#endif /* UNITTESTS */ - #endif /* USE_GNUTLS || USE_WOLFSSL || USE_SCHANNEL || USE_MBEDTLS || USE_RUSTLS */ #endif /* HEADER_CURL_X509ASN1_H */ diff --git a/scripts/extract-unit-protos b/scripts/extract-unit-protos index b05c55295f..4fdcf99fad 100755 --- a/scripts/extract-unit-protos +++ b/scripts/extract-unit-protos @@ -27,15 +27,38 @@ use strict; use warnings; my @proto; +my %func; my %inc; sub scanfile { my ($file) = @_; open(F, "<$file") || die "$file failed"; + my $unit = 0; while() { - if($_ =~ /^UNITTEST .*\);/) { - push @proto, $_; - $inc{$file} = 1; + if($_ =~ /^UNITTEST .*[* ]([a-z0-9_]+)\(/i) { + my $n = $1; + if($func{$n}) { + # already prototyped, this is now the function itself + } + else { + $func{$n} = 1; + push @proto, $_; + $inc{$file} = 1; + $unit = 1; + } + } + if($unit) { + if($unit != 1) { + push @proto, $_; + } + if($_ =~ /\);/) { + # end of proto + $unit = 0; + } + else { + # proto continues + $unit++; + } } } close(F); diff --git a/src/tool_progress.c b/src/tool_progress.c index 6413473101..2f15e8f6ae 100644 --- a/src/tool_progress.c +++ b/src/tool_progress.c @@ -28,7 +28,10 @@ /* The point of this function would be to return a string of the input data, but never longer than 5 columns (+ one zero byte). - Add suffix k, M, G when suitable... */ + Add suffix k, M, G when suitable... + + Unit test @1622 +*/ UNITTEST char *max5data(curl_off_t bytes, char *max5, size_t mlen) { /* a signed 64-bit value is 8192 petabytes maximum */ @@ -85,8 +88,11 @@ int xferinfo_cb(void *clientp, return 0; } -/* Provide a time string that is 8 letters long (plus the zero byte) */ -UNITTEST void time2str(char *r, size_t rlen, curl_off_t seconds) +/* Provide a time string that is 8 letters long (plus the zero byte) + + Unit test @1622 + */ +UNITTEST void timebuf(char *r, size_t rlen, curl_off_t seconds) { curl_off_t h; if(seconds <= 0) { @@ -260,14 +266,14 @@ bool progress_meter(CURLM *multi, struct curltime *start, bool final) if(dlknown && speed) { curl_off_t est = all_dltotal / speed; curl_off_t left = (all_dltotal - all_dlnow) / speed; - time2str(time_left, sizeof(time_left), left); - time2str(time_total, sizeof(time_total), est); + timebuf(time_left, sizeof(time_left), left); + timebuf(time_total, sizeof(time_total), est); } else { - time2str(time_left, sizeof(time_left), 0); - time2str(time_total, sizeof(time_total), 0); + timebuf(time_left, sizeof(time_left), 0); + timebuf(time_total, sizeof(time_total), 0); } - time2str(time_spent, sizeof(time_spent), spent); + timebuf(time_spent, sizeof(time_spent), spent); (void)curl_multi_get_offt(multi, CURLMINFO_XFERS_ADDED, &xfers_added); (void)curl_multi_get_offt(multi, CURLMINFO_XFERS_RUNNING, &xfers_running); diff --git a/src/tool_progress.h b/src/tool_progress.h index d2ffc9206e..e07b5fd8d1 100644 --- a/src/tool_progress.h +++ b/src/tool_progress.h @@ -39,7 +39,7 @@ void progress_finalize(struct per_transfer *per); #ifdef UNITTESTS UNITTEST char *max5data(curl_off_t bytes, char *max5, size_t mlen); -UNITTEST void time2str(char *r, size_t rlen, curl_off_t seconds); +UNITTEST void timebuf(char *r, size_t rlen, curl_off_t seconds); #endif #endif /* HEADER_CURL_TOOL_PROGRESS_H */ diff --git a/tests/data/test1622 b/tests/data/test1622 index 7cd49b5a98..59895a60c6 100644 --- a/tests/data/test1622 +++ b/tests/data/test1622 @@ -22,7 +22,7 @@ tool%TESTNUMBER -time2str +timebuf 0 - %SP%SP%SP%SP%SP%SP%SP%SP 1 - 00:00:01 3 - 00:00:03 diff --git a/tests/data/test1656 b/tests/data/test1656 index 8a92e33779..007d744144 100644 --- a/tests/data/test1656 +++ b/tests/data/test1656 @@ -3,7 +3,7 @@ unittest -Curl_x509_GTime2str +GTime2str @@ -13,7 +13,7 @@ Curl_x509_GTime2str unittest -Curl_x509_GTime2str unit tests +GTime2str unit tests diff --git a/tests/data/test1657 b/tests/data/test1657 index e0f6ddab2a..40164230fe 100644 --- a/tests/data/test1657 +++ b/tests/data/test1657 @@ -3,7 +3,7 @@ unittest -Curl_x509_getASN1Element +getASN1Element @@ -13,7 +13,7 @@ Curl_x509_getASN1Element unittest -Curl_x509_getASN1Element unit tests +getASN1Element unit tests diff --git a/tests/libtest/first.h b/tests/libtest/first.h index 062cd169be..5b3ee2d448 100644 --- a/tests/libtest/first.h +++ b/tests/libtest/first.h @@ -43,6 +43,10 @@ extern const struct entry_s s_entries[]; extern int unitfail; /* for unittests */ +#ifdef UNITTESTS +#include "unitprotos.h" +#endif + #include "curlx/base64.h" /* for curlx_base64* */ #include "curlx/dynbuf.h" /* for curlx_dyn_*() */ #include "curlx/fopen.h" /* for curlx_f*() */ diff --git a/tests/tunit/tool1622.c b/tests/tunit/tool1622.c index fd380ed60c..de6bcd9633 100644 --- a/tests/tunit/tool1622.c +++ b/tests/tunit/tool1622.c @@ -42,9 +42,9 @@ static CURLcode test_tool1622(const char *arg) 0 /* end of list */ }; - puts("time2str"); + puts("timebuf"); for(i = 0, secs = 0; i < 63; i++) { - time2str(buffer, sizeof(buffer), secs); + timebuf(buffer, sizeof(buffer), secs); curl_mprintf("%20" FMT_OFF_T " - %s\n", secs, buffer); if(strlen(buffer) != 8) { curl_mprintf("^^ was too long!\n"); diff --git a/tests/unit/unit1300.c b/tests/unit/unit1300.c index 5fae379dce..a554cd5156 100644 --- a/tests/unit/unit1300.c +++ b/tests/unit/unit1300.c @@ -24,7 +24,6 @@ #include "unitcheck.h" #include "llist.h" -#include "unitprotos.h" static void test_Curl_llist_dtor(void *key, void *value) { diff --git a/tests/unit/unit1395.c b/tests/unit/unit1395.c index b80f9927d6..d25d0e3005 100644 --- a/tests/unit/unit1395.c +++ b/tests/unit/unit1395.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" -#include "unitprotos.h" static CURLcode test_unit1395(const char *arg) { diff --git a/tests/unit/unit1606.c b/tests/unit/unit1606.c index e8a09344a1..fb94f14698 100644 --- a/tests/unit/unit1606.c +++ b/tests/unit/unit1606.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "progress.h" #include "urldata.h" diff --git a/tests/unit/unit1608.c b/tests/unit/unit1608.c index 50a8787ada..e1cc478d72 100644 --- a/tests/unit/unit1608.c +++ b/tests/unit/unit1608.c @@ -24,13 +24,9 @@ #include "unitcheck.h" #ifndef CURL_DISABLE_SHUFFLE_DNS - #include "urldata.h" #include "curl_addrinfo.h" -CURLcode Curl_shuffle_addr(struct Curl_easy *data, - struct Curl_addrinfo **addr); - static struct Curl_addrinfo addrs[8]; static CURLcode t1608_setup(void) diff --git a/tests/unit/unit1616.c b/tests/unit/unit1616.c index a8381594aa..5043355d57 100644 --- a/tests/unit/unit1616.c +++ b/tests/unit/unit1616.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "uint-hash.h" static void t1616_mydtor(uint32_t id, void *elem) @@ -67,7 +66,7 @@ static CURLcode test_unit1616(const char *arg) abort_unless(v == value, "lookup present entry failed"); v = Curl_uint32_hash_get(&hash, key2); abort_unless(!v, "lookup missing entry failed"); - Curl_uint32_hash_clear(&hash); + uint_hash_clear(&hash); /* Attempt to add another key/value pair */ value2 = curlx_malloc(sizeof(int)); diff --git a/tests/unit/unit1636.c b/tests/unit/unit1636.c index d62ae48022..cb50879efe 100644 --- a/tests/unit/unit1636.c +++ b/tests/unit/unit1636.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" -#include "unitprotos.h" static CURLcode test_unit1636(const char *arg) { diff --git a/tests/unit/unit1650.c b/tests/unit/unit1650.c index 8c979cac58..f634cb4af2 100644 --- a/tests/unit/unit1650.c +++ b/tests/unit/unit1650.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "doh.h" static CURLcode test_unit1650(const char *arg) diff --git a/tests/unit/unit1653.c b/tests/unit/unit1653.c index 4c9c03d9cb..2cd8f0f6c1 100644 --- a/tests/unit/unit1653.c +++ b/tests/unit/unit1653.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "urldata.h" #include "curl/urlapi.h" #include "urlapi-int.h" diff --git a/tests/unit/unit1655.c b/tests/unit/unit1655.c index 91aca3f1a4..54f930b8b4 100644 --- a/tests/unit/unit1655.c +++ b/tests/unit/unit1655.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "doh.h" static CURLcode test_unit1655(const char *arg) diff --git a/tests/unit/unit1656.c b/tests/unit/unit1656.c index d3a6056947..e1cf6e1ec6 100644 --- a/tests/unit/unit1656.c +++ b/tests/unit/unit1656.c @@ -40,7 +40,7 @@ static bool do_test(const struct test_spec *spec, size_t i, const char *in = spec->input; curlx_dyn_reset(dbuf); - result = Curl_x509_GTime2str(dbuf, in, in + strlen(in)); + result = GTime2str(dbuf, in, in + strlen(in)); if(result != spec->result_exp) { curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n", i, spec->result_exp, result); diff --git a/tests/unit/unit1657.c b/tests/unit/unit1657.c index 7c769e78da..e728da94e2 100644 --- a/tests/unit/unit1657.c +++ b/tests/unit/unit1657.c @@ -67,6 +67,7 @@ static bool do_test1657(const struct test1657_spec *spec, size_t i, CURLcode result; struct Curl_asn1Element elem; const char *in; + const char *ptr; memset(&elem, 0, sizeof(elem)); curlx_dyn_reset(buf); @@ -76,7 +77,8 @@ static bool do_test1657(const struct test1657_spec *spec, size_t i, return FALSE; } in = curlx_dyn_ptr(buf); - result = Curl_x509_getASN1Element(&elem, in, in + curlx_dyn_len(buf)); + ptr = getASN1Element(&elem, in, in + curlx_dyn_len(buf)); + result = ptr ? CURLE_OK : CURLE_BAD_FUNCTION_ARGUMENT; if(result != spec->result_exp) { curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n", i, spec->result_exp, result); @@ -104,7 +106,7 @@ static CURLcode test_unit1657(const char *arg) if(!do_test1657(&test1657_specs[i], i, &dbuf)) all_ok = FALSE; } - fail_unless(all_ok, "some tests of Curl_x509_getASN1Element() fails"); + fail_unless(all_ok, "some tests of getASN1Element() fails"); curlx_dyn_free(&dbuf); curl_global_cleanup(); @@ -117,7 +119,7 @@ static CURLcode test_unit1657(const char *arg) static CURLcode test_unit1657(const char *arg) { UNITTEST_BEGIN_SIMPLE - puts("not tested since Curl_x509_getASN1Element() is not built in"); + puts("not tested since getASN1Element() is not built in"); UNITTEST_END_SIMPLE } diff --git a/tests/unit/unit1658.c b/tests/unit/unit1658.c index e7f753a4d0..efff31f2bf 100644 --- a/tests/unit/unit1658.c +++ b/tests/unit/unit1658.c @@ -36,12 +36,6 @@ static CURLcode t1658_setup(void) return CURLE_OK; } -extern CURLcode doh_resp_decode_httpsrr(struct Curl_easy *data, - const unsigned char *cp, size_t len, - struct Curl_https_rrinfo **hrr); -extern void doh_print_httpsrr(struct Curl_easy *data, - struct Curl_https_rrinfo *hrr); - /* * The idea here is that we pass one DNS packet at the time to the decoder. we * then generate a string output with the results and compare if it matches diff --git a/tests/unit/unit1666.c b/tests/unit/unit1666.c index ae24a2cebf..cc87a81d8f 100644 --- a/tests/unit/unit1666.c +++ b/tests/unit/unit1666.c @@ -25,7 +25,6 @@ #if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_MBEDTLS) || \ defined(USE_RUSTLS) - #include "vtls/x509asn1.h" #include "vtls/vtls.h" diff --git a/tests/unit/unit1979.c b/tests/unit/unit1979.c index 821ec5608d..b40bdad827 100644 --- a/tests/unit/unit1979.c +++ b/tests/unit/unit1979.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "http_aws_sigv4.h" static CURLcode test_unit1979(const char *arg) diff --git a/tests/unit/unit1980.c b/tests/unit/unit1980.c index 0c2977a11f..c15e11cb88 100644 --- a/tests/unit/unit1980.c +++ b/tests/unit/unit1980.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "http_aws_sigv4.h" static CURLcode test_unit1980(const char *arg) diff --git a/tests/unit/unit3211.c b/tests/unit/unit3211.c index 0d8bdf3487..277d37a8e4 100644 --- a/tests/unit/unit3211.c +++ b/tests/unit/unit3211.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "urldata.h" #include "uint-bset.h" #include "curl_trc.h" diff --git a/tests/unit/unit3212.c b/tests/unit/unit3212.c index 1f965f1b82..a8b7fbd660 100644 --- a/tests/unit/unit3212.c +++ b/tests/unit/unit3212.c @@ -26,7 +26,6 @@ #include "urldata.h" #include "uint-table.h" #include "curl_trc.h" -#include "unitprotos.h" #define TBL_SIZE 100 diff --git a/tests/unit/unit3213.c b/tests/unit/unit3213.c index e9b336911c..f288d4a3f5 100644 --- a/tests/unit/unit3213.c +++ b/tests/unit/unit3213.c @@ -26,7 +26,6 @@ #include "urldata.h" #include "uint-spbset.h" #include "curl_trc.h" -#include "unitprotos.h" static void check_spbset(const char *name, const uint32_t *s, size_t slen) {