Skip to content

Commit cf4cb28

Browse files
author
MarcoFalke
committed
Merge #18305: test: Explain why test logging should be used
ffff9dc test: Explain why test logging should be used (MarcoFalke) Pull request description: Background is that some tests don't have any `self.log` call at all. Thus there are no "anchor points" and those tests are hard to debug because the logs can't easily be parsed by a human. ACKs for top commit: jonatack: ACK ffff9dc instagibbs: ACK bitcoin/bitcoin@ffff9dc fanquake: re-ACK ffff9dc Tree-SHA512: 08d962e85c4892c2a0c58feb5dc697c680a9d68e41a79417da6fcd415e0c5c735c4533a985cf225bb89deb5ca717d9bedf990657958079185804caa512b10f5a
2 parents 5d92ac2 + ffff9dc commit cf4cb28

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

test/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ levels using the logger included in the test_framework, e.g.
145145
`test_framework.log` and no logs are output to the console.
146146
- when run directly, *all* logs are written to `test_framework.log` and INFO
147147
level and above are output to the console.
148-
- when run on Travis, no logs are output to the console. However, if a test
148+
- when run by [our CI (Continuous Integration)](/ci/README.md), no logs are output to the console. However, if a test
149149
fails, the `test_framework.log` and bitcoind `debug.log`s will all be dumped
150150
to the console to help troubleshooting.
151151

test/functional/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,13 @@ don't have test cases for.
5151

5252
#### General test-writing advice
5353

54+
- Instead of inline comments or no test documentation at all, log the comments to the test log, e.g.
55+
`self.log.info('Create enough transactions to fill a block')`. Logs make the test code easier to read and the test
56+
logic easier [to debug](/test/README.md#test-logging).
5457
- Set `self.num_nodes` to the minimum number of nodes necessary for the test.
5558
Having additional unrequired nodes adds to the execution time of the test as
5659
well as memory/CPU/disk requirements (which is important when running tests in
57-
parallel or on Travis).
60+
parallel).
5861
- Avoid stop-starting the nodes multiple times during the test if possible. A
5962
stop-start takes several seconds, so doing it several times blows up the
6063
runtime of the test.

0 commit comments

Comments
 (0)