From a25733215905fdf7196b6eb996648fad0d2ae964 Mon Sep 17 00:00:00 2001 From: kennytm Date: Sun, 4 Nov 2018 02:32:53 +0800 Subject: [PATCH] Ensure --exclude is checked against PathSet::Suite Fix the recent spurious 3 hour timeouts. --- src/bootstrap/builder.rs | 34 ++++++++++++++++++++++++++++++++-- src/bootstrap/cache.rs | 5 +++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index c7121cb0369..900f336ef8c 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -130,7 +130,7 @@ impl PathSet { fn has(&self, needle: &Path) -> bool { match self { PathSet::Set(set) => set.iter().any(|p| p.ends_with(needle)), - PathSet::Suite(_) => false, + PathSet::Suite(suite) => suite.ends_with(needle), } } @@ -1849,7 +1849,7 @@ mod __test { ); // Ensure we don't build any compiler artifacts. - assert!(builder.cache.all::().is_empty()); + assert!(!builder.cache.contains::()); assert_eq!( first(builder.cache.all::()), &[test::Crate { @@ -1861,4 +1861,34 @@ mod __test { },] ); } + + #[test] + fn test_exclude() { + let mut config = configure(&[], &[]); + config.exclude = vec![ + "src/test/run-pass".into(), + "src/tools/tidy".into(), + ]; + config.cmd = Subcommand::Test { + paths: Vec::new(), + test_args: Vec::new(), + rustc_args: Vec::new(), + fail_fast: true, + doc_tests: DocTests::No, + bless: false, + compare_mode: None, + }; + + let build = Build::new(config); + let builder = Builder::new(&build); + builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Test), &[]); + + // Ensure we have really excluded run-pass & tidy + assert!(!builder.cache.contains::()); + assert!(!builder.cache.contains::()); + + // Ensure other tests are not affected. + assert!(builder.cache.contains::()); + assert!(builder.cache.contains::()); + } } diff --git a/src/bootstrap/cache.rs b/src/bootstrap/cache.rs index fd9a1be2072..0b561a3523f 100644 --- a/src/bootstrap/cache.rs +++ b/src/bootstrap/cache.rs @@ -286,4 +286,9 @@ impl Cache { v.sort_by_key(|&(a, _)| a); v } + + #[cfg(test)] + pub fn contains(&self) -> bool { + self.0.borrow().contains_key(&TypeId::of::()) + } }