Skip to content

test: keep RPC coverage dir under runner tmpdir#7306

Closed
thepastaclaw wants to merge 1 commit into
dashpay:developfrom
thepastaclaw:fix-7273-coverage-dir-under-runner-tmp
Closed

test: keep RPC coverage dir under runner tmpdir#7306
thepastaclaw wants to merge 1 commit into
dashpay:developfrom
thepastaclaw:fix-7273-coverage-dir-under-runner-tmp

Conversation

@thepastaclaw
Copy link
Copy Markdown

Summary

Motivation

test_runner.py --coverage currently creates the shared RPC coverage
directory directly under the system temp directory via
tempfile.mkdtemp(prefix="coverage").

In CI this can leave the coverage lifecycle outside the runner-owned temp tree,
which matches #7273 where /tmp/coverage* disappeared while
coverage-enabled functional tests were still running.

Changes

  • Pass the runner tmpdir into RPCCoverage.
  • Create the shared RPC coverage directory under that runner-managed temp tree.

Validation

  • python3 -m py_compile test/functional/test_runner.py
  • Smoke-tested RPCCoverage(tmpdir) creation/cleanup with a temporary parent
    directory.
  • Pre-PR code review gate: ship.

Fixes #7273.

@thepastaclaw
Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

✅ No Merge Conflicts Detected

This PR currently has no conflicts with other open PRs.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 56fe761c-565d-43db-833c-727577063493

📥 Commits

Reviewing files that changed from the base of the PR and between 4a0fd85 and 73d1bd5.

📒 Files selected for processing (1)
  • test/functional/test_runner.py

Walkthrough

The change modifies the RPCCoverage class to accept a tmpdir parameter in its constructor. The run_tests() function now passes the test's temporary directory to RPCCoverage during initialization, causing the coverage working directory to be created as a subdirectory of tmpdir rather than in a default system location.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: moving RPC coverage directory creation under the runner-managed tmpdir.
Description check ✅ Passed The description is well-related to the changeset, explaining the motivation (coverage dir lifecycle issues in CI), changes made, and validation performed.
Linked Issues check ✅ Passed The code changes directly address the linked issue #7273 by ensuring the shared RPC coverage directory is created under the runner-managed tmpdir, tying its lifecycle to the runner.
Out of Scope Changes check ✅ Passed All changes are in-scope, modifying only RPCCoverage.init to accept tmpdir and creating the coverage directory under it, directly addressing the linked issue.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@thepastaclaw
Copy link
Copy Markdown
Author

thepastaclaw commented May 5, 2026

✅ Review complete (commit 62452f2)

Copy link
Copy Markdown
Author

@thepastaclaw thepastaclaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Small, well-scoped fix moving the shared RPC coverage directory under the runner-managed tmpdir (created at test_runner.py:479) instead of the system tempdir. Lifecycle is correct: coverage.cleanup() at line 668 removes the subdirectory before the empty-tmpdir check at line 673, and RPCCoverage has no other callers. Both agents independently verified no regressions; nothing to flag.

Reviewed commit: 73d1bd5

@thepastaclaw thepastaclaw force-pushed the fix-7273-coverage-dir-under-runner-tmp branch from 73d1bd5 to 62452f2 Compare May 6, 2026 02:31
Copy link
Copy Markdown
Author

@thepastaclaw thepastaclaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Small, well-scoped change: RPCCoverage's coverage dir is now created under the runner-managed tmpdir. Verified lifecycle is correct — tmpdir is created (line 479) before RPCCoverage(tmpdir) is constructed (line 601), and coverage.cleanup() (line 668) runs before the empty-tmpdir rmdir check (line 673). RPCCoverage has only this one call site, so the constructor signature change is safe.

Reviewed commit: 62452f2

@thepastaclaw
Copy link
Copy Markdown
Author

Closing this as irrelevant/too speculative. The code path is inherited from upstream Bitcoin Core, and I don't have a Dash-specific reason strong enough to justify diverging from that backported test_runner behavior for a one-off coverage tempdir failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: coverage-enabled functional runs can lose shared /tmp/coverage dir

1 participant