unittests: cleanups

- make sure all UNITTEST prototypes mark in which unit test they are used,
  with "@unittest" markup

- make sure all UNITTEST functions do not use Curl_ prefix, as that is a
  prefix we use for global private functions and these functions are static
  and therefore not global and the prefix is wrong

- drop UNITTEST for functions not used in unit tests

- make the extract-unit-protos script highlight the above issues if found

- extract-unit-protos now also outputs the unit test number for all the
  generated protos in lib/unitprotos.h to aid readers. It also adds the source
  file and line number where the proto originates from.

- extract-unit-protos now exits with a non-zero value if any of the above
  warnings are triggered

- cf-dns: Curl_cf_dns_result => static cf_dns_result
- hostip: Curl_ipv6works => static ipv6works
- url: remove Curl_setup_conn() - not used anymore
- connect: Curl_timeleft_now_ms => UNITTEST timeleft_now_ms

Closes #21330
This commit is contained in:
Daniel Stenberg 2026-04-15 12:11:54 +02:00
parent 94f14c54b0
commit 7fd35f4c34
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
36 changed files with 248 additions and 216 deletions

View file

@ -33,7 +33,7 @@
#ifndef CURL_DISABLE_PROGRESS_METER
/* Provide a string that is 7 letters long (plus the zero byte).
Unit test 1636.
@unittest 1636
*/
UNITTEST void time2str(char *r, size_t rsize, curl_off_t seconds);
UNITTEST void time2str(char *r, size_t rsize, curl_off_t seconds)
@ -83,7 +83,7 @@ UNITTEST void time2str(char *r, size_t rsize, curl_off_t seconds)
but never longer than 6 columns (+ one zero byte).
Add suffix k, M, G when suitable...
Unit test 1636
@unittest 1636
*/
UNITTEST char *max6out(curl_off_t bytes, char *max6, size_t mlen);
UNITTEST char *max6out(curl_off_t bytes, char *max6, size_t mlen)
@ -127,7 +127,7 @@ static void pgrs_speedinit(struct Curl_easy *data)
}
/*
* @unittest: 1606
* @unittest 1606
*/
UNITTEST CURLcode pgrs_speedcheck(struct Curl_easy *data,
const struct curltime *pnow);