about summary refs log tree commit diff
path: root/src/bootstrap/builder/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bootstrap/builder/tests.rs')
-rw-r--r--src/bootstrap/builder/tests.rs37
1 files changed, 15 insertions, 22 deletions
diff --git a/src/bootstrap/builder/tests.rs b/src/bootstrap/builder/tests.rs
index d76b830b0e5..31dcee58216 100644
--- a/src/bootstrap/builder/tests.rs
+++ b/src/bootstrap/builder/tests.rs
@@ -101,23 +101,21 @@ fn test_invalid() {
 
 #[test]
 fn test_intersection() {
-    let set = PathSet::Set(
-        ["library/core", "library/alloc", "library/std"].into_iter().map(TaskPath::parse).collect(),
-    );
+    let set = |paths: &[&str]| {
+        PathSet::Set(paths.into_iter().map(|p| TaskPath { path: p.into(), kind: None }).collect())
+    };
+    let library_set = set(&["library/core", "library/alloc", "library/std"]);
     let mut command_paths =
         vec![Path::new("library/core"), Path::new("library/alloc"), Path::new("library/stdarch")];
-    let subset = set.intersection_removing_matches(&mut command_paths, None);
-    assert_eq!(
-        subset,
-        PathSet::Set(["library/core", "library/alloc"].into_iter().map(TaskPath::parse).collect())
-    );
+    let subset = library_set.intersection_removing_matches(&mut command_paths, Kind::Build);
+    assert_eq!(subset, set(&["library/core", "library/alloc"]),);
     assert_eq!(command_paths, vec![Path::new("library/stdarch")]);
 }
 
 #[test]
 fn test_exclude() {
     let mut config = configure("test", &["A"], &["A"]);
-    config.exclude = vec![TaskPath::parse("src/tools/tidy")];
+    config.exclude = vec!["src/tools/tidy".into()];
     let cache = run_build(&[], config);
 
     // Ensure we have really excluded tidy
@@ -129,21 +127,16 @@ fn test_exclude() {
 
 #[test]
 fn test_exclude_kind() {
-    let path = PathBuf::from("src/tools/cargotest");
-    let exclude = TaskPath::parse("test::src/tools/cargotest");
-    assert_eq!(exclude, TaskPath { kind: Some(Kind::Test), path: path.clone() });
+    let path = PathBuf::from("compiler/rustc_data_structures");
 
     let mut config = configure("test", &["A"], &["A"]);
-    // Ensure our test is valid, and `test::Cargotest` would be run without the exclude.
-    assert!(run_build(&[path.clone()], config.clone()).contains::<test::Cargotest>());
-    // Ensure tests for cargotest are skipped.
-    config.exclude = vec![exclude.clone()];
-    assert!(!run_build(&[path.clone()], config).contains::<test::Cargotest>());
-
-    // Ensure builds for cargotest are not skipped.
-    let mut config = configure("build", &["A"], &["A"]);
-    config.exclude = vec![exclude];
-    assert!(run_build(&[path], config).contains::<tool::CargoTest>());
+    // Ensure our test is valid, and `test::Rustc` would be run without the exclude.
+    assert!(run_build(&[], config.clone()).contains::<test::CrateLibrustc>());
+    // Ensure tests for rustc are skipped.
+    config.exclude = vec![path.clone()];
+    assert!(!run_build(&[], config.clone()).contains::<test::CrateLibrustc>());
+    // Ensure builds for rustc are not skipped.
+    assert!(run_build(&[], config).contains::<compile::Rustc>());
 }
 
 /// Ensure that if someone passes both a single crate and `library`, all library crates get built.