about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-01-11 11:17:22 +0000
committerbors <bors@rust-lang.org>2023-01-11 11:17:22 +0000
commitb22c152958eade17a71d899b29a2d39bcc77aa48 (patch)
treeec6da75dc598a0a4086c0cc032c86d7241be1bc1 /src/bootstrap
parent8ecaad85f61375b18e1667b51a3ef350121d2ca0 (diff)
parent40ba0e84d53f605ccf01836e9c2d27892728ae81 (diff)
downloadrust-b22c152958eade17a71d899b29a2d39bcc77aa48.tar.gz
rust-b22c152958eade17a71d899b29a2d39bcc77aa48.zip
Auto merge of #106458 - albertlarsan68:move-tests, r=jyn514
Move src/test to the root

See MCP at rust-lang/compiler-team#573

There may be more changes needed.

The first commit is just the move of the files:
You can check that the first commit did not do anything else than renames by running
```
git diff --diff-filter=r -M100% <rust-lang remote>/master <first commit hash>
```
The output should be empty, because the filter excludes renames, and the match threshold for qualifying a rename is 100%.

The second one is mostly a "find and replace" of `src/test` to `tests` and whatever is needed to make CI pass.

What is left to do:
---

- [x] Move directory
- [ ] Change references to `src/test`
    - [x] Change references in-tree
    - [ ] Change references in submodules / out-of-tree docs
- [x] Make CI pass:
    - [x] Fix tidy
    - [x] Fix tests
    - [x] Bless tests if needed (shouldn't normally)
- [ ] Merge it !
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/README.md4
-rw-r--r--src/bootstrap/builder.rs6
-rw-r--r--src/bootstrap/builder/tests.rs2
-rw-r--r--src/bootstrap/compile.rs2
-rwxr-xr-xsrc/bootstrap/configure.py2
-rw-r--r--src/bootstrap/flags.rs8
-rw-r--r--src/bootstrap/mk/Makefile.in4
-rw-r--r--src/bootstrap/native.rs6
-rw-r--r--src/bootstrap/setup.rs2
-rw-r--r--src/bootstrap/test.rs68
10 files changed, 48 insertions, 56 deletions
diff --git a/src/bootstrap/README.md b/src/bootstrap/README.md
index 79c2eb31cda..8dce9e79e16 100644
--- a/src/bootstrap/README.md
+++ b/src/bootstrap/README.md
@@ -59,10 +59,10 @@ The script accepts commands, flags, and arguments to determine what to do:
   ./x.py test tidy
 
   # execute the UI test suite
-  ./x.py test src/test/ui
+  ./x.py test tests/ui
 
   # execute only some tests in the UI test suite
-  ./x.py test src/test/ui --test-args substring-of-test-name
+  ./x.py test tests/ui --test-args substring-of-test-name
 
   # execute tests in the standard library in stage0
   ./x.py test --stage 0 library/std
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index b54bf432621..52a83fa29c7 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -191,9 +191,9 @@ pub enum PathSet {
     /// A "suite" of paths.
     ///
     /// These can match as a path suffix (like `Set`), or as a prefix. For
-    /// example, a command-line value of `src/test/ui/abi/variadic-ffi.rs`
-    /// will match `src/test/ui`. A command-line value of `ui` would also
-    /// match `src/test/ui`.
+    /// example, a command-line value of `tests/ui/abi/variadic-ffi.rs`
+    /// will match `tests/ui`. A command-line value of `ui` would also
+    /// match `tests/ui`.
     Suite(TaskPath),
 }
 
diff --git a/src/bootstrap/builder/tests.rs b/src/bootstrap/builder/tests.rs
index 5f21d2b0067..d5fcd107502 100644
--- a/src/bootstrap/builder/tests.rs
+++ b/src/bootstrap/builder/tests.rs
@@ -78,7 +78,7 @@ macro_rules! rustc {
 #[test]
 fn test_valid() {
     // make sure multi suite paths are accepted
-    check_cli(["test", "src/test/ui/attr-start.rs", "src/test/ui/attr-shebang.rs"]);
+    check_cli(["test", "tests/ui/attr-start.rs", "tests/ui/attr-shebang.rs"]);
 }
 
 #[test]
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 6b211d3ec6e..68d1db0160a 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -1193,7 +1193,7 @@ impl Step for Sysroot {
             );
             if builder.config.rust_remap_debuginfo {
                 eprintln!(
-                    "warning: some `src/test/ui` tests will fail when lacking `{}`",
+                    "warning: some `tests/ui` tests will fail when lacking `{}`",
                     sysroot_lib_rustlib_src_rust.display(),
                 );
             }
diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py
index 31cc4aa57bb..0af329e7007 100755
--- a/src/bootstrap/configure.py
+++ b/src/bootstrap/configure.py
@@ -45,7 +45,7 @@ o("llvm-static-stdcpp", "llvm.static-libstdcpp", "statically link to libstdc++ f
 o("llvm-link-shared", "llvm.link-shared", "prefer shared linking to LLVM (llvm-config --link-shared)")
 o("rpath", "rust.rpath", "build rpaths into rustc itself")
 o("llvm-version-check", "llvm.version-check", "check if the LLVM version is supported, build anyway")
-o("codegen-tests", "rust.codegen-tests", "run the src/test/codegen tests")
+o("codegen-tests", "rust.codegen-tests", "run the tests/codegen tests")
 o("option-checking", None, "complain about unrecognized options in this configure script")
 o("ninja", "llvm.ninja", "build LLVM using the Ninja generator (for MSVC, requires building in the correct environment)")
 o("locked-deps", "build.locked-deps", "force Cargo.lock to be up to date")
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs
index 2c6d201d18f..52c3dc0bf75 100644
--- a/src/bootstrap/flags.rs
+++ b/src/bootstrap/flags.rs
@@ -487,13 +487,13 @@ Arguments:
     This subcommand accepts a number of paths to test directories that
     should be compiled and run. For example:
 
-        ./x.py test src/test/ui
+        ./x.py test tests/ui
         ./x.py test library/std --test-args hash_map
         ./x.py test library/std --stage 0 --no-doc
-        ./x.py test src/test/ui --bless
-        ./x.py test src/test/ui --compare-mode chalk
+        ./x.py test tests/ui --bless
+        ./x.py test tests/ui --compare-mode chalk
 
-    Note that `test src/test/* --stage N` does NOT depend on `build compiler/rustc --stage N`;
+    Note that `test tests/* --stage N` does NOT depend on `build compiler/rustc --stage N`;
     just like `build library/std --stage N` it tests the compiler produced by the previous
     stage.
 
diff --git a/src/bootstrap/mk/Makefile.in b/src/bootstrap/mk/Makefile.in
index 5b2aba9aa2d..d54a21b9f16 100644
--- a/src/bootstrap/mk/Makefile.in
+++ b/src/bootstrap/mk/Makefile.in
@@ -58,7 +58,7 @@ prepare:
 	$(Q)$(BOOTSTRAP) build --stage 2 nonexistent/path/to/trigger/cargo/metadata
 
 TESTS_IN_2 := \
-	src/test/ui \
+	tests/ui \
 	src/tools/linkchecker
 
 ## MSVC native builders
@@ -72,7 +72,7 @@ ci-subset-2:
 ## MingW native builders
 
 TESTS_IN_MINGW_2 := \
-	src/test/ui
+	tests/ui
 
 ci-mingw-subset-1:
 	$(Q)$(CFG_SRC_DIR)/x test --stage 2 $(TESTS_IN_MINGW_2:%=--exclude %)
diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
index 89bb2b770f9..e0d1504c9c7 100644
--- a/src/bootstrap/native.rs
+++ b/src/bootstrap/native.rs
@@ -907,7 +907,7 @@ impl Step for TestHelpers {
     type Output = ();
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
-        run.path("src/test/auxiliary/rust_test_helpers.c")
+        run.path("tests/auxiliary/rust_test_helpers.c")
     }
 
     fn make_run(run: RunConfig<'_>) {
@@ -929,7 +929,7 @@ impl Step for TestHelpers {
             self.target
         };
         let dst = builder.test_helpers_out(target);
-        let src = builder.src.join("src/test/auxiliary/rust_test_helpers.c");
+        let src = builder.src.join("tests/auxiliary/rust_test_helpers.c");
         if up_to_date(&src, &dst.join("librust_test_helpers.a")) {
             return;
         }
@@ -958,7 +958,7 @@ impl Step for TestHelpers {
             .opt_level(0)
             .warnings(false)
             .debug(false)
-            .file(builder.src.join("src/test/auxiliary/rust_test_helpers.c"))
+            .file(builder.src.join("tests/auxiliary/rust_test_helpers.c"))
             .compile("rust_test_helpers");
     }
 }
diff --git a/src/bootstrap/setup.rs b/src/bootstrap/setup.rs
index ca4feac6fac..004601cb68b 100644
--- a/src/bootstrap/setup.rs
+++ b/src/bootstrap/setup.rs
@@ -144,7 +144,7 @@ pub fn setup(config: &Config, profile: Profile) {
         Profile::Tools => &[
             "check",
             "build",
-            "test src/test/rustdoc*",
+            "test tests/rustdoc*",
             "test src/tools/clippy",
             "test src/tools/miri",
             "test src/tools/rustfmt",
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index ea906be7e3a..159f2fba671 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -841,7 +841,7 @@ impl Step for RustdocJSStd {
     const ONLY_HOSTS: bool = true;
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
-        run.suite_path("src/test/rustdoc-js-std")
+        run.suite_path("tests/rustdoc-js-std")
     }
 
     fn make_run(run: RunConfig<'_>) {
@@ -860,10 +860,10 @@ impl Step for RustdocJSStd {
                 .arg("--doc-folder")
                 .arg(builder.doc_out(self.target))
                 .arg("--test-folder")
-                .arg(builder.src.join("src/test/rustdoc-js-std"));
+                .arg(builder.src.join("tests/rustdoc-js-std"));
             for path in &builder.paths {
                 if let Some(p) =
-                    util::is_valid_test_suite_arg(path, "src/test/rustdoc-js-std", builder)
+                    util::is_valid_test_suite_arg(path, "tests/rustdoc-js-std", builder)
                 {
                     if !p.ends_with(".js") {
                         eprintln!("A non-js file was given: `{}`", path.display());
@@ -879,7 +879,7 @@ impl Step for RustdocJSStd {
             });
             builder.run(&mut command);
         } else {
-            builder.info("No nodejs found, skipping \"src/test/rustdoc-js-std\" tests");
+            builder.info("No nodejs found, skipping \"tests/rustdoc-js-std\" tests");
         }
     }
 }
@@ -896,7 +896,7 @@ impl Step for RustdocJSNotStd {
     const ONLY_HOSTS: bool = true;
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
-        run.suite_path("src/test/rustdoc-js")
+        run.suite_path("tests/rustdoc-js")
     }
 
     fn make_run(run: RunConfig<'_>) {
@@ -911,11 +911,11 @@ impl Step for RustdocJSNotStd {
                 target: self.target,
                 mode: "js-doc-test",
                 suite: "rustdoc-js",
-                path: "src/test/rustdoc-js",
+                path: "tests/rustdoc-js",
                 compare_mode: None,
             });
         } else {
-            builder.info("No nodejs found, skipping \"src/test/rustdoc-js\" tests");
+            builder.info("No nodejs found, skipping \"tests/rustdoc-js\" tests");
         }
     }
 }
@@ -976,7 +976,7 @@ impl Step for RustdocGUI {
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
         let builder = run.builder;
-        let run = run.suite_path("src/test/rustdoc-gui");
+        let run = run.suite_path("tests/rustdoc-gui");
         run.lazy_default_condition(Box::new(move || {
             builder.config.nodejs.is_some()
                 && builder
@@ -1025,7 +1025,7 @@ impl Step for RustdocGUI {
         // We remove existing folder to be sure there won't be artifacts remaining.
         builder.clear_if_dirty(&out_dir, &builder.rustdoc(self.compiler));
 
-        let src_path = builder.build.src.join("src/test/rustdoc-gui/src");
+        let src_path = builder.build.src.join("tests/rustdoc-gui/src");
         // We generate docs for the libraries present in the rustdoc-gui's src folder.
         for entry in src_path.read_dir().expect("read_dir call failed") {
             if let Ok(entry) = entry {
@@ -1064,9 +1064,9 @@ impl Step for RustdocGUI {
             .arg("--doc-folder")
             .arg(out_dir.join("doc"))
             .arg("--tests-folder")
-            .arg(builder.build.src.join("src/test/rustdoc-gui"));
+            .arg(builder.build.src.join("tests/rustdoc-gui"));
         for path in &builder.paths {
-            if let Some(p) = util::is_valid_test_suite_arg(path, "src/test/rustdoc-gui", builder) {
+            if let Some(p) = util::is_valid_test_suite_arg(path, "tests/rustdoc-gui", builder) {
                 if !p.ends_with(".goml") {
                     eprintln!("A non-goml file was given: `{}`", path.display());
                     panic!("Cannot run rustdoc-gui tests");
@@ -1308,59 +1308,51 @@ macro_rules! test_definitions {
     };
 }
 
-default_test!(Ui { path: "src/test/ui", mode: "ui", suite: "ui" });
+default_test!(Ui { path: "tests/ui", mode: "ui", suite: "ui" });
 
 default_test!(RunPassValgrind {
-    path: "src/test/run-pass-valgrind",
+    path: "tests/run-pass-valgrind",
     mode: "run-pass-valgrind",
     suite: "run-pass-valgrind"
 });
 
-default_test!(MirOpt { path: "src/test/mir-opt", mode: "mir-opt", suite: "mir-opt" });
+default_test!(MirOpt { path: "tests/mir-opt", mode: "mir-opt", suite: "mir-opt" });
 
-default_test!(Codegen { path: "src/test/codegen", mode: "codegen", suite: "codegen" });
+default_test!(Codegen { path: "tests/codegen", mode: "codegen", suite: "codegen" });
 
 default_test!(CodegenUnits {
-    path: "src/test/codegen-units",
+    path: "tests/codegen-units",
     mode: "codegen-units",
     suite: "codegen-units"
 });
 
-default_test!(Incremental {
-    path: "src/test/incremental",
-    mode: "incremental",
-    suite: "incremental"
-});
+default_test!(Incremental { path: "tests/incremental", mode: "incremental", suite: "incremental" });
 
 default_test_with_compare_mode!(Debuginfo {
-    path: "src/test/debuginfo",
+    path: "tests/debuginfo",
     mode: "debuginfo",
     suite: "debuginfo",
     compare_mode: "split-dwarf"
 });
 
-host_test!(UiFullDeps { path: "src/test/ui-fulldeps", mode: "ui", suite: "ui-fulldeps" });
+host_test!(UiFullDeps { path: "tests/ui-fulldeps", mode: "ui", suite: "ui-fulldeps" });
 
-host_test!(Rustdoc { path: "src/test/rustdoc", mode: "rustdoc", suite: "rustdoc" });
-host_test!(RustdocUi { path: "src/test/rustdoc-ui", mode: "ui", suite: "rustdoc-ui" });
+host_test!(Rustdoc { path: "tests/rustdoc", mode: "rustdoc", suite: "rustdoc" });
+host_test!(RustdocUi { path: "tests/rustdoc-ui", mode: "ui", suite: "rustdoc-ui" });
 
-host_test!(RustdocJson {
-    path: "src/test/rustdoc-json",
-    mode: "rustdoc-json",
-    suite: "rustdoc-json"
-});
+host_test!(RustdocJson { path: "tests/rustdoc-json", mode: "rustdoc-json", suite: "rustdoc-json" });
 
-host_test!(Pretty { path: "src/test/pretty", mode: "pretty", suite: "pretty" });
+host_test!(Pretty { path: "tests/pretty", mode: "pretty", suite: "pretty" });
 
-default_test!(RunMake { path: "src/test/run-make", mode: "run-make", suite: "run-make" });
+default_test!(RunMake { path: "tests/run-make", mode: "run-make", suite: "run-make" });
 
 host_test!(RunMakeFullDeps {
-    path: "src/test/run-make-fulldeps",
+    path: "tests/run-make-fulldeps",
     mode: "run-make",
     suite: "run-make-fulldeps"
 });
 
-default_test!(Assembly { path: "src/test/assembly", mode: "assembly", suite: "assembly" });
+default_test!(Assembly { path: "tests/assembly", mode: "assembly", suite: "assembly" });
 
 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
 struct Compiletest {
@@ -1472,7 +1464,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the
             cmd.arg("--rust-demangler-path").arg(rust_demangler);
         }
 
-        cmd.arg("--src-base").arg(builder.src.join("src/test").join(suite));
+        cmd.arg("--src-base").arg(builder.src.join("tests").join(suite));
         cmd.arg("--build-base").arg(testdir(builder, compiler.host).join(suite));
         cmd.arg("--sysroot-base").arg(builder.sysroot(compiler));
         cmd.arg("--stage-id").arg(format!("stage{}-{}", compiler.stage, target));
@@ -1936,7 +1928,7 @@ impl Step for ErrorIndex {
     fn make_run(run: RunConfig<'_>) {
         // error_index_generator depends on librustdoc. Use the compiler that
         // is normally used to build rustdoc for other tests (like compiletest
-        // tests in src/test/rustdoc) so that it shares the same artifacts.
+        // tests in tests/rustdoc) so that it shares the same artifacts.
         let compiler = run.builder.compiler(run.builder.top_stage, run.builder.config.build);
         run.builder.ensure(ErrorIndex { compiler });
     }
@@ -2233,7 +2225,7 @@ impl Step for CrateRustdoc {
             builder.compiler(builder.top_stage, target)
         } else {
             // Use the previous stage compiler to reuse the artifacts that are
-            // created when running compiletest for src/test/rustdoc. If this used
+            // created when running compiletest for tests/rustdoc. If this used
             // `compiler`, then it would cause rustdoc to be built *again*, which
             // isn't really necessary.
             builder.compiler_for(builder.top_stage, target, target)
@@ -2349,7 +2341,7 @@ impl Step for CrateRustdocJsonTypes {
         let target = self.host;
 
         // Use the previous stage compiler to reuse the artifacts that are
-        // created when running compiletest for src/test/rustdoc. If this used
+        // created when running compiletest for tests/rustdoc. If this used
         // `compiler`, then it would cause rustdoc to be built *again*, which
         // isn't really necessary.
         let compiler = builder.compiler_for(builder.top_stage, target, target);