close
Skip to content

Resolving Windows environment test failures#156562

Open
lms0806 wants to merge 1 commit into
rust-lang:mainfrom
lms0806:issue_156558
Open

Resolving Windows environment test failures#156562
lms0806 wants to merge 1 commit into
rust-lang:mainfrom
lms0806:issue_156558

Conversation

@lms0806
Copy link
Copy Markdown
Contributor

@lms0806 lms0806 commented May 14, 2026

This resolves an issue where the fs::tests::test_fs_set_times follows symlink and fs::tests::test_fs_set_times_nofollow tests failed locally due to permission issues in a Windows environment.

The code has been modified so that these tests do not proceed if permissions are not granted.

Since these tests can be passed with the necessary permissions via CI before merging, I believe it is appropriate for them to pass locally due to permission issues rather than fail.

Close #156558

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 14, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 14, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 8 candidates

Comment thread library/std/src/fs/tests.rs Outdated
use crate::os::windows::fs::FileTimesExt;

let tmp = tmpdir();
#[cfg(windows)]
Copy link
Copy Markdown
Contributor

@petrochenkov petrochenkov May 14, 2026

Choose a reason for hiding this comment

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

The cfgs are redundant, none of the other uses of got_symlink_permission use them.

View changes since the review

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.

Then, do I just need to make sure that the test passes locally in a Windows environment as well?

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 would recommend testing it in a Windows env/VM, and run the same command as AngelicosPhosphorus: python x.py test library/std --stage 1 (confirm that the OS doesn't have the required privileges for the test as mentioned by Angelicos). It should report no errors if it works.

Also, repeating what petro is saying, the #[cfg(windows)] line is redundant because internally got_symlink_permission returns true if the OS this test is running on is not windows or env var is "CI", so you don't need to worry about the return early exit 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 confirmed that when running python x.py test library/std --stage 1 on a Windows 10 environment, all tests passed successfully regarding the PR I submitted.

It is correct that the part I modified skips two tests due to permission issues in the Windows environment, so it has been confirmed to be working correctly.

Copy link
Copy Markdown
Contributor

@asder8215 asder8215 May 18, 2026

Choose a reason for hiding this comment

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

I'm glad to hear that the tests are passing. Are you able to amend your commit to remove the #[cfg(windows)] lines?

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 have modified and completed the commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standard library tests about symlinks fail on Windows 10

5 participants