test: handle mainnet logs in combine_logs.py #36982

Manually merged
l0rinc merged 1 commit from l0rinc/combine-logs-mainnet into master 2026-11-25 17:59:22 +00:00 AGit
l0rinc commented 2026-11-25 14:10:47 +00:00 (Migrated from github.com)

Problem: Running combine_logs.py on the logs from a mainnet functional test such as rpc_validateaddress.py raises AttributeError. The helper expects a path like node0/regtest/debug.log, but mainnet writes node0/debug.log.

Before #16973, the helper silently skipped the mainnet log. That PR made the search recursive, so it finds the log and then fails when the regex tries to extract a subdirectory.

Fix: Get the log directory relative to node0/ from the path the script already found.

Manual reproducer

From the repository root with a functional-test build:

dir=$(mktemp -d)
build/test/functional/rpc_validateaddress.py --tmpdir="$dir/run" --nocleanup
test/functional/combine_logs.py "$dir/run"

The address-validation test passes. Before the fix, the last command fails in read_logs():

  File "test/functional/combine_logs.py", line 88, in read_logs
    chain = re.search(r'node0/(.+?)/debug\.log$', debug_logs[0].as_posix()).group(1)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'group'

With the fix, the same command prints both the test and node0 log entries in timestamp order.

**Problem:** Running `combine_logs.py` on the logs from a mainnet functional test such as `rpc_validateaddress.py` raises `AttributeError`. The helper expects a path like `node0/regtest/debug.log`, but mainnet writes `node0/debug.log`. Before #16973, the helper silently skipped the mainnet log. That PR made the search recursive, so it finds the log and then fails when the regex tries to extract a subdirectory. **Fix:** Get the log directory relative to `node0/` from the path the script already found. <details> <summary>Manual reproducer</summary> From the repository root with a functional-test build: ```bash dir=$(mktemp -d) build/test/functional/rpc_validateaddress.py --tmpdir="$dir/run" --nocleanup test/functional/combine_logs.py "$dir/run" ``` The address-validation test passes. Before the fix, the last command fails in `read_logs()`: ```text File "test/functional/combine_logs.py", line 88, in read_logs chain = re.search(r'node0/(.+?)/debug\.log$', debug_logs[0].as_posix()).group(1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'group' ``` With the fix, the same command prints both the `test` and `node0` log entries in timestamp order. </details>
DrahtBot commented 2026-11-25 14:10:57 +00:00 (Migrated from github.com)

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK maflcko, mzumsande

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36982 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36982.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36982#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | ACK | [maflcko](https://github.com/bitcoin/bitcoin/pull/36982#issuecomment-7167023411), [mzumsande](https://github.com/bitcoin/bitcoin/pull/36982#pullrequestreview-6061156735) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--5faf32d7da4f0f540f40219e4f7537a3-->
fanquake commented 2026-11-25 14:14:52 +00:00 (Migrated from github.com)
If this is broken, that seems like more reason to remove entirely, rather than fix: https://github.com/bitcoin/bitcoin/pull/36958#issuecomment-7138986376.
l0rinc commented 2026-11-25 15:18:37 +00:00 (Migrated from github.com)

If this is broken, that seems like more reason to remove entirely, rather than fix: #36958 (comment).

Was wondering about the same, closing and +1 for removal

> If this is broken, that seems like more reason to remove entirely, rather than fix: [#36958 (comment)](https://github.com/bitcoin/bitcoin/pull/36958#issuecomment-7138986376). Was wondering about the same, closing and +1 for removal
maflcko commented 2026-11-25 15:33:19 +00:00 (Migrated from github.com)

lgtm ACK 4e1dc2e015

lgtm ACK 4e1dc2e01511ef9328a54fbbf756cb8c159898a7
maflcko commented 2026-11-25 15:35:10 +00:00 (Migrated from github.com)

This is used by the test runner, it can't be removed:

test/functional/test_runner.py:                    combined_logs_args = [sys.executable, os.path.join(tests_dir, 'combine_logs.py'), testdir]
This is used by the test runner, it can't be removed: ``` test/functional/test_runner.py: combined_logs_args = [sys.executable, os.path.join(tests_dir, 'combine_logs.py'), testdir]
fanquake commented 2026-11-25 16:17:25 +00:00 (Migrated from github.com)

Yea, sorry. This can be fixed (and backported).

Yea, sorry. This can be fixed (and backported).
mzumsande (Migrated from github.com) reviewed 2026-11-25 16:27:50 +00:00
mzumsande (Migrated from github.com) left a comment

Code Review ACK 4e1dc2e015

I use combine_logs.py often, but apparently never with a mainnet test.

Special constellations such as feature_config_args.py (multiple chains for one node) and wallet_crosschain.py (mixed chains) will still not behave ideally, but I don't think this is worth fixing - it seems good enough for me.

Code Review ACK 4e1dc2e01511ef9328a54fbbf756cb8c159898a7 I use `combine_logs.py` often, but apparently never with a mainnet test. Special constellations such as `feature_config_args.py` (multiple chains for one node) and `wallet_crosschain.py` (mixed chains) will still not behave ideally, but I don't think this is worth fixing - it seems good enough for me.
fanquake commented 2026-11-25 18:04:02 +00:00 (Migrated from github.com)

Backported to 32.x in #36984.

Backported to `32.x` in #36984.
First-time contributor

No findings were published from this review.

Review coverage was incomplete.


Reviewed: 4e1dc2e01511 · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:806938d40e279b6d701b2e78128bb1a09b55193a0b697245a1dce6241d3081c1:3607c760b63c01fb7f1f349adfc3fd0614b148a7df02e42f2f0edc2d448925a1 --> <!-- ralph-base:5ba05739881855cba25c3c05d6f82a61b8a0665f --> <!-- ralph-head:4e1dc2e01511ef9328a54fbbf756cb8c159898a7 --> <!-- ralph-case:21bd4fc68d1101c79382b635925b2ec5d11b2add0bcc3fcd4d30961f6f46b5a7 --> No findings were published from this review. Review coverage was incomplete. <!-- Review tier: sensitive --> --- Reviewed: [`4e1dc2e01511`](<https://git.fish.foo/bitcoin/bitcoin/commit/4e1dc2e01511ef9328a54fbbf756cb8c159898a7>) · [Review report](<https://review.fish.foo/report/36982-4e1dc2e01511ef9328a54fbbf756cb8c159898a7-3125-1.html>) · [Previous reports](<https://review.fish.foo/traces/36982/>) [permalink](<https://review.fish.foo/report/36982-4e1dc2e01511ef9328a54fbbf756cb8c159898a7-3125-1.html>)
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!36982
No description provided.