Torture
When curl is builtdebug enabled, it offers a special kind oftesting. The tests we calltorture tests. Do not worry, it is not quite asgrim as it may sound.
They verify that libcurl and curl exit paths work without any crash or memoryleak happening,
The torture tests work like this:
- run the single test as-is first
- count the number of invokedfallible functions
- rerun the test once for every falling function call
- make each fallible function call return error, one by one
- verify that there is no leak or crash
- continue until all fallible functions have been made to fail
This way of testing can take a seriously long time. I advise you to switch offvalgrind when trying this out.
Rerun a specific failure
If a single test fails,runtests.pl
identifies exactly which "round" thattriggered the problem and by using the-t
as shown, you can run a commandline that when invokedonly fails that particular fallible function.
Shallow
To make this way of testing a little more practical, the test suite alsoprovides a--shallow
option. This lets the user set a maximum number offallible functions to fail per test case. If there are more invokes to failthan is set with this value, the script randomly selects which ones to fail.
As a special feature, as randomizing things in tests can be uncomfortable, thescript uses a random seed based on year + month, so it remains the same foreach calendar month. Convenient, as if you rerun the same test with the same--shallow
value it runs the same random tests.
You can force a different seed with runtests'--seed
option.