mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
Add support for cpass incremental revisions
This commit is contained in:
@@ -156,11 +156,12 @@ series of steps.
|
||||
Compiletest starts with an empty directory with the `-C incremental` flag, and
|
||||
then runs the compiler for each revision, reusing the incremental results from previous steps.
|
||||
|
||||
The revisions should start with:
|
||||
Each revision name must start with one of:
|
||||
|
||||
* `bfail` — the test should fail to compile
|
||||
* `bpass` — the test should compile successully
|
||||
* `rpass` — the test should compile and run successfully
|
||||
* `cpass` - the test must compile successfully (check build, no codegen)
|
||||
* `bfail` — the test must fail to compile (full build, with codegen)
|
||||
* `bpass` — the test must compile successully (full build, with codegen)
|
||||
* `rpass` — the test must compile and run successfully
|
||||
|
||||
To make the revisions unique, you should add a suffix like `rpass1` and `rpass2`.
|
||||
|
||||
|
||||
@@ -327,12 +327,15 @@ fn should_compile_successfully(&self, pm: Option<PassMode>) -> bool {
|
||||
TestMode::Incremental => {
|
||||
let revision =
|
||||
self.revision.expect("incremental tests require a list of revisions");
|
||||
if revision.starts_with("bpass") || revision.starts_with("rpass") {
|
||||
if revision.starts_with("cpass")
|
||||
|| revision.starts_with("bpass")
|
||||
|| revision.starts_with("rpass")
|
||||
{
|
||||
true
|
||||
} else if revision.starts_with("bfail") {
|
||||
pm.is_some()
|
||||
} else {
|
||||
panic!("revision name must begin with `bfail`, `bpass`, or `rpass`");
|
||||
panic!("revision name must begin with `cpass`, `bfail`, `bpass`, or `rpass`");
|
||||
}
|
||||
}
|
||||
mode => panic!("unimplemented for mode {:?}", mode),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::{FailMode, ProcRes, TestCx, WillExecute};
|
||||
use super::{Emit, FailMode, PassMode, ProcRes, TestCx, WillExecute};
|
||||
|
||||
impl TestCx<'_> {
|
||||
pub(super) fn run_incremental_test(&self) {
|
||||
@@ -31,7 +31,9 @@ pub(super) fn run_incremental_test(&self) {
|
||||
write!(self.stdout, "revision={:?} props={:#?}", revision, self.props);
|
||||
}
|
||||
|
||||
if revision.starts_with("bpass") {
|
||||
if revision.starts_with("cpass") {
|
||||
self.run_cpass_test();
|
||||
} else if revision.starts_with("bpass") {
|
||||
self.run_bpass_test();
|
||||
} else if revision.starts_with("rpass") {
|
||||
self.run_rpass_test();
|
||||
@@ -42,6 +44,12 @@ pub(super) fn run_incremental_test(&self) {
|
||||
}
|
||||
}
|
||||
|
||||
fn run_cpass_test(&self) {
|
||||
let proc_res = self.compile_test(WillExecute::No, Emit::Metadata);
|
||||
self.check_if_test_should_compile(None, Some(PassMode::Check), &proc_res);
|
||||
self.check_compiler_output_for_incr(&proc_res);
|
||||
}
|
||||
|
||||
fn run_bpass_test(&self) {
|
||||
let emit_metadata = self.should_emit_metadata(self.pass_mode());
|
||||
let proc_res = self.compile_test(WillExecute::No, emit_metadata);
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
// Emitting these lints is delayed until after ast lowering.
|
||||
// This test tests that the delayed hints are correctly hashed for incremental.
|
||||
|
||||
//@ check-pass
|
||||
//@ revisions: bfail1 bfail2 bfail3
|
||||
//@ revisions: cpass1 cpass2 cpass3
|
||||
//@ compile-flags: -Z query-dep-graph -O -Zincremental-ignore-spans
|
||||
//@ ignore-backends: gcc
|
||||
#![feature(rustc_attrs)]
|
||||
@@ -15,13 +14,13 @@
|
||||
// Between revision 1 and 2, the only thing we change is that we add "test = 2"
|
||||
// This will emit an extra delayed lint, but it will not change the HIR hash.
|
||||
// We check that even tho the HIR hash didn't change, the extra lint is emitted
|
||||
#[cfg_attr(bfail1, doc(hidden))]
|
||||
#[cfg_attr(not(bfail1), doc(hidden, test = 2))]
|
||||
//[bfail2,bfail3]~^ WARN `#[doc(test(...)]` takes a list of attributes [invalid_doc_attributes]
|
||||
#[cfg_attr(cpass1, doc(hidden))]
|
||||
#[cfg_attr(not(cpass1), doc(hidden, test = 2))]
|
||||
//[cpass2,cpass3]~^ WARN `#[doc(test(...)]` takes a list of attributes [invalid_doc_attributes]
|
||||
|
||||
// The HIR hash should not change between revisions, for this test to be representative
|
||||
#[rustc_clean(cfg="bfail2")]
|
||||
#[rustc_clean(cfg="bfail3")]
|
||||
#[rustc_clean(cfg="cpass2")]
|
||||
#[rustc_clean(cfg="cpass3")]
|
||||
trait Test {}
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//@ revisions: bfail1 bfail2
|
||||
//@ check-pass
|
||||
//@ revisions: cpass1 cpass2
|
||||
//@ compile-flags: --crate-type cdylib
|
||||
//@ needs-crate-type: cdylib
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
//@ revisions: bfail1 bfail2
|
||||
|
||||
//@ revisions: cpass1 cpass2
|
||||
//@ compile-flags: -Znext-solver
|
||||
//@ check-pass
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
@@ -18,10 +16,10 @@ fn poll() -> Self::Error {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(bfail1)]
|
||||
#[cfg(cpass1)]
|
||||
pub struct Error(());
|
||||
|
||||
#[cfg(bfail2)]
|
||||
#[cfg(cpass2)]
|
||||
pub struct Error();
|
||||
|
||||
fn main() {}
|
||||
|
||||
Reference in New Issue
Block a user