Skip to content

Commit 1472df6

Browse files
committed
Merge bitcoin#28253: test: display abrupt shutdown errors in console output
0f83ab4 test: display abrupt shutdown errors in console output (furszy) Pull request description: Making it easier to debug errors in the CI environment, particularly in scenarios where it's not immediately clear what happened nor which node crashed (or shutdown abruptly). A bit of context: Currently, the test framework redirects each node's stderr output stream to a different temporary file inside each node's data directory. While this is sufficient for storing the error, it isn't very helpful for understanding what happened just by reading the CI console output. Most of the time, reading the stderr file in the CI environment is not possible, because people don't have access to it. Testing Note: The displayed error difference can be observed by cherry-picking this commit furszy@9cc5393 on top of this branch and running any functional test. ACKs for top commit: maflcko: lgtm ACK 0f83ab4 theStack: ACK 0f83ab4 Tree-SHA512: 83ce4d21d5316e8cb16a17d3fbe77b8649fced9e09410861d9674c233f6e9c34bcf573504e387e4f439c2841b2ee9855d0d35607fa13aa89eafe0080c45ee82d
2 parents 634b68f + 0f83ab4 commit 1472df6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/functional/test_framework/test_node.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,13 @@ def wait_for_rpc_connection(self):
234234
poll_per_s = 4
235235
for _ in range(poll_per_s * self.rpc_timeout):
236236
if self.process.poll() is not None:
237+
# Attach abrupt shutdown error/s to the exception message
238+
self.stderr.seek(0)
239+
str_error = ''.join(line.decode('utf-8') for line in self.stderr)
240+
str_error += "************************\n" if str_error else ''
241+
237242
raise FailedToStartError(self._node_msg(
238-
'bitcoind exited with status {} during initialization'.format(self.process.returncode)))
243+
f'bitcoind exited with status {self.process.returncode} during initialization. {str_error}'))
239244
try:
240245
rpc = get_rpc_proxy(
241246
rpc_url(self.datadir, self.index, self.chain, self.rpchost),

0 commit comments

Comments
 (0)