mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
test: Explain why test logging should be used
This commit is contained in:
@@ -145,7 +145,7 @@ levels using the logger included in the test_framework, e.g.
|
|||||||
`test_framework.log` and no logs are output to the console.
|
`test_framework.log` and no logs are output to the console.
|
||||||
- when run directly, *all* logs are written to `test_framework.log` and INFO
|
- when run directly, *all* logs are written to `test_framework.log` and INFO
|
||||||
level and above are output to the console.
|
level and above are output to the console.
|
||||||
- when run on Travis, no logs are output to the console. However, if a test
|
- when run by [our CI (Continuous Integration)](/ci/README.md), no logs are output to the console. However, if a test
|
||||||
fails, the `test_framework.log` and bitcoind `debug.log`s will all be dumped
|
fails, the `test_framework.log` and bitcoind `debug.log`s will all be dumped
|
||||||
to the console to help troubleshooting.
|
to the console to help troubleshooting.
|
||||||
|
|
||||||
|
|||||||
@@ -51,10 +51,13 @@ don't have test cases for.
|
|||||||
|
|
||||||
#### General test-writing advice
|
#### General test-writing advice
|
||||||
|
|
||||||
|
- Instead of inline comments or no test documentation at all, log the comments to the test log, e.g.
|
||||||
|
`self.log.info('Create enough transactions to fill a block')`. Logs make the test code easier to read and the test
|
||||||
|
logic easier [to debug](/test/README.md#test-logging).
|
||||||
- Set `self.num_nodes` to the minimum number of nodes necessary for the test.
|
- Set `self.num_nodes` to the minimum number of nodes necessary for the test.
|
||||||
Having additional unrequired nodes adds to the execution time of the test as
|
Having additional unrequired nodes adds to the execution time of the test as
|
||||||
well as memory/CPU/disk requirements (which is important when running tests in
|
well as memory/CPU/disk requirements (which is important when running tests in
|
||||||
parallel or on Travis).
|
parallel).
|
||||||
- Avoid stop-starting the nodes multiple times during the test if possible. A
|
- Avoid stop-starting the nodes multiple times during the test if possible. A
|
||||||
stop-start takes several seconds, so doing it several times blows up the
|
stop-start takes several seconds, so doing it several times blows up the
|
||||||
runtime of the test.
|
runtime of the test.
|
||||||
|
|||||||
Reference in New Issue
Block a user