Skip to content

tests: Use #[should_panic] instead of #[ignore] where possible #7875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RenjiSann
Copy link
Collaborator

No description provided.

Copy link

github-actions bot commented May 2, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)

@sylvestre
Copy link
Contributor

many jobs are failing :)

@RenjiSann RenjiSann marked this pull request as draft May 5, 2025 07:49
@RenjiSann
Copy link
Collaborator Author

Yes, looks harder than what I anticipated ^^'

@RenjiSann RenjiSann force-pushed the test-ignore-to-should-panic branch from a0018af to 80567e3 Compare May 5, 2025 07:53
Copy link

github-actions bot commented May 5, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@BenWiederhake
Copy link
Collaborator

In many cases, a test is correct and should pass – but the feature that's being tested is implemented incorrectly. In those cases, "should_panic" is just wrong. For example, test_bre11 is perfectly fine, just our implementation is buggy.

Arguably, ignore isn't correct, but it's a better way than should_panic to deal with the fact that it's a known issue.

@RenjiSann
Copy link
Collaborator Author

Arguably, ignore isn't correct, but it's a better way than should_panic to deal with the fact that it's a known issue.

I understand, but I tend to disagree. Ignoring a test will skip it no matter what, so if we were to fix it by accident, we wouldn't notice and could regress it without even knowing it. Using #[should_panic] allows us to detect when a test we expect to fail (be it because of upstream bugs, or non-implemented features) actually passes.

I agree that both ignore and should_panic are semantically incorrect. At my work place, we have a testsuite framework that accepts PASS, FAIL, SKIP, and XFAIL (expected fail) for a test result, and one can specify the reason behind the expected fail. I wanted to replicate that XFAIL within the coreutils¸ but even though, Rust's framework will still report PASS for a test that successfully panics, when I'd want "XFAIL" or something similar.

In any cases, I don't have a very strong feeling about this. I think it could help, but I may be mistaken.

Regarding the expr's bre11 testcase, the issue actually comes down to a bug in the oniguruma bindings crate. Dunno if we want to look for an alternative now that it was archived, but that's a matter for another issue.

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