trifectatechfoundation / sudo-rs

A memory safe implementation of sudo and su.
Other
2.88k stars 77 forks source link

Add CI only tests #726

Open oneElectron opened 1 year ago

oneElectron commented 1 year ago

This resolves issue #708. Any test that requires being run on the CI server is marked with #[ignore = ci]. I added -- --ignored to both the miri and build-and-test jobs. Opened as a draft because I don't know if anyone will have a problem with this solution.

oneElectron commented 1 year ago

An alternative that I have already tested is to create an env variable CI=1 which build.rs checks for and sets a cfg in rust. Any test that fails locally would be marked with #[cfg(is_ci)]

EDIT: This is a solution, but the issue is that marking a function with #[cfg(is_ci)] causes it not to compile, which means it generates warnings about unused imports and helper functions

oneElectron commented 1 year ago

The other method I see is to create a function fn quit_if_not_ci(), and call it in any test that fails locally. This is (at least to me) not the most ideal solution because it would requires importing the function and any test marked with this function will always pass, which may lead to confusion.