Skip to content

Commit a257332

Browse files
committed
Ensure --exclude is checked against PathSet::Suite
Fix the recent spurious 3 hour timeouts.
1 parent 3d28ee3 commit a257332

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

@@ -1849,7 +1849,7 @@ mod __test {
18491849
);
18501850

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

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)