refactor: replace cfg with cfg_attr(ignore)#380
Merged
Conversation
…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
Contributor
There was a problem hiding this comment.
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
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>
Performance Regression Reportscommit: 78a32f6 There are no regressions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
#[cfg(unix)]from module level to individual test attributes using#[cfg_attr(not(unix), ignore)]#[cfg(target_os = "linux")]with#[cfg_attr(not(target_os = "linux"), ignore)]on the/procfilesystem test#[cfg(target_os = "macos")]with#[cfg_attr(not(target_os = "macos"), ignore)]on the/devfilesystem testdifferent_filesystem_returns_different_ids→different_filesystem_returns_different_ids_linuxdifferent_filesystem_returns_different_ids→different_filesystem_returns_different_ids_macosImplementation 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