Skip to content
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

Optimize expensive Miri tests #391

Closed
joshlf opened this issue Sep 18, 2023 · 0 comments · Fixed by #395
Closed

Optimize expensive Miri tests #391

joshlf opened this issue Sep 18, 2023 · 0 comments · Fixed by #395
Labels
compatibility-nonbreaking Changes that are (likely to be) non-breaking experience-medium This issue is of medium difficulty, and requires some experience help wanted Extra attention is needed

Comments

@joshlf
Copy link
Member

joshlf commented Sep 18, 2023

Some tests are either marked #[cfg_attr(miri, ignore)] or have parameters set to smaller values under cfg!(miri). Even still, they are often expensive when executed, and it would be good to optimize them to save time in CI.

EDIT: It looks like this and related Miri optimizations are backwards, doing the expensive thing under Miri rather than the cheap thing:

zerocopy/src/lib.rs

Lines 3389 to 3393 in 524b2e2

let assert_msg = if cfg!(miri) {
format!("\n{args:?}\nsize:{size}, align:{align}")
} else {
String::new()
};

@joshlf joshlf added help wanted Extra attention is needed experience-medium This issue is of medium difficulty, and requires some experience compatibility-nonbreaking Changes that are (likely to be) non-breaking labels Sep 18, 2023
joshlf added a commit that referenced this issue Sep 19, 2023
Previously, we had logic to omit expensive formatting when running
`test_validate_rust_layout` under Miri, but this was typo'd to have the
opposite effect as intended - the expensive formatting would run /only/
when running under Miri. This commit fixes that typo, and as a result,
the test in question runs fast enough that we can remove other logic
designed to speed up execution only under Miri.

Closes #391
joshlf added a commit that referenced this issue Sep 19, 2023
Previously, we had logic to omit expensive formatting when running
`test_validate_rust_layout` under Miri, but this was typo'd to have the
opposite effect as intended - the expensive formatting would run /only/
when running under Miri. This commit fixes that typo, and as a result,
the test in question runs fast enough that we can remove other logic
designed to speed up execution only under Miri.

Closes #391
@joshlf joshlf mentioned this issue Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility-nonbreaking Changes that are (likely to be) non-breaking experience-medium This issue is of medium difficulty, and requires some experience help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant