Skip to content

Commit 04fdb44

Browse files
committed
Auto merge of #55661 - kennytm:fix-exclude, r=alexcrichton
Fixed the bug in bootstrap where --exclude was ignored for run-pass test This should fix the 3 hour timeout on AppVeyor which happened a lot recently. Additionally, further rebalanced the AppVeyor subsets by moving "ui" and "linkchecker" into Set 2.
2 parents a3f0f51 + 2bde4e7 commit 04fdb44

File tree

3 files changed

+43
-3
lines changed

3 files changed

+43
-3
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
}

src/bootstrap/mk/Makefile.in

+6-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,12 @@ check-stage2-T-arm-linux-androideabi-H-x86_64-unknown-linux-gnu:
8585
check-stage2-T-x86_64-unknown-linux-musl-H-x86_64-unknown-linux-gnu:
8686
$(Q)$(BOOTSTRAP) test --target x86_64-unknown-linux-musl
8787

88-
TESTS_IN_2 := src/test/run-pass src/test/compile-fail src/test/run-pass-fulldeps
88+
TESTS_IN_2 := \
89+
src/test/ui \
90+
src/test/run-pass \
91+
src/test/compile-fail \
92+
src/test/run-pass-fulldeps \
93+
src/tools/linkchecker
8994

9095
appveyor-subset-1:
9196
$(Q)$(BOOTSTRAP) test $(TESTS_IN_2:%=--exclude %)

0 commit comments

Comments
 (0)