Repository navigation
Conversation
|
CI fails due to UI tests, they should be compiled with |
|
Wasn't there some flag that reordered the diagnostics, or made compiletest to compare them in an order agnostic way? If at all possible, I think that it would be better if we actually ran (at least most) UI tests under the parallel frontend. |
We do run them, on the
Yeah, but that's not enough for some tests, and those tests are disabled with |
|
Can't we solve blessing by forcing 1 frontend thread when |
|
I'd rather keep the things as is, it's just good to have precise snapshot testing running on something reproducible. |
|
I don't want to block this PR on that, but I find it a bit concerning that we aren't testing a bunch of nightly stuff on our CI. We already don't test the next trait solver, and now we also wouldn't be testing the parallel frontend, even though both would be enabled on nightly. I'm happy to do the compiletest/bootstrap work to enable running the parallel frontend everywhere. Do you want that to be the default eventually (and perhaps have a separate one-off job that runs things sequentially, like we have the parallel job today)? |
For ui tests ( |
|
If there are enough CI resources we could also run rustc twice on every ui test - once in the default mode (if it's parallel) and once in single-threaded mode for precise
So this ^^^ would mean limiting the precise |
|
Maybe I misunderstood how the current tooling works. I thought that:
|
This is correct.
I think that we do still need them, at least while the single-threaded compiler is the default. |
Although that infra currently compares the output on per-line basis, not on per-diagnostic, so technically the diagnostics can be interspersed and messed up entirely, and the check will still pass. |
dbe31dc to
dc90826
Compare
This comment has been minimized.
This comment has been minimized.
3003fd9 to
77bff57
Compare
This comment has been minimized.
This comment has been minimized.
|
Interesting. The |
|
Let's test everything, as there's a high chance that there would be more CI failures. @bors try jobs=* nolimit |
This comment has been minimized.
This comment has been minimized.
…r=<try> Use 2 parallel frontend threads by default on the nightly and dev channel try-job: * try-nolimit
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
💔 Test for da8f090 failed: CI. Failed jobs:
|
Add `stable_rustc` helper in `run-make-support` To help with rust-lang/rust#162848 and https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/626329887. For rust-lang/rust#162848, I need to avoid passing `-Zthreads` when the compiler is supposed to act like `stable`. This refactoring makes that simpler; I will only add that flag to `Rustc::new` and not `Rustc::stable`. r? jieyouxu
Add `stable_rustc` helper in `run-make-support` To help with rust-lang/rust#162848 and https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/626329887. For rust-lang/rust#162848, I need to avoid passing `-Zthreads` when the compiler is supposed to act like `stable`. This refactoring makes that simpler; I will only add that flag to `Rustc::new` and not `Rustc::stable`. r? jieyouxu
Add `stable_rustc` helper in `run-make-support` To help with rust-lang/rust#162848 and https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/626329887. For rust-lang/rust#162848, I need to avoid passing `-Zthreads` when the compiler is supposed to act like `stable`. This refactoring makes that simpler; I will only add that flag to `Rustc::new` and not `Rustc::stable`. r? jieyouxu
…-real-2, r=jieyouxu Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests Right now, it is [not possible](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707) to test how the compiler behaves on the stable toolchain in UI tests. Even though rust-lang#132993 added a mechanism to emulate stable rustc on the nightly channel, using the `RUSTC_BOOTSTRAP=-1` environment variable, this mechanism is not currently usable within compiletest and UI tests directly, because compiletest unconditionally passes several unstable `-Z` flags that are load-bearing for the testing infra itself to work (notably `-Zui-testing` and friends). That is quite annoying, because we do in fact want to test stable behavior in a couple of tests, but today we have to write those as `run-make` tests (latest example: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707), even if the tested situation is very simple. Those are harder to read, write and maintain than UI tests and they do not support blessing outputs as well as UI tests. Recently, I at least added rust-lang#163444 as a way of centralizing the logic of testing a stable `rustc` in a run-make test, but that does not really help with the fact that we still have to use run-make tests for it, even when a normal UI test would do. For rust-lang#162848, I would also like to have a way of passing `-Zthreads=1` to all run-make tests, even if they are testing stable `rustc`, but that's not easily possible, because those tests are using `RUSTC_BOOTSTRAP=-1`. This PR proposes to add a new mode to `RUSTC_BOOTSTRAP`, with the value of `-allow-unstable-compiler-flags=<flags>`. This can be used to emulate the behavior of stable rustc, while still allowing passing *specific* unstable flags to the compiler. The stability check in the compiler is thus now separated into two questions: - Are we an unstable/nightly build? - Can we accept specific unstable compiler flags? The latter is checked only at a few places, so the necessary change to the compiler is rather small (IMO). To demonstrate how this would be used, I also implemented a new directive into compiletest in this PR, `act-as-stable`. That can be used in a UI test to emulate stable rustc. Some tests before used `only-stable` to "achieve" this, which is very misleading, because it doesn't work at all 😆, due to compiletest unconditionally passing `RUSTC_BOOTSTRAP=1` to all executed tests. `act-as-stable` fixes that. The last two commits demonstrate how we could replace run-make tests that tested different output on stable/nightly with UI tests. I suppose that this mode might be interesting for other people outside of `rust-lang/rust`, but if you don't want that, I can gate it behind `-Zui-testing`. r? jieyouxu
…-real-2, r=jieyouxu Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests Right now, it is [not possible](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707) to test how the compiler behaves on the stable toolchain in UI tests. Even though rust-lang#132993 added a mechanism to emulate stable rustc on the nightly channel, using the `RUSTC_BOOTSTRAP=-1` environment variable, this mechanism is not currently usable within compiletest and UI tests directly, because compiletest unconditionally passes several unstable `-Z` flags that are load-bearing for the testing infra itself to work (notably `-Zui-testing` and friends). That is quite annoying, because we do in fact want to test stable behavior in a couple of tests, but today we have to write those as `run-make` tests (latest example: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707), even if the tested situation is very simple. Those are harder to read, write and maintain than UI tests and they do not support blessing outputs as well as UI tests. Recently, I at least added rust-lang#163444 as a way of centralizing the logic of testing a stable `rustc` in a run-make test, but that does not really help with the fact that we still have to use run-make tests for it, even when a normal UI test would do. For rust-lang#162848, I would also like to have a way of passing `-Zthreads=1` to all run-make tests, even if they are testing stable `rustc`, but that's not easily possible, because those tests are using `RUSTC_BOOTSTRAP=-1`. This PR proposes to add a new mode to `RUSTC_BOOTSTRAP`, with the value of `-allow-unstable-compiler-flags=<flags>`. This can be used to emulate the behavior of stable rustc, while still allowing passing *specific* unstable flags to the compiler. The stability check in the compiler is thus now separated into two questions: - Are we an unstable/nightly build? - Can we accept specific unstable compiler flags? The latter is checked only at a few places, so the necessary change to the compiler is rather small (IMO). To demonstrate how this would be used, I also implemented a new directive into compiletest in this PR, `act-as-stable`. That can be used in a UI test to emulate stable rustc. Some tests before used `only-stable` to "achieve" this, which is very misleading, because it doesn't work at all 😆, due to compiletest unconditionally passing `RUSTC_BOOTSTRAP=1` to all executed tests. `act-as-stable` fixes that. The last two commits demonstrate how we could replace run-make tests that tested different output on stable/nightly with UI tests. I suppose that this mode might be interesting for other people outside of `rust-lang/rust`, but if you don't want that, I can gate it behind `-Zui-testing`. r? jieyouxu
…-real-2, r=jieyouxu Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests Right now, it is [not possible](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707) to test how the compiler behaves on the stable toolchain in UI tests. Even though rust-lang#132993 added a mechanism to emulate stable rustc on the nightly channel, using the `RUSTC_BOOTSTRAP=-1` environment variable, this mechanism is not currently usable within compiletest and UI tests directly, because compiletest unconditionally passes several unstable `-Z` flags that are load-bearing for the testing infra itself to work (notably `-Zui-testing` and friends). That is quite annoying, because we do in fact want to test stable behavior in a couple of tests, but today we have to write those as `run-make` tests (latest example: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707), even if the tested situation is very simple. Those are harder to read, write and maintain than UI tests and they do not support blessing outputs as well as UI tests. Recently, I at least added rust-lang#163444 as a way of centralizing the logic of testing a stable `rustc` in a run-make test, but that does not really help with the fact that we still have to use run-make tests for it, even when a normal UI test would do. For rust-lang#162848, I would also like to have a way of passing `-Zthreads=1` to all run-make tests, even if they are testing stable `rustc`, but that's not easily possible, because those tests are using `RUSTC_BOOTSTRAP=-1`. This PR proposes to add a new mode to `RUSTC_BOOTSTRAP`, with the value of `-allow-unstable-compiler-flags=<flags>`. This can be used to emulate the behavior of stable rustc, while still allowing passing *specific* unstable flags to the compiler. The stability check in the compiler is thus now separated into two questions: - Are we an unstable/nightly build? - Can we accept specific unstable compiler flags? The latter is checked only at a few places, so the necessary change to the compiler is rather small (IMO). To demonstrate how this would be used, I also implemented a new directive into compiletest in this PR, `act-as-stable`. That can be used in a UI test to emulate stable rustc. Some tests before used `only-stable` to "achieve" this, which is very misleading, because it doesn't work at all 😆, due to compiletest unconditionally passing `RUSTC_BOOTSTRAP=1` to all executed tests. `act-as-stable` fixes that. The last two commits demonstrate how we could replace run-make tests that tested different output on stable/nightly with UI tests. I suppose that this mode might be interesting for other people outside of `rust-lang/rust`, but if you don't want that, I can gate it behind `-Zui-testing`. r? jieyouxu
…-real-2, r=jieyouxu Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests Right now, it is [not possible](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707) to test how the compiler behaves on the stable toolchain in UI tests. Even though rust-lang#132993 added a mechanism to emulate stable rustc on the nightly channel, using the `RUSTC_BOOTSTRAP=-1` environment variable, this mechanism is not currently usable within compiletest and UI tests directly, because compiletest unconditionally passes several unstable `-Z` flags that are load-bearing for the testing infra itself to work (notably `-Zui-testing` and friends). That is quite annoying, because we do in fact want to test stable behavior in a couple of tests, but today we have to write those as `run-make` tests (latest example: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707), even if the tested situation is very simple. Those are harder to read, write and maintain than UI tests and they do not support blessing outputs as well as UI tests. Recently, I at least added rust-lang#163444 as a way of centralizing the logic of testing a stable `rustc` in a run-make test, but that does not really help with the fact that we still have to use run-make tests for it, even when a normal UI test would do. For rust-lang#162848, I would also like to have a way of passing `-Zthreads=1` to all run-make tests, even if they are testing stable `rustc`, but that's not easily possible, because those tests are using `RUSTC_BOOTSTRAP=-1`. This PR proposes to add a new mode to `RUSTC_BOOTSTRAP`, with the value of `-allow-unstable-compiler-flags=<flags>`. This can be used to emulate the behavior of stable rustc, while still allowing passing *specific* unstable flags to the compiler. The stability check in the compiler is thus now separated into two questions: - Are we an unstable/nightly build? - Can we accept specific unstable compiler flags? The latter is checked only at a few places, so the necessary change to the compiler is rather small (IMO). To demonstrate how this would be used, I also implemented a new directive into compiletest in this PR, `act-as-stable`. That can be used in a UI test to emulate stable rustc. Some tests before used `only-stable` to "achieve" this, which is very misleading, because it doesn't work at all 😆, due to compiletest unconditionally passing `RUSTC_BOOTSTRAP=1` to all executed tests. `act-as-stable` fixes that. The last two commits demonstrate how we could replace run-make tests that tested different output on stable/nightly with UI tests. I suppose that this mode might be interesting for other people outside of `rust-lang/rust`, but if you don't want that, I can gate it behind `-Zui-testing`. r? jieyouxu
…-real-2, r=jieyouxu Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests Right now, it is [not possible](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707) to test how the compiler behaves on the stable toolchain in UI tests. Even though rust-lang#132993 added a mechanism to emulate stable rustc on the nightly channel, using the `RUSTC_BOOTSTRAP=-1` environment variable, this mechanism is not currently usable within compiletest and UI tests directly, because compiletest unconditionally passes several unstable `-Z` flags that are load-bearing for the testing infra itself to work (notably `-Zui-testing` and friends). That is quite annoying, because we do in fact want to test stable behavior in a couple of tests, but today we have to write those as `run-make` tests (latest example: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707), even if the tested situation is very simple. Those are harder to read, write and maintain than UI tests and they do not support blessing outputs as well as UI tests. Recently, I at least added rust-lang#163444 as a way of centralizing the logic of testing a stable `rustc` in a run-make test, but that does not really help with the fact that we still have to use run-make tests for it, even when a normal UI test would do. For rust-lang#162848, I would also like to have a way of passing `-Zthreads=1` to all run-make tests, even if they are testing stable `rustc`, but that's not easily possible, because those tests are using `RUSTC_BOOTSTRAP=-1`. This PR proposes to add a new mode to `RUSTC_BOOTSTRAP`, with the value of `-allow-unstable-compiler-flags=<flags>`. This can be used to emulate the behavior of stable rustc, while still allowing passing *specific* unstable flags to the compiler. The stability check in the compiler is thus now separated into two questions: - Are we an unstable/nightly build? - Can we accept specific unstable compiler flags? The latter is checked only at a few places, so the necessary change to the compiler is rather small (IMO). To demonstrate how this would be used, I also implemented a new directive into compiletest in this PR, `act-as-stable`. That can be used in a UI test to emulate stable rustc. Some tests before used `only-stable` to "achieve" this, which is very misleading, because it doesn't work at all 😆, due to compiletest unconditionally passing `RUSTC_BOOTSTRAP=1` to all executed tests. `act-as-stable` fixes that. The last two commits demonstrate how we could replace run-make tests that tested different output on stable/nightly with UI tests. I suppose that this mode might be interesting for other people outside of `rust-lang/rust`, but if you don't want that, I can gate it behind `-Zui-testing`. r? jieyouxu
…-real-2, r=jieyouxu Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests Right now, it is [not possible](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707) to test how the compiler behaves on the stable toolchain in UI tests. Even though rust-lang#132993 added a mechanism to emulate stable rustc on the nightly channel, using the `RUSTC_BOOTSTRAP=-1` environment variable, this mechanism is not currently usable within compiletest and UI tests directly, because compiletest unconditionally passes several unstable `-Z` flags that are load-bearing for the testing infra itself to work (notably `-Zui-testing` and friends). That is quite annoying, because we do in fact want to test stable behavior in a couple of tests, but today we have to write those as `run-make` tests (latest example: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707), even if the tested situation is very simple. Those are harder to read, write and maintain than UI tests and they do not support blessing outputs as well as UI tests. Recently, I at least added rust-lang#163444 as a way of centralizing the logic of testing a stable `rustc` in a run-make test, but that does not really help with the fact that we still have to use run-make tests for it, even when a normal UI test would do. For rust-lang#162848, I would also like to have a way of passing `-Zthreads=1` to all run-make tests, even if they are testing stable `rustc`, but that's not easily possible, because those tests are using `RUSTC_BOOTSTRAP=-1`. This PR proposes to add a new mode to `RUSTC_BOOTSTRAP`, with the value of `-allow-unstable-compiler-flags=<flags>`. This can be used to emulate the behavior of stable rustc, while still allowing passing *specific* unstable flags to the compiler. The stability check in the compiler is thus now separated into two questions: - Are we an unstable/nightly build? - Can we accept specific unstable compiler flags? The latter is checked only at a few places, so the necessary change to the compiler is rather small (IMO). To demonstrate how this would be used, I also implemented a new directive into compiletest in this PR, `act-as-stable`. That can be used in a UI test to emulate stable rustc. Some tests before used `only-stable` to "achieve" this, which is very misleading, because it doesn't work at all 😆, due to compiletest unconditionally passing `RUSTC_BOOTSTRAP=1` to all executed tests. `act-as-stable` fixes that. The last two commits demonstrate how we could replace run-make tests that tested different output on stable/nightly with UI tests. I suppose that this mode might be interesting for other people outside of `rust-lang/rust`, but if you don't want that, I can gate it behind `-Zui-testing`. r? jieyouxu
…-real-2, r=jieyouxu Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests Right now, it is [not possible](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707) to test how the compiler behaves on the stable toolchain in UI tests. Even though rust-lang#132993 added a mechanism to emulate stable rustc on the nightly channel, using the `RUSTC_BOOTSTRAP=-1` environment variable, this mechanism is not currently usable within compiletest and UI tests directly, because compiletest unconditionally passes several unstable `-Z` flags that are load-bearing for the testing infra itself to work (notably `-Zui-testing` and friends). That is quite annoying, because we do in fact want to test stable behavior in a couple of tests, but today we have to write those as `run-make` tests (latest example: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707), even if the tested situation is very simple. Those are harder to read, write and maintain than UI tests and they do not support blessing outputs as well as UI tests. Recently, I at least added rust-lang#163444 as a way of centralizing the logic of testing a stable `rustc` in a run-make test, but that does not really help with the fact that we still have to use run-make tests for it, even when a normal UI test would do. For rust-lang#162848, I would also like to have a way of passing `-Zthreads=1` to all run-make tests, even if they are testing stable `rustc`, but that's not easily possible, because those tests are using `RUSTC_BOOTSTRAP=-1`. This PR proposes to add a new mode to `RUSTC_BOOTSTRAP`, with the value of `-allow-unstable-compiler-flags=<flags>`. This can be used to emulate the behavior of stable rustc, while still allowing passing *specific* unstable flags to the compiler. The stability check in the compiler is thus now separated into two questions: - Are we an unstable/nightly build? - Can we accept specific unstable compiler flags? The latter is checked only at a few places, so the necessary change to the compiler is rather small (IMO). To demonstrate how this would be used, I also implemented a new directive into compiletest in this PR, `act-as-stable`. That can be used in a UI test to emulate stable rustc. Some tests before used `only-stable` to "achieve" this, which is very misleading, because it doesn't work at all 😆, due to compiletest unconditionally passing `RUSTC_BOOTSTRAP=1` to all executed tests. `act-as-stable` fixes that. The last two commits demonstrate how we could replace run-make tests that tested different output on stable/nightly with UI tests. I suppose that this mode might be interesting for other people outside of `rust-lang/rust`, but if you don't want that, I can gate it behind `-Zui-testing`. r? jieyouxu
…-real-2, r=jieyouxu Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests Right now, it is [not possible](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707) to test how the compiler behaves on the stable toolchain in UI tests. Even though rust-lang#132993 added a mechanism to emulate stable rustc on the nightly channel, using the `RUSTC_BOOTSTRAP=-1` environment variable, this mechanism is not currently usable within compiletest and UI tests directly, because compiletest unconditionally passes several unstable `-Z` flags that are load-bearing for the testing infra itself to work (notably `-Zui-testing` and friends). That is quite annoying, because we do in fact want to test stable behavior in a couple of tests, but today we have to write those as `run-make` tests (latest example: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707), even if the tested situation is very simple. Those are harder to read, write and maintain than UI tests and they do not support blessing outputs as well as UI tests. Recently, I at least added rust-lang#163444 as a way of centralizing the logic of testing a stable `rustc` in a run-make test, but that does not really help with the fact that we still have to use run-make tests for it, even when a normal UI test would do. For rust-lang#162848, I would also like to have a way of passing `-Zthreads=1` to all run-make tests, even if they are testing stable `rustc`, but that's not easily possible, because those tests are using `RUSTC_BOOTSTRAP=-1`. This PR proposes to add a new mode to `RUSTC_BOOTSTRAP`, with the value of `-allow-unstable-compiler-flags=<flags>`. This can be used to emulate the behavior of stable rustc, while still allowing passing *specific* unstable flags to the compiler. The stability check in the compiler is thus now separated into two questions: - Are we an unstable/nightly build? - Can we accept specific unstable compiler flags? The latter is checked only at a few places, so the necessary change to the compiler is rather small (IMO). To demonstrate how this would be used, I also implemented a new directive into compiletest in this PR, `act-as-stable`. That can be used in a UI test to emulate stable rustc. Some tests before used `only-stable` to "achieve" this, which is very misleading, because it doesn't work at all 😆, due to compiletest unconditionally passing `RUSTC_BOOTSTRAP=1` to all executed tests. `act-as-stable` fixes that. The last two commits demonstrate how we could replace run-make tests that tested different output on stable/nightly with UI tests. I suppose that this mode might be interesting for other people outside of `rust-lang/rust`, but if you don't want that, I can gate it behind `-Zui-testing`. r? jieyouxu
Rollup merge of #163664 - Kobzol:bootstrap-but-this-time-for-real-2, r=jieyouxu Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests Right now, it is [not possible](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707) to test how the compiler behaves on the stable toolchain in UI tests. Even though #132993 added a mechanism to emulate stable rustc on the nightly channel, using the `RUSTC_BOOTSTRAP=-1` environment variable, this mechanism is not currently usable within compiletest and UI tests directly, because compiletest unconditionally passes several unstable `-Z` flags that are load-bearing for the testing infra itself to work (notably `-Zui-testing` and friends). That is quite annoying, because we do in fact want to test stable behavior in a couple of tests, but today we have to write those as `run-make` tests (latest example: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707), even if the tested situation is very simple. Those are harder to read, write and maintain than UI tests and they do not support blessing outputs as well as UI tests. Recently, I at least added #163444 as a way of centralizing the logic of testing a stable `rustc` in a run-make test, but that does not really help with the fact that we still have to use run-make tests for it, even when a normal UI test would do. For #162848, I would also like to have a way of passing `-Zthreads=1` to all run-make tests, even if they are testing stable `rustc`, but that's not easily possible, because those tests are using `RUSTC_BOOTSTRAP=-1`. This PR proposes to add a new mode to `RUSTC_BOOTSTRAP`, with the value of `-allow-unstable-compiler-flags=<flags>`. This can be used to emulate the behavior of stable rustc, while still allowing passing *specific* unstable flags to the compiler. The stability check in the compiler is thus now separated into two questions: - Are we an unstable/nightly build? - Can we accept specific unstable compiler flags? The latter is checked only at a few places, so the necessary change to the compiler is rather small (IMO). To demonstrate how this would be used, I also implemented a new directive into compiletest in this PR, `act-as-stable`. That can be used in a UI test to emulate stable rustc. Some tests before used `only-stable` to "achieve" this, which is very misleading, because it doesn't work at all 😆, due to compiletest unconditionally passing `RUSTC_BOOTSTRAP=1` to all executed tests. `act-as-stable` fixes that. The last two commits demonstrate how we could replace run-make tests that tested different output on stable/nightly with UI tests. I suppose that this mode might be interesting for other people outside of `rust-lang/rust`, but if you don't want that, I can gate it behind `-Zui-testing`. r? jieyouxu
|
#163664 has landed. Now I have to convert a few run-make tests to UI tests with the new machinery, and then migrate run-make tests to use |
…r=jieyouxu Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests Right now, it is [not possible](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707) to test how the compiler behaves on the stable toolchain in UI tests. Even though rust-lang/rust#132993 added a mechanism to emulate stable rustc on the nightly channel, using the `RUSTC_BOOTSTRAP=-1` environment variable, this mechanism is not currently usable within compiletest and UI tests directly, because compiletest unconditionally passes several unstable `-Z` flags that are load-bearing for the testing infra itself to work (notably `-Zui-testing` and friends). That is quite annoying, because we do in fact want to test stable behavior in a couple of tests, but today we have to write those as `run-make` tests (latest example: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707), even if the tested situation is very simple. Those are harder to read, write and maintain than UI tests and they do not support blessing outputs as well as UI tests. Recently, I at least added rust-lang/rust#163444 as a way of centralizing the logic of testing a stable `rustc` in a run-make test, but that does not really help with the fact that we still have to use run-make tests for it, even when a normal UI test would do. For rust-lang/rust#162848, I would also like to have a way of passing `-Zthreads=1` to all run-make tests, even if they are testing stable `rustc`, but that's not easily possible, because those tests are using `RUSTC_BOOTSTRAP=-1`. This PR proposes to add a new mode to `RUSTC_BOOTSTRAP`, with the value of `-allow-unstable-compiler-flags=<flags>`. This can be used to emulate the behavior of stable rustc, while still allowing passing *specific* unstable flags to the compiler. The stability check in the compiler is thus now separated into two questions: - Are we an unstable/nightly build? - Can we accept specific unstable compiler flags? The latter is checked only at a few places, so the necessary change to the compiler is rather small (IMO). To demonstrate how this would be used, I also implemented a new directive into compiletest in this PR, `act-as-stable`. That can be used in a UI test to emulate stable rustc. Some tests before used `only-stable` to "achieve" this, which is very misleading, because it doesn't work at all 😆, due to compiletest unconditionally passing `RUSTC_BOOTSTRAP=1` to all executed tests. `act-as-stable` fixes that. The last two commits demonstrate how we could replace run-make tests that tested different output on stable/nightly with UI tests. I suppose that this mode might be interesting for other people outside of `rust-lang/rust`, but if you don't want that, I can gate it behind `-Zui-testing`. r? jieyouxu
…r=jieyouxu Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests Right now, it is [not possible](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707) to test how the compiler behaves on the stable toolchain in UI tests. Even though rust-lang/rust#132993 added a mechanism to emulate stable rustc on the nightly channel, using the `RUSTC_BOOTSTRAP=-1` environment variable, this mechanism is not currently usable within compiletest and UI tests directly, because compiletest unconditionally passes several unstable `-Z` flags that are load-bearing for the testing infra itself to work (notably `-Zui-testing` and friends). That is quite annoying, because we do in fact want to test stable behavior in a couple of tests, but today we have to write those as `run-make` tests (latest example: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707), even if the tested situation is very simple. Those are harder to read, write and maintain than UI tests and they do not support blessing outputs as well as UI tests. Recently, I at least added rust-lang/rust#163444 as a way of centralizing the logic of testing a stable `rustc` in a run-make test, but that does not really help with the fact that we still have to use run-make tests for it, even when a normal UI test would do. For rust-lang/rust#162848, I would also like to have a way of passing `-Zthreads=1` to all run-make tests, even if they are testing stable `rustc`, but that's not easily possible, because those tests are using `RUSTC_BOOTSTRAP=-1`. This PR proposes to add a new mode to `RUSTC_BOOTSTRAP`, with the value of `-allow-unstable-compiler-flags=<flags>`. This can be used to emulate the behavior of stable rustc, while still allowing passing *specific* unstable flags to the compiler. The stability check in the compiler is thus now separated into two questions: - Are we an unstable/nightly build? - Can we accept specific unstable compiler flags? The latter is checked only at a few places, so the necessary change to the compiler is rather small (IMO). To demonstrate how this would be used, I also implemented a new directive into compiletest in this PR, `act-as-stable`. That can be used in a UI test to emulate stable rustc. Some tests before used `only-stable` to "achieve" this, which is very misleading, because it doesn't work at all 😆, due to compiletest unconditionally passing `RUSTC_BOOTSTRAP=1` to all executed tests. `act-as-stable` fixes that. The last two commits demonstrate how we could replace run-make tests that tested different output on stable/nightly with UI tests. I suppose that this mode might be interesting for other people outside of `rust-lang/rust`, but if you don't want that, I can gate it behind `-Zui-testing`. r? jieyouxu
View all comments
Part of https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Enabling.20the.20parallel.20frontend.20by.20default.20on.20nightly/with/624597688.
UI tests will still use one frontend thread by default.
CC @petrochenkov