HomePhabricator

[tests] Combine logs on failure

Description

[tests] Combine logs on failure

Summary:

Currently, when a functional test fails, the debug logs are printed
sequentially to the travis log. This makes debugging race conditions
based on the travis log hard. Instead, all logs events should be
combined and sorted by their timestamp, then appended to the travis log.

This diff replaces the PYTHON_DEBUG environment variable with a proper
--combinedlogslen argument that let the user choose how many log lines
to combine and print in case of failure. The intent is to help debugging
eventual races between tests when run on CI.

I tried to keep this backport as close as possible from the PR despite
the divergences in the test_runner.py code.

Backport of core PR11789
https://github.com/bitcoin/bitcoin/pull/11789/files

Depends on D3422 and D3423

Test Plan:
Modify a functional test to make it fail then run:

./test/functional/test_runner.py <test> --combinedlogslen=1000

The node(s) and test logs should be printed combined before the summary.

./test/functional/test_runner.py

Should exhibit no behavior change.

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D3424

Details

Provenance
John Newbery <john@johnnewbery.com>Authored on Nov 29 2017, 18:21
FabienCommitted on Jun 27 2019, 07:53
FabienPushed on Jun 27 2019, 07:53
Reviewer
Restricted Project
Differential Revision
D3424: [tests] Combine logs on failure
Parents
rABCf57e432a8c1a: Fix the timestamp format when -logtimemicros is set
Branches
Unknown
Tags
Unknown