Use the same AuxProps
parser for EarlyProps
This commit is contained in:
parent
78fd3b5319
commit
188f7ce91b
@ -35,9 +35,10 @@ impl HeadersCache {
|
||||
/// the test.
|
||||
#[derive(Default)]
|
||||
pub struct EarlyProps {
|
||||
pub aux: Vec<String>,
|
||||
pub aux_bin: Vec<String>,
|
||||
pub aux_crate: Vec<(String, String)>,
|
||||
/// Auxiliary crates that should be built and made available to this test.
|
||||
/// Included in [`EarlyProps`] so that the indicated files can participate
|
||||
/// in up-to-date checking. Building happens via [`TestProps::aux`] instead.
|
||||
pub(crate) aux: AuxProps,
|
||||
pub revisions: Vec<String>,
|
||||
}
|
||||
|
||||
@ -57,21 +58,7 @@ impl EarlyProps {
|
||||
testfile,
|
||||
rdr,
|
||||
&mut |HeaderLine { directive: ln, .. }| {
|
||||
config.push_name_value_directive(ln, directives::AUX_BUILD, &mut props.aux, |r| {
|
||||
r.trim().to_string()
|
||||
});
|
||||
config.push_name_value_directive(
|
||||
ln,
|
||||
directives::AUX_BIN,
|
||||
&mut props.aux_bin,
|
||||
|r| r.trim().to_string(),
|
||||
);
|
||||
config.push_name_value_directive(
|
||||
ln,
|
||||
directives::AUX_CRATE,
|
||||
&mut props.aux_crate,
|
||||
Config::parse_aux_crate,
|
||||
);
|
||||
parse_and_update_aux(config, ln, &mut props.aux);
|
||||
config.parse_and_update_revisions(ln, &mut props.revisions);
|
||||
},
|
||||
);
|
||||
@ -920,14 +907,6 @@ fn iter_header(
|
||||
}
|
||||
|
||||
impl Config {
|
||||
fn parse_aux_crate(r: String) -> (String, String) {
|
||||
let mut parts = r.trim().splitn(2, '=');
|
||||
(
|
||||
parts.next().expect("missing aux-crate name (e.g. log=log.rs)").to_string(),
|
||||
parts.next().expect("missing aux-crate value (e.g. log=log.rs)").to_string(),
|
||||
)
|
||||
}
|
||||
|
||||
fn parse_and_update_revisions(&self, line: &str, existing: &mut Vec<String>) {
|
||||
if let Some(raw) = self.parse_name_value_directive(line, "revisions") {
|
||||
let mut duplicates: HashSet<_> = existing.iter().cloned().collect();
|
||||
|
@ -242,7 +242,8 @@ fn aux_build() {
|
||||
//@ aux-build: b.rs
|
||||
"
|
||||
)
|
||||
.aux,
|
||||
.aux
|
||||
.builds,
|
||||
vec!["a.rs", "b.rs"],
|
||||
);
|
||||
}
|
||||
|
@ -862,7 +862,8 @@ fn files_related_to_test(
|
||||
related.push(testpaths.file.clone());
|
||||
}
|
||||
|
||||
for aux in &props.aux {
|
||||
for aux in &props.aux.builds {
|
||||
// FIXME(Zalathar): Perform all `auxiliary` path resolution in one place.
|
||||
let path = testpaths.file.parent().unwrap().join("auxiliary").join(aux);
|
||||
related.push(path);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user