Adds argument --resultsfile
to test_runner.py.
Enables functional test results to be written to a (csv) file for processing by other applications (or for historical archiving).
Test name, status, and duration are written to the file provided with the argument.
Since test_runner.py
is being touched, also fixes a misspelling (linter warning). Can split into its own commit if desired.
Notes
- Total runtime of functional tests has seemed to have increased on my development machines over the past few months (more tests added, individual test runtime increase, etc.). Was interested in recording test runtime data over time to detect trends. Initially searched
doc/benchmarking.md
, existing PRs, and Issues, but didn’t immediately see this type of capability or alternate solutions (please chime in if you know of one!). Thought it would be beneficial to add this capability totest_runner
to facilitate this type of data analysis (and potentially other use cases) - Saw https://github.com/bitcoin/bitcoin/blob/master/test/functional/README.md#benchmarking-with-perf, and this PR’s higher level data seems complimentary.
- Was on the fence as to whether to expand
print_results()
(i.e. take advantage of the same loop overtest_results
) or implement in a separatewrite_results()
function. Decided on the latter for now, but interested in reviewers’ thoughts.
Example 1: all tests pass
0$ test/functional/test_runner.py --resultsfile functional_test_results.csv --cachedir=/mnt/tmp/cache --tmpdir=/mnt/tmp feature_blocksdir wallet_startup feature_config_args mempool_accept
1Temporary test directory at /mnt/tmp/test_runner_₿_🏃_20240614_201625
2Test results will be written to functional_test_results.csv
3...
4
5$ cat functional_test_results.csv
6test,status,duration(seconds)
7feature_blocksdir.py,Passed,1
8feature_config_args.py,Passed,29
9mempool_accept.py,Passed,9
10wallet_startup.py,Passed,2
11ALL,Passed,29
Example 2: one test failure
0$ cat functional_test_results.csv
1test,status,duration(seconds)
2feature_blocksdir.py,Passed,1
3feature_config_args.py,Passed,28
4wallet_startup.py,Passed,2
5mempool_accept.py,Failed,1
6ALL,Failed,28