Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/by-util/test_cp.rs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To be honest I think we should split test into separate test_cp_reflink_always_invalid_argument and test_cp_reflink_always_cross_device tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

don't hesitate to submit a new PR :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ fn test_cp_reflink_always_failure() {
.args(&["--reflink=always", "/dev/null", "target"])
.fails()
.no_stdout()
.stderr_contains("Invalid cross-device link");
.stderr_contains("ross-device link"); // cover both of glibc and musl

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
.stderr_contains("ross-device link"); // cover both of glibc and musl
.stderr_contains(if cfg!(target_env = "musl") {
"ross-device link"
} else {
"Invalid cross-device link"
});

I'd prefer to be more explicit here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think there is worth to increase complexity at here just for test.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the explicit cfg!(target_env = "musl") is worthwhile here. The test is covering a known difference in the diagnostic, so checking the expected string for each environment makes that clearer. The added complexity is small and limited to the test.

@oech3 oech3 Aug 30, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It does not cover the case musl started aligning message with GNU at some version (or inverse).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If the platform message changes, I think it's useful for the test to fail. It flags the change and lets us decide if anything needs updating.

}

#[test]
Expand Down
Loading