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

run-make tests on Windows (wezterm + recent PowerShell 7) triggers Windows Error Reporting error dialogues #132092

Closed
jieyouxu opened this issue Oct 24, 2024 · 2 comments · Fixed by #132093
Assignees
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself A-run-make Area: port run-make Makefiles to rmake.rs C-bug Category: This is a bug. O-windows-msvc Toolchain: MSVC, Operating system: Windows T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@jieyouxu
Copy link
Member

jieyouxu commented Oct 24, 2024

Image

Some intended-to-fail run-make tests on Windows will spam a bunch of Windows Error Reporting (WER) error dialogues because failing to find DLLs and such. However, nobody else ran into this because it has three necessary conditions to trigger:

  1. You need to be using a terminal emulator that's not Windows Terminal™.
  2. You also need to be using a sufficiently new version of PowerShell.
  3. Oh, and you have to be using "native" Windows msvc (not msys2 or windows-gnu) and running the run-make test suite. Not many contributors do in the first place.

compiletest has a mitigation for this:

// Tell Windows to not show any UI on errors (such as terminating abnormally).
// This is important for running tests, since some of them use abnormal
// termination by design. This mode is inherited by all child processes.
unsafe {
let old_mode = SetErrorMode(SEM_NOGPFAULTERRORBOX); // read inherited flags
let old_mode = THREAD_ERROR_MODE(old_mode);
SetErrorMode(old_mode | SEM_NOGPFAULTERRORBOX);
let r = f();
SetErrorMode(old_mode);
r
}

However, this seems to be missing a SEM_FAILCRITICALERRORS flag.

@jieyouxu jieyouxu added A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself A-run-make Area: port run-make Makefiles to rmake.rs C-bug Category: This is a bug. O-windows Operating system: Windows T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Oct 24, 2024
@jieyouxu jieyouxu self-assigned this Oct 24, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 24, 2024
@jieyouxu jieyouxu added O-windows-msvc Toolchain: MSVC, Operating system: Windows and removed O-windows Operating system: Windows needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 24, 2024
@jieyouxu
Copy link
Member Author

jieyouxu commented Oct 24, 2024

EDIT: it's actually because how run-make tests are spawned, they are not guarded with disable_error_reporting.
EDIT2: yep that's exactly it

@jieyouxu
Copy link
Member Author

jieyouxu commented Oct 25, 2024

I had to get a recording of what this looks like

Incredible.Windows.Error.Reporting.mp4

@bors bors closed this as completed in 3fea422 Oct 25, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Oct 25, 2024
Rollup merge of rust-lang#132093 - jieyouxu:suppress-wer, r=onur-ozkan

compiletest: suppress Windows Error Reporting (WER) for `run-make` tests

WER by default will show a *bunch* of error dialogues for missing DLLs on Windows for `run-make` tests. We address that by:

1. Guarding `run-make` test process spawning with `disable_error_reporting`.
2. Fixing `disable_error_reporting` to also add the [`SEM_FAILCRITICALERRORS` flag to `SetErrorMode`][SetErrorMode]. Just `SEM_NOGPFAULTERRORBOX` was not sufficient to suppress error dialogues for e.g. missing DLLs.

Fixes rust-lang#132092. In particular, refer to that issue for the necessary conditions to observe these dialogues from popping up in the first place.

I was only able to manually test this locally in my "native" Windows msvc environment and it prevents the WER dialogues from popping up, I don't think it's possible to really test this automatically.

[SetErrorMode]: https://learn.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-seterrormode?redirectedfrom=MSDN#parameters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself A-run-make Area: port run-make Makefiles to rmake.rs C-bug Category: This is a bug. O-windows-msvc Toolchain: MSVC, Operating system: Windows T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants