You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of the ad-hoc `COMPILETEST_FORCE_STAGE0` env var. However,
explicitly do not test this configuration under CI, as tests are most
certainly not guaranteed to pass against stage 0 (compiler, library).
@@ -714,17 +716,24 @@ impl Step for CompiletestTest {
714
716
715
717
/// Runs `cargo test` for compiletest.
716
718
fnrun(self,builder:&Builder<'_>){
719
+
if builder.top_stage == 0 && !builder.config.compiletest_force_stage0{
720
+
eprintln!(
721
+
"`compiletest` unit tests cannot be run against stage 0 unless `build.compiletest-force-stage0` override is specified"
722
+
);
723
+
exit!(1);
724
+
}
725
+
717
726
let host = self.host;
718
727
let compiler = builder.compiler(builder.top_stage, host);
719
728
720
-
// We need `ToolStd` for the locally-built sysroot because
721
-
// compiletest uses unstable features of the `test` crate.
729
+
// We need `ToolStd` for the locally-built sysroot because compiletest uses unstable
730
+
// features of the `test` crate.
722
731
builder.std(compiler, host);
723
732
letmut cargo = tool::prepare_tool_cargo(
724
733
builder,
725
734
compiler,
726
-
// compiletest uses libtest internals; make it use the in-tree std to make sure it never breaks
727
-
// when std sources change.
735
+
// compiletest uses libtest internals; make it use the in-tree std to make sure it never
736
+
// breaks when std sources change.
728
737
Mode::ToolStd,
729
738
host,
730
739
Kind::Test,
@@ -1612,12 +1621,11 @@ impl Step for Compiletest {
1612
1621
return;
1613
1622
}
1614
1623
1615
-
if builder.top_stage == 0 && env::var("COMPILETEST_FORCE_STAGE0").is_err(){
1624
+
if builder.top_stage == 0 && !builder.config.compiletest_force_stage0{
1616
1625
eprintln!("\
1617
-
ERROR: `--stage 0` runs compiletest on the stage0 (precompiled) compiler, not your local changes, and will almost always cause tests to fail
1618
-
HELP: to test the compiler, use `--stage 1` instead
1619
-
HELP: to test the standard library, use `--stage 0 library/std` instead
1620
-
NOTE: if you're sure you want to do this, please open an issue as to why. In the meantime, you can override this with `COMPILETEST_FORCE_STAGE0=1`."
1626
+
ERROR: `--stage 0` runs `compiletest` on the stage0 (precompiled) compiler, not your local changes, and will almost always cause tests to fail
1627
+
HELP: to test the staged compiler/library, use `--stage 1` instead
1628
+
NOTE: if you're sure you want to do this, please open an issue as to why. In the meantime, you can override this with `--set build.compiletest-force-stage0=true`."
0 commit comments