Skip to content

Commit df88246

Browse files
kennytmalexcrichton
authored andcommitted
Ensure --exclude is checked against PathSet::Suite
Fix the recent spurious 3 hour timeouts.
1 parent 39fa89b commit df88246

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

src/bootstrap/builder.rs

+32-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl PathSet {
130130
fn has(&self, needle: &Path) -> bool {
131131
match self {
132132
PathSet::Set(set) => set.iter().any(|p| p.ends_with(needle)),
133-
PathSet::Suite(_) => false,
133+
PathSet::Suite(suite) => suite.ends_with(needle),
134134
}
135135
}
136136

@@ -1844,7 +1844,7 @@ mod __test {
18441844
);
18451845

18461846
// Ensure we don't build any compiler artifacts.
1847-
assert!(builder.cache.all::<compile::Rustc>().is_empty());
1847+
assert!(!builder.cache.contains::<compile::Rustc>());
18481848
assert_eq!(
18491849
first(builder.cache.all::<test::Crate>()),
18501850
&[test::Crate {
@@ -1856,4 +1856,34 @@ mod __test {
18561856
},]
18571857
);
18581858
}
1859+
1860+
#[test]
1861+
fn test_exclude() {
1862+
let mut config = configure(&[], &[]);
1863+
config.exclude = vec![
1864+
"src/test/run-pass".into(),
1865+
"src/tools/tidy".into(),
1866+
];
1867+
config.cmd = Subcommand::Test {
1868+
paths: Vec::new(),
1869+
test_args: Vec::new(),
1870+
rustc_args: Vec::new(),
1871+
fail_fast: true,
1872+
doc_tests: DocTests::No,
1873+
bless: false,
1874+
compare_mode: None,
1875+
};
1876+
1877+
let build = Build::new(config);
1878+
let builder = Builder::new(&build);
1879+
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Test), &[]);
1880+
1881+
// Ensure we have really excluded run-pass & tidy
1882+
assert!(!builder.cache.contains::<test::RunPass>());
1883+
assert!(!builder.cache.contains::<test::Tidy>());
1884+
1885+
// Ensure other tests are not affected.
1886+
assert!(builder.cache.contains::<test::RunPassFullDeps>());
1887+
assert!(builder.cache.contains::<test::RustdocUi>());
1888+
}
18591889
}

src/bootstrap/cache.rs

+5
Original file line numberDiff line numberDiff line change
@@ -286,4 +286,9 @@ impl Cache {
286286
v.sort_by_key(|&(a, _)| a);
287287
v
288288
}
289+
290+
#[cfg(test)]
291+
pub fn contains<S: Step>(&self) -> bool {
292+
self.0.borrow().contains_key(&TypeId::of::<S>())
293+
}
289294
}

0 commit comments

Comments
 (0)