about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2023-11-23 16:41:16 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2023-12-04 15:29:23 +0100
commit3c6bae7fa88d700a34b57f43e55749c510c57b72 (patch)
treedc12053c28ebbf9172a7cfa7cd6f9769722abdcf
parent4bed89f79bfd40fdfe615334c38e2427319db34f (diff)
downloadrust-3c6bae7fa88d700a34b57f43e55749c510c57b72.tar.gz
rust-3c6bae7fa88d700a34b57f43e55749c510c57b72.zip
Use the correct folder when deleting rust UI tests
-rw-r--r--build_system/src/test.rs26
1 files changed, 15 insertions, 11 deletions
diff --git a/build_system/src/test.rs b/build_system/src/test.rs
index 114aa6dc720..16f01a1ba2d 100644
--- a/build_system/src/test.rs
+++ b/build_system/src/test.rs
@@ -942,13 +942,15 @@ where
         Ok(())
     }
 
-    walk_dir("rust/tests/ui", dir_handling, file_handling)?;
-    let file = "rust/tests/ui/consts/const_cmp_type_id.rs";
-    std::fs::remove_file(file)
-        .map_err(|error| format!("Failed to remove `{}`: {:?}", file, error))?;
-    let file = "rust/tests/ui/consts/issue-73976-monomorphic.rs";
-    std::fs::remove_file(file)
-        .map_err(|error| format!("Failed to remove `{}`: {:?}", file, error))?;
+    let rust_path = Path::new("rust");
+
+    walk_dir(rust_path.join("tests/ui"), dir_handling, file_handling)?;
+    let file = rust_path.join("tests/ui/consts/const_cmp_type_id.rs");
+    std::fs::remove_file(&file)
+        .map_err(|error| format!("Failed to remove `{}`: {:?}", file.display(), error))?;
+    let file = rust_path.join("tests/ui/consts/issue-73976-monomorphic.rs");
+    std::fs::remove_file(&file)
+        .map_err(|error| format!("Failed to remove `{}`: {:?}", file.display(), error))?;
 
     if !callback()? {
         // FIXME: create a function "display_if_not_quiet" or something along the line.
@@ -976,7 +978,7 @@ where
                     &"-path",
                     &"*/auxiliary/*",
                 ],
-                Some(Path::new("rust")),
+                Some(rust_path),
             )?
             .stdout,
         )
@@ -997,8 +999,10 @@ where
             if pos >= start && pos <= end {
                 continue;
             }
-            std::fs::remove_file(path)
-                .map_err(|error| format!("Failed to remove `{}`: {:?}", path, error))?;
+            let test_path = rust_path.join(path);
+            std::fs::remove_file(&test_path).map_err(|error| {
+                format!("Failed to remove `{}`: {:?}", test_path.display(), error)
+            })?;
         }
     }
 
@@ -1020,7 +1024,7 @@ where
             &"--rustc-args",
             &rustc_args,
         ],
-        Some(Path::new("rust")),
+        Some(rust_path),
         Some(&env),
     )?;
     Ok(())