Skip to content

Run ui tests on the parallel frontend#153801

Draft
ywxt wants to merge 2 commits intorust-lang:mainfrom
ywxt:parallel-test
Draft

Run ui tests on the parallel frontend#153801
ywxt wants to merge 2 commits intorust-lang:mainfrom
ywxt:parallel-test

Conversation

@ywxt
Copy link
Contributor

@ywxt ywxt commented Mar 13, 2026

This PR adds two arguments for tests:

  1. --parallel-frontend-threads: specify -Zthread to compile test case (currently UI tests only)
  2. --iteration-count: the number of times to run each test

Also, due to the non-deterministic diagnostic orders and cycle errors, this PR adds the directive //@ ignore-parallel-frontend to ignore tests with cycle error when the parallel-frontend is enabled (by --parallel-frontend-threads) and enables //@ compare-output-by-lines by default.

Context: #t-compiler/parallel-rustc > Add the parallel front-end test suite @ 💬

This PR should work with #153797 together.

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 13, 2026
@rust-log-analyzer

This comment has been minimized.

@petrochenkov petrochenkov self-assigned this Mar 13, 2026
@ywxt
Copy link
Contributor Author

ywxt commented Mar 13, 2026

@petrochenkov petrochenkov added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 13, 2026
@petrochenkov
Copy link
Contributor

This may be a bit silly, but to avoid many unnecessary changes in stderr files you could put the //@ ignore-parallel-frontend into the first empty lines in tests, like I did with //@ check-pass in #151130 (the directives shouldn't necessarily be at the top).
Hopefully the ignores will be removed away sooner or later, so this way we'll avoid thrashing the files on both directive addition and removal. (Now majority of the diff is meaningless stderr file changes.)

@petrochenkov
Copy link
Contributor

petrochenkov commented Mar 13, 2026

What exactly failures are ignored by ignore-parallel-frontend in practice?
Are they .stderr file comparison errors, or there are //~ ERROR annotation mismatches too?

Right now ignore-parallel-frontend ignores the test entirely, but maybe we could ignore only some of the checks.

@ywxt
Copy link
Contributor Author

ywxt commented Mar 13, 2026

What exactly failures are ignored by ignore-parallel-frontend in practice? Are they .stderr file comparison errors, or there are //~ ERROR annotation mismatches too?

Right now ignore-parallel-frontend ignores the test entirely, but maybe we could ignore only some of the checks.

failures would produce different errors so that //~ ERROR annotation mismatches

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 13, 2026
@ywxt
Copy link
Contributor Author

ywxt commented Mar 13, 2026

diff of stderr:

105     LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) }; // errors inside libcore
106        |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `R1` failed here
107
-       error[E0080]: in-bounds pointer arithmetic failed: attempting to offset pointer by 8 bytes, but got ALLOC10 which is only 4 bytes from the end of the allocation
109       --> $DIR/forbidden_slices.rs:54:25
110        |
111     LL |     from_ptr_range(ptr..ptr.add(2)) // errors inside libcore

157                    HEX_DUMP
158                }
159
-       error[E0080]: in-bounds pointer arithmetic failed: attempting to offset pointer by 8 bytes, but got ALLOC11+0x1 which is only 7 bytes from the end of the allocation
161       --> $DIR/forbidden_slices.rs:79:25
162        |
163     LL |     from_ptr_range(ptr..ptr.add(1))

actual:

error[E0080]: in-bounds pointer arithmetic failed: attempting to offset pointer by 8 bytes, but got alloc66+0x1 which is only 7 bytes from the end of the allocation
  --> /home/ywxt/Projects/Rust/rust/tests/ui/const-ptr/forbidden_slices.rs:79:25
   |
LL |     from_ptr_range(ptr..ptr.add(1))
   |                         ^^^^^^^^^^ evaluation of `R8` failed here

error[E0080]: in-bounds pointer arithmetic failed: attempting to offset pointer by 8 bytes, but got alloc69 which is only 4 bytes from the end of the allocation
  --> /home/ywxt/Projects/Rust/rust/tests/ui/const-ptr/forbidden_slices.rs:54:25
   |
LL |     from_ptr_range(ptr..ptr.add(2)) // errors inside libcore
   |                         ^^^^^^^^^^ evaluation of `R2` failed here

The difference is from alloc ids. Should we mask all of them?

@petrochenkov
Copy link
Contributor

petrochenkov commented Mar 13, 2026

It may be possible to normalize them instead of ignoring.
I'd ping the author of the test and ask their opinion.

@@ -1,5 +1,5 @@
//@ dont-require-annotations: NOTE

//@ ignore-parallel-frontend different alloc ids
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will add normalization rules if it's confirmed.

//@ stderr-per-bitwidth
//@ dont-require-annotations: NOTE

//@ ignore-parallel-frontend different alloc ids
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Although some consts tests didn't get failed in my environment, I marked them as ignored due to alloc ids in stderr.

//@ compile-flags: --force-warn unused_mut
//@ check-pass

//@ ignore-parallel-frontend the message `requested on the ...` appears in different lines
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The message is reported on two different source lines. Maybe we can solve it by comparison approaches?

//@ compile-flags: -Z query-dep-graph

//@ ignore-parallel-frontend dep graph
#![feature(rustc_attrs)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The dep graph tests failed on some rustc_then_this_would_need attributes.

Do you know the detail? @zetanumbers @Zoxc

Copy link
Contributor

Choose a reason for hiding this comment

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

I was able to reproduce a failure on main. It seems to be non-deterministic. Perhaps #152621 helps. I haven't looked into the issues with -Z query-dep-graph.


Also, when running with `--parallel-frontend-threads`, the `compare-output-by-lines` directive would be implied for all tests, since the output from the parallel frontend can be non-deterministic in terms of the order of lines.

The parallel frontend is avaliable in UI tests only at the moment, and is not currently supported in other test suites.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The parallel frontend is avaliable in UI tests only at the moment, and is not currently supported in other test suites.
The parallel frontend is available in UI tests only at the moment, and is not currently supported in other test suites.


The parallel frontend is avaliable in UI tests only at the moment, and is not currently supported in other test suites.

If you run with `--parallel-frontend-threads` and `--bless`, then `--parallel-frontend-threads` will be valied.
Copy link
Member

Choose a reason for hiding this comment

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

What does this sentence mean? :) I didn't understand it due to the last word probably being typoed.

bypass_ignore_backends: Default::default(),
jobs: Default::default(),
parallel_frontend_threads: Default::default(),
iteration_count: Default::default(),
Copy link
Member

Choose a reason for hiding this comment

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

This should be 1, I guess?

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

Labels

A-compiletest Area: The compiletest test runner A-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants