Skip to content

refactor: replace cfg with cfg_attr(ignore)#380

Merged
KSXGitHub merged 1 commit intomasterfrom
claude/cfg-attr-ignore-tests-NK5MN
Mar 28, 2026
Merged

refactor: replace cfg with cfg_attr(ignore)#380
KSXGitHub merged 1 commit intomasterfrom
claude/cfg-attr-ignore-tests-NK5MN

Conversation

@KSXGitHub
Copy link
Copy Markdown
Owner

Summary

Refactored test configuration to use #[cfg_attr(..., ignore)] instead of #[cfg(...)] for platform-specific tests. This allows tests to be discovered and reported as ignored on unsupported platforms rather than being completely excluded from compilation.

Key Changes

  • Moved #[cfg(unix)] from module level to individual test attributes using #[cfg_attr(not(unix), ignore)]
  • Replaced #[cfg(target_os = "linux")] with #[cfg_attr(not(target_os = "linux"), ignore)] on the /proc filesystem test
  • Replaced #[cfg(target_os = "macos")] with #[cfg_attr(not(target_os = "macos"), ignore)] on the /dev filesystem test
  • Renamed duplicate test function names to be platform-specific:
    • different_filesystem_returns_different_idsdifferent_filesystem_returns_different_ids_linux
    • different_filesystem_returns_different_idsdifferent_filesystem_returns_different_ids_macos

Implementation Details

This change improves test visibility and reporting by allowing the test runner to discover all tests regardless of platform, marking platform-specific tests as ignored when run on unsupported systems. This provides better test coverage reporting and clearer indication of which tests are skipped and why.

https://claude.ai/code/session_01UJVc5eCuHdjJwKFpcV82vP

…e_id tests

The device_id tests compile on all platforms since get_device_id and
DeviceId exist everywhere. Use cfg_attr ignore instead of cfg gates so
these tests are still compiled (catching type errors early) but skipped
at runtime on unsupported platforms. Rename the duplicate-named
different_filesystem_returns_different_ids functions to unique names
to allow both to coexist without cfg gates.

https://claude.ai/code/session_01UJVc5eCuHdjJwKFpcV82vP
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors platform-specific unit tests in fs_tree_builder::device_id to be compiled everywhere and reported as ignored on unsupported platforms, matching the repo’s documented approach for conditional test skipping.

Changes:

  • Remove module-level #[cfg(unix)] gating for the test module.
  • Add #[cfg_attr(..., ignore = "...")] to individual tests to skip them at runtime on unsupported platforms.
  • Rename duplicate test functions to platform-specific names to avoid conflicts.

@KSXGitHub KSXGitHub marked this pull request as ready for review March 28, 2026 17:50
@KSXGitHub KSXGitHub merged commit 2f11666 into master Mar 28, 2026
17 checks passed
@KSXGitHub KSXGitHub deleted the claude/cfg-attr-ignore-tests-NK5MN branch March 28, 2026 17:51
KSXGitHub added a commit that referenced this pull request Mar 28, 2026
The device_id tests compile on all platforms since get_device_id and
DeviceId exist everywhere. Use cfg_attr ignore instead of cfg gates so
these tests are still compiled (catching type errors early) but skipped
at runtime on unsupported platforms. Rename the duplicate-named
different_filesystem_returns_different_ids functions to unique names
to allow both to coexist without cfg gates.

https://claude.ai/code/session_01UJVc5eCuHdjJwKFpcV82vP

Co-authored-by: Claude <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Performance Regression Reports

commit: 78a32f6

There are no regressions.

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.

3 participants