Commit Graph

7 Commits

Author SHA1 Message Date
Daniel Stenberg
6d6899c2f0 tool: support fractions for --limit-rate and --max-filesize
Allow 2.5k or 3.7M etc. Add mention in documentation.

Verify in test case 1623.

Closes #20266
2026-01-17 23:25:26 +01:00
Daniel Stenberg
b32e66a8ee tool_progress: fix large time outputs and decimal size display
Time output:

- was broken for really large times

- now uses spaces instead of --:--:--

- >99999y is now the largest shown time

- show HH:MM:SS as long as hours are fewer than 100

Size:

- made the decimal output always only use a single decimal

Test:

- Add test 1622 to verify these functions

Closes #20177
2026-01-04 00:16:59 +01:00
Viktor Szakats
53c88435d8 build: split .c and .h file lists in tests
It allows to pass `.h` files only where they are really needed, which is
`EXTRA_DIST` (or `*SOURCES`) for autotools.

Also:
- rename variables to be shorter and consistent.
- drop references to non-local headers. We don't need to pass them as
  dist sources.
- drop empty variables and references, after the above.
- server: add placeholder `UTIL_H`.

Closes #17745
2025-06-26 10:20:41 +02:00
Viktor Szakats
7d8fa8276d tests: drop BUNDLE_SRC variable
Derive it from `$BUNDLE` instead. autotools seems to be already relying
on `$BUNDLE_SRC` being equal to `$BUNDLE.c`. (I haven't realized this
before aaebb45f58b3f62876a68c17c71ac37d98f1b3bb.)

Also drop redundant `nodist_<target>_SOURCE` lines in tunits and units.

Follow-up to aaebb45f58 #17688
Follow-up to 2c27a67daa #17590

Closes #17692
2025-06-21 10:49:05 +02:00
Viktor Szakats
2c27a67daa tests: always make bundles, adapt build and tests
Make test bundles the default. Drop non-bundle build mode.
Also do all the optimizations and tidy-ups this allows, simpler builds,
less bundle exceptions, streamlined build mechanics.

Also rework the init/deinit macro magic for unit tests. The new method
allows using unique init/deinit function names, and calling them with
arguments. This is in turn makes it possible to reduce the use of global
variables.

Note this drop existing build options `-DCURL_TEST_BUNDLES=` from cmake
and `--enable-test-bundles` / `--disable-test-bundles` from autotools.

Also:
- rename test entry functions to have unique names: `test_<testname>`
  This removes the last exception that was handled in the generator.
- fix `make dist` to not miss test sources with test bundles enabled.
- sync and merge `tests/mk-bundle.pl` into `scripts/mk-unity.pl`.
- mk-unity.pl: add `--embed` option and use it when `CURL_CLANG_TIDY=ON`
  to ensure that `clang-tidy` does not miss external test C sources.
  (because `clang-tidy` ignores code that's #included.)
- tests/unit: drop no-op setup/stop functions.
- tests: reduce symbol scopes, global macros, other fixes and tidy-ups.
- tool1621: fix to run, also fix it to pass.
- sockfilt: fix Windows compiler warning in certain unity include order,
  by explicitly including `warnless.h`.

Follow-up to 6897aeb105 #17468

Closes #17590
2025-06-14 21:08:23 +02:00
Daniel Stenberg
220eda34cd tests: separate tunit tests from unit tests more
- unit tests need no tool code as they are libcurl unit tests
- unit test 1621 is now tunit test 1621 instead, as it tests tool code
- build unit tests with BUILDING_LIBCURL as they pretent to be libcurl

Closes #17259
2025-05-06 17:25:22 +02:00
Daniel Stenberg
461ebbd336 tests/tunit: make a separate directory for tool-based unit tests
Separated from library based unit tests to not confuse memory management
etc. Move 1394 and 1604 there.

Closes #16983
2025-04-08 08:08:05 +02:00