runtests: support memory-limits per test

The idea here is to set limits per test how many allocations and maximum
amount of memory it is allowed to use. This is a means to make sure the
number and total size of allocations are kept in check and don't
mistakenly "blow up".

If runtests.pl detects that the given limits have been exceeded it fails
the test case with an error.

The `<verify>` part now supports `<limits>`, and in this section two
limits can be set for each test (verified in debug builds only):

    Allocations: [number of allocation calls]
    Maximum allocated: [maximum concurrent memory allocated]

Default limits (used if nothing is set in the test file):

    Allocations: 1000
    Maximum allocated: 1000000

Closes #17821
This commit is contained in:
Daniel Stenberg 2025-07-04 23:57:03 +02:00
parent 2db8ae480f
commit f00a2add71
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
22 changed files with 120 additions and 1 deletions

View file

@ -699,6 +699,14 @@ test.
`loadfile="filename"` makes loading the data from an external file.
### `<limit>`
When this test runs and curl was built with debug enabled, runtests make sure
that the set limits are not exceeded. Supported limits:
Allocations: [number of allocation calls]
Maximum allocated: [maximum concurrent memory allocated]
### `<file name="%LOGDIR/filename" [mode="text"]>`
The file's contents must be identical to this after the test is complete. Use
the mode="text" attribute if the output is in text mode on platforms that have