-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Ignore run-make tests that use symlink on Windows and adjust symlink wrapper #126846
Conversation
symlink creation is a priviledged operation on Windows that is normally not enabled on user machines. It is enabled in CI, however. So let's not make it easier to create symlinks on Windows.
rustbot has assigned @Mark-Simulacrum. Use |
We should ideally still be running these tests in CI. I'm somewhat uncomfortable with outright ignoring them on Windows. In the standard library we use the Also many developers do enable developer mode on their computer, so it'd be good if the tests did run locally in that situation. But I think that's a less pressing issue. |
I suppose we could add a directive
I'm not 100% sure on how to handle this, as in try to do a (maybe cached) symlink creation permission test (maybe in compiletest?)? Or something like (this isn't pretty, just illustrative) in the support library static HAS_WINDOWS_SYMLINK_PERMS: OnceLock<bool> = OnceLock::new();
fn symlink_wrapper(...) -> ... {
let has_symlink_perms = HAS_WINDOWS_SYMLINK_PERMS.get_or_init(|| {
let res = /* try do symlink */;
let can_symlink = res.is_ok();
/* remove the symlink */
can_symlink
});
/* do the symlink */
} (It's a heuristic and not robust to TOCTOU problems, but yes) |
clearly we should add
|
@jieyouxu |
That seems like it would be easy to do? Easy to cache even, The downside is that there's no enforcement. E.g. in CI there's no difference between using |
Not necessarily, e.g. |
r? @ChrisDenton (but seems right to me in direction + needs-symlink as the path) |
Closing this PR for #126862 which implements the cleaner needs-symlinks approach. |
Add needs-symlink directive to compiletest This is an alternative to rust-lang#126846 that allows running symlink tests on Windows in CI but will ignore them locally if symlinks aren't available. A future improvement would be to check that the `needs-symlink` directive is used in rmake files that call `create_symlink` but this is just a quick PR to unblock Windows users who want to run tests locally without enabling symlinks.
Rollup merge of rust-lang#126862 - ChrisDenton:needs-symlink, r=jieyouxu Add needs-symlink directive to compiletest This is an alternative to rust-lang#126846 that allows running symlink tests on Windows in CI but will ignore them locally if symlinks aren't available. A future improvement would be to check that the `needs-symlink` directive is used in rmake files that call `create_symlink` but this is just a quick PR to unblock Windows users who want to run tests locally without enabling symlinks.
Noticed in #125674 (comment).
This PR does two things:
//@ ignore-windows
since they rely on symlink functionality (they were//@ ignore-windows
originally).cc @petrochenkov since you ran into the failing tests.