pass revision and incr_comp directory to auxbuild
This is needed for incremental compilation harness to support cross-crate testing. Also support cfg for typechecking prettyprint
This commit is contained in:
parent
8f3a8c24cd
commit
08837d2975
2 changed files with 40 additions and 10 deletions
|
|
@ -162,6 +162,11 @@ pub struct TestProps {
|
|||
pub forbid_output: Vec<String>,
|
||||
// Revisions to test for incremental compilation.
|
||||
pub revisions: Vec<String>,
|
||||
// Directory (if any) to use for incremental compilation. This is
|
||||
// not set by end-users; rather it is set by the incremental
|
||||
// testing harness and used when generating compilation
|
||||
// arguments. (In particular, it propagates to the aux-builds.)
|
||||
pub incremental_dir: Option<PathBuf>,
|
||||
}
|
||||
|
||||
impl TestProps {
|
||||
|
|
@ -197,9 +202,20 @@ impl TestProps {
|
|||
pretty_mode: format!("normal"),
|
||||
pretty_compare_only: pretty_compare_only,
|
||||
forbid_output: forbid_output,
|
||||
incremental_dir: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_aux_file(&self, testfile: &Path, cfg: Option<&str>) -> Self {
|
||||
let mut props = TestProps::new();
|
||||
|
||||
// copy over select properties to the aux build:
|
||||
props.incremental_dir = self.incremental_dir.clone();
|
||||
props.load_from(testfile, cfg);
|
||||
|
||||
props
|
||||
}
|
||||
|
||||
pub fn from_file(testfile: &Path) -> Self {
|
||||
let mut props = TestProps::new();
|
||||
props.load_from(testfile, None);
|
||||
|
|
|
|||
|
|
@ -63,10 +63,6 @@ pub fn run(config: Config, testpaths: &TestPaths) {
|
|||
for revision in &base_props.revisions {
|
||||
let mut revision_props = base_props.clone();
|
||||
revision_props.load_from(&testpaths.file, Some(&revision));
|
||||
revision_props.compile_flags.extend(vec![
|
||||
format!("--cfg"),
|
||||
format!("{}", revision),
|
||||
]);
|
||||
let rev_cx = TestCx {
|
||||
config: &config,
|
||||
props: &revision_props,
|
||||
|
|
@ -383,6 +379,12 @@ actual:\n\
|
|||
self.config.build_base.to_str().unwrap().to_owned(),
|
||||
"-L".to_owned(),
|
||||
aux_dir.to_str().unwrap().to_owned());
|
||||
if let Some(revision) = self.revision {
|
||||
args.extend(vec![
|
||||
format!("--cfg"),
|
||||
format!("{}", revision),
|
||||
]);
|
||||
}
|
||||
args.extend(self.split_maybe_args(&self.config.target_rustcflags));
|
||||
args.extend(self.props.compile_flags.iter().cloned());
|
||||
// FIXME (#9639): This needs to handle non-utf8 paths
|
||||
|
|
@ -1102,7 +1104,7 @@ actual:\n\
|
|||
if self.props.build_aux_docs {
|
||||
for rel_ab in &self.props.aux_builds {
|
||||
let aux_testpaths = self.compute_aux_test_paths(rel_ab);
|
||||
let aux_props = TestProps::from_file(&aux_testpaths.file);
|
||||
let aux_props = self.props.from_aux_file(&aux_testpaths.file, self.revision);
|
||||
let aux_cx = TestCx {
|
||||
config: self.config,
|
||||
props: &aux_props,
|
||||
|
|
@ -1186,7 +1188,7 @@ actual:\n\
|
|||
|
||||
for rel_ab in &self.props.aux_builds {
|
||||
let aux_testpaths = self.compute_aux_test_paths(rel_ab);
|
||||
let aux_props = TestProps::from_file(&aux_testpaths.file);
|
||||
let aux_props = self.props.from_aux_file(&aux_testpaths.file, self.revision);
|
||||
let mut crate_type = if aux_props.no_prefer_dynamic {
|
||||
Vec::new()
|
||||
} else {
|
||||
|
|
@ -1291,6 +1293,21 @@ actual:\n\
|
|||
self.config.build_base.to_str().unwrap().to_owned(),
|
||||
format!("--target={}", target));
|
||||
|
||||
if let Some(revision) = self.revision {
|
||||
args.extend(vec![
|
||||
format!("--cfg"),
|
||||
format!("{}", revision),
|
||||
]);
|
||||
}
|
||||
|
||||
if let Some(ref incremental_dir) = self.props.incremental_dir {
|
||||
args.extend(vec![
|
||||
format!("-Z"),
|
||||
format!("incremental={}", incremental_dir.display()),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
match self.config.mode {
|
||||
CompileFail |
|
||||
ParseFail |
|
||||
|
|
@ -1980,10 +1997,7 @@ actual:\n\
|
|||
|
||||
// Add an extra flag pointing at the incremental directory.
|
||||
let mut revision_props = self.props.clone();
|
||||
revision_props.compile_flags.extend(vec![
|
||||
format!("-Z"),
|
||||
format!("incremental={}", incremental_dir.display()),
|
||||
]);
|
||||
revision_props.incremental_dir = Some(incremental_dir);
|
||||
|
||||
let revision_cx = TestCx {
|
||||
config: self.config,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue