diff options
| author | Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> | 2023-01-05 09:45:44 +0100 |
|---|---|---|
| committer | Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> | 2023-01-11 09:32:13 +0000 |
| commit | 40ba0e84d53f605ccf01836e9c2d27892728ae81 (patch) | |
| tree | e8cb2c8310381b238e1b0e3b42f2d313712ba7f8 /src | |
| parent | cf2dff2b1e3fa55fa5415d524200070d0d7aacfe (diff) | |
Change `src/test` to `tests` in source files, fix tidy and tests
Diffstat (limited to 'src')
45 files changed, 133 insertions, 129 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); diff --git a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile index 26eb69f2eae..34829adf79b 100644 --- a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile @@ -48,7 +48,7 @@ RUN CC=gcc CFLAGS="-m32 -Wa,-mrelax-relocations=no" \ rm -rf /build # FIXME: musl really shouldn't be linking libgcc_s.so, as it's linked to glibc, -# but it's required by src/test/ui/proc-macro/crt-static.rs. Ubuntu:16.04 gcc-5 +# but it's required by tests/ui/proc-macro/crt-static.rs. Ubuntu:16.04 gcc-5 # had libgcc_s.so as a symlink to the absolute libgcc_s.so.1, but now it's an # ld-script that expects to find libgcc_s.so.1 in the library search path. # See also https://github.com/rust-lang/rust/issues/82521 diff --git a/src/ci/docker/host-x86_64/dist-various-1/Dockerfile b/src/ci/docker/host-x86_64/dist-various-1/Dockerfile index cd0f01faa1b..4576e6d4fa2 100644 --- a/src/ci/docker/host-x86_64/dist-various-1/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-various-1/Dockerfile @@ -183,7 +183,7 @@ ENV RUST_CONFIGURE_ARGS \ --disable-docs ENV SCRIPT \ - python3 ../x.py --stage 2 test --host='' --target $RUN_MAKE_TARGETS src/test/run-make && \ + python3 ../x.py --stage 2 test --host='' --target $RUN_MAKE_TARGETS tests/run-make && \ python3 ../x.py dist --host='' --target $TARGETS # sccache diff --git a/src/ci/docker/host-x86_64/i686-gnu/Dockerfile b/src/ci/docker/host-x86_64/i686-gnu/Dockerfile index cb6559707d9..d9e58386256 100644 --- a/src/ci/docker/host-x86_64/i686-gnu/Dockerfile +++ b/src/ci/docker/host-x86_64/i686-gnu/Dockerfile @@ -27,6 +27,6 @@ ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu # this slow job. ENV SCRIPT python3 ../x.py --stage 2 test \ --exclude src/bootstrap \ - --exclude src/test/rustdoc-js \ + --exclude tests/rustdoc-js \ --exclude src/tools/error_index_generator \ --exclude src/tools/linkchecker diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile index cf4451f8b33..930f58baf02 100644 --- a/src/ci/docker/host-x86_64/test-various/Dockerfile +++ b/src/ci/docker/host-x86_64/test-various/Dockerfile @@ -59,16 +59,16 @@ ENV NO_OVERFLOW_CHECKS=1 ENV WASM_TARGETS=wasm32-unknown-unknown ENV WASM_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $WASM_TARGETS \ - src/test/run-make \ - src/test/ui \ - src/test/mir-opt \ - src/test/codegen-units \ + tests/run-make \ + tests/ui \ + tests/mir-opt \ + tests/codegen-units \ library/core ENV NVPTX_TARGETS=nvptx64-nvidia-cuda ENV NVPTX_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $NVPTX_TARGETS \ - src/test/run-make \ - src/test/assembly + tests/run-make \ + tests/assembly ENV MUSL_TARGETS=x86_64-unknown-linux-musl \ CC_x86_64_unknown_linux_musl=x86_64-linux-musl-gcc \ diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile index c2b002055a8..735d4d4dfcf 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile @@ -46,4 +46,4 @@ ENV RUST_CONFIGURE_ARGS \ ENV SCRIPT \ python3 ../x.py --stage 2 build && \ - python3 ../x.py --stage 2 test src/test/run-make-fulldeps --test-args clang + python3 ../x.py --stage 2 test tests/run-make-fulldeps --test-args clang diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-13-stage1/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-13-stage1/Dockerfile index 16976a9428e..bcbf58253b1 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-13-stage1/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-13-stage1/Dockerfile @@ -45,5 +45,5 @@ ENV SCRIPT python2.7 ../x.py --stage 1 test --exclude src/tools/tidy && \ # the PR is approved and tested for merging. # It will also detect tests lacking `// EMIT_MIR_FOR_EACH_BIT_WIDTH`, # despite having different output on 32-bit vs 64-bit targets. - python2.7 ../x.py --stage 1 test src/test/mir-opt \ + python2.7 ../x.py --stage 1 test tests/mir-opt \ --host='' --target=i686-unknown-linux-gnu diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-13/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-13/Dockerfile index 06f15bd1211..9fc9e9cbffb 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-13/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-13/Dockerfile @@ -56,14 +56,14 @@ ENV SCRIPT ../x.py --stage 2 test --exclude src/tools/tidy && \ # the PR is approved and tested for merging. # It will also detect tests lacking `// EMIT_MIR_FOR_EACH_BIT_WIDTH`, # despite having different output on 32-bit vs 64-bit targets. - ../x --stage 2 test src/test/mir-opt \ + ../x --stage 2 test tests/mir-opt \ --host='' --target=i686-unknown-linux-gnu && \ # Run the UI test suite again, but in `--pass=check` mode # # This is intended to make sure that both `--pass=check` continues to # work. # - ../x.ps1 --stage 2 test src/test/ui --pass=check \ + ../x.ps1 --stage 2 test tests/ui --pass=check \ --host='' --target=i686-unknown-linux-gnu && \ # Run tidy at the very end, after all the other tests. python2.7 ../x.py --stage 2 test src/tools/tidy diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile index 58c0c5db1a5..85f2f84a44c 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile @@ -84,5 +84,5 @@ ENV RUST_CONFIGURE_ARGS \ --save-toolstates=/tmp/toolstate/toolstates.json ENV SCRIPT /tmp/checktools.sh ../x.py && \ - NODE_PATH=`npm root -g` python3 ../x.py test src/test/rustdoc-gui --stage 2 \ + NODE_PATH=`npm root -g` python3 ../x.py test tests/rustdoc-gui --stage 2 \ --test-args "'--no-sandbox --jobs 1'" diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index d33396dcc80..d2a9264c84a 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -511,7 +511,7 @@ jobs: - name: x86_64-apple-1 env: &env-x86_64-apple-tests - SCRIPT: ./x.py --stage 2 test --exclude src/test/ui --exclude src/test/rustdoc --exclude src/test/run-make-fulldeps + SCRIPT: ./x.py --stage 2 test --exclude tests/ui --exclude tests/rustdoc --exclude tests/run-make-fulldeps RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false RUSTC_RETRY_LINKER_ON_SEGFAULT: 1 MACOSX_DEPLOYMENT_TARGET: 10.8 @@ -523,7 +523,7 @@ jobs: - name: x86_64-apple-2 env: - SCRIPT: ./x.py --stage 2 test src/test/ui src/test/rustdoc src/test/run-make-fulldeps + SCRIPT: ./x.py --stage 2 test tests/ui tests/rustdoc tests/run-make-fulldeps <<: *env-x86_64-apple-tests <<: *job-macos-xl diff --git a/src/ci/scripts/should-skip-this.sh b/src/ci/scripts/should-skip-this.sh index a8a1899317f..85d77225380 100755 --- a/src/ci/scripts/should-skip-this.sh +++ b/src/ci/scripts/should-skip-this.sh @@ -27,7 +27,7 @@ if [[ -n "${CI_ONLY_WHEN_SUBMODULES_CHANGED-}" ]]; then # that breaks Miri. echo "Tool subtrees were updated" elif ! (git diff --quiet "$BASE_COMMIT" -- \ - src/test/rustdoc-gui \ + tests/rustdoc-gui \ src/librustdoc \ src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile \ src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version \ diff --git a/src/doc/rustc/src/platform-support/fuchsia.md b/src/doc/rustc/src/platform-support/fuchsia.md index 95c242cc161..29e70129a62 100644 --- a/src/doc/rustc/src/platform-support/fuchsia.md +++ b/src/doc/rustc/src/platform-support/fuchsia.md @@ -705,7 +705,7 @@ Where `${RUST_SRC_PATH}/install` is the `prefix` set in `config.toml` and Once our environment is started, we can run our tests using `x.py` as usual. The test runner script will run the compiled tests on an emulated Fuchsia device. To -run the full `src/test/ui` test suite: +run the full `tests/ui` test suite: ```sh ( \ @@ -713,7 +713,7 @@ run the full `src/test/ui` test suite: ./x.py \ --config config.toml \ --stage=2 \ - test src/test/ui \ + test tests/ui \ --target x86_64-unknown-fuchsia \ --run=always --jobs 1 \ --test-args --target-rustcflags \ diff --git a/src/doc/unstable-book/src/compiler-flags/codegen-backend.md b/src/doc/unstable-book/src/compiler-flags/codegen-backend.md index 3c0cd32fae1..67634be6993 100644 --- a/src/doc/unstable-book/src/compiler-flags/codegen-backend.md +++ b/src/doc/unstable-book/src/compiler-flags/codegen-backend.md @@ -12,7 +12,7 @@ backend. The library must be of crate type `dylib` and must contain a function named `__rustc_codegen_backend` with a signature of `fn() -> Box<dyn rustc_codegen_ssa::traits::CodegenBackend>`. ## Example -See also the [`hotplug_codegen_backend`](https://github.com/rust-lang/rust/tree/master/src/test/run-make-fulldeps/hotplug_codegen_backend) test +See also the [`hotplug_codegen_backend`](https://github.com/rust-lang/rust/tree/master/tests/run-make-fulldeps/hotplug_codegen_backend) test for a full example. ```rust,ignore (partial-example) diff --git a/src/doc/unstable-book/src/language-features/plugin.md b/src/doc/unstable-book/src/language-features/plugin.md index 56fe9a31bfe..dfbb468d4df 100644 --- a/src/doc/unstable-book/src/language-features/plugin.md +++ b/src/doc/unstable-book/src/language-features/plugin.md @@ -33,7 +33,7 @@ of a library. Plugins can extend [Rust's lint infrastructure](../../reference/attributes/diagnostics.md#lint-check-attributes) with additional checks for code style, safety, etc. Now let's write a plugin -[`lint-plugin-test.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs) +[`lint-plugin-test.rs`](https://github.com/rust-lang/rust/blob/master/tests/ui-fulldeps/auxiliary/lint-plugin-test.rs) that warns about any item named `lintme`. ```rust,ignore (requires-stage-2) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 91bc63f83b6..b2fa6e82acc 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -707,7 +707,7 @@ h2.small-section-header > .anchor { /* In most contexts we use `overflow-wrap: anywhere` to ensure that we can wrap as much as needed on mobile (see - src/test/rustdoc-gui/type-declaration-overflow.goml for an example of why + tests/rustdoc-gui/type-declaration-overflow.goml for an example of why this matters). The `anywhere` value means: "Soft wrap opportunities introduced by the word break are considered when diff --git a/src/tools/clippy/tests/ui/crashes/ice-6254.rs b/src/tools/clippy/tests/ui/crashes/ice-6254.rs index a2a60a16915..8af60890390 100644 --- a/src/tools/clippy/tests/ui/crashes/ice-6254.rs +++ b/src/tools/clippy/tests/ui/crashes/ice-6254.rs @@ -1,4 +1,4 @@ -// originally from ./src/test/ui/pattern/usefulness/consts-opaque.rs +// originally from ./tests/ui/pattern/usefulness/consts-opaque.rs // panicked at 'assertion failed: rows.iter().all(|r| r.len() == v.len())', // compiler/rustc_mir_build/src/thir/pattern/_match.rs:2030:5 diff --git a/src/tools/clippy/tests/ui/crashes/ice-6255.rs b/src/tools/clippy/tests/ui/crashes/ice-6255.rs index bd4a81d98e2..ccde6aa2b0f 100644 --- a/src/tools/clippy/tests/ui/crashes/ice-6255.rs +++ b/src/tools/clippy/tests/ui/crashes/ice-6255.rs @@ -1,4 +1,4 @@ -// originally from rustc ./src/test/ui/macros/issue-78325-inconsistent-resolution.rs +// originally from rustc ./tests/ui/macros/issue-78325-inconsistent-resolution.rs // inconsistent resolution for a macro macro_rules! define_other_core { diff --git a/src/tools/clippy/tests/ui/crashes/ice-6256.rs b/src/tools/clippy/tests/ui/crashes/ice-6256.rs index 67308263dad..f9ee3e058c1 100644 --- a/src/tools/clippy/tests/ui/crashes/ice-6256.rs +++ b/src/tools/clippy/tests/ui/crashes/ice-6256.rs @@ -1,4 +1,4 @@ -// originally from rustc ./src/test/ui/regions/issue-78262.rs +// originally from rustc ./tests/ui/regions/issue-78262.rs // ICE: to get the signature of a closure, use substs.as_closure().sig() not fn_sig() #![allow(clippy::upper_case_acronyms)] diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index a4f1167bf9d..a5f5eb447da 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -240,7 +240,7 @@ pub struct Config { pub mode: Mode, /// The test suite (essentially which directory is running, but without the - /// directory prefix such as src/test) + /// directory prefix such as tests) pub suite: String, /// The debugger to use in debuginfo mode. Unset otherwise. diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 91c701a5ddd..2aea30870ff 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -774,7 +774,7 @@ fn make_test_name( revision: Option<&String>, ) -> test::TestName { // Print the name of the file, relative to the repository root. - // `src_base` looks like `/path/to/rust/src/test/ui` + // `src_base` looks like `/path/to/rust/tests/ui` let root_directory = config.src_base.parent().unwrap().parent().unwrap().parent().unwrap(); let path = testpaths.file.strip_prefix(root_directory).unwrap(); let debugger = match config.debugger { diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 7e48dd20660..a16ab11e2f9 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2102,9 +2102,7 @@ impl<'test> TestCx<'test> { .parent() .unwrap() // chop off `ui` .parent() - .unwrap() // chop off `test` - .parent() - .unwrap(); // chop off `src` + .unwrap(); // chop off `tests` args.push(src.join("src/etc/wasm32-shim.js").display().to_string()); } @@ -2932,7 +2930,7 @@ impl<'test> TestCx<'test> { fn run_rmake_test(&self) { let cwd = env::current_dir().unwrap(); - let src_root = self.config.src_base.parent().unwrap().parent().unwrap().parent().unwrap(); + let src_root = self.config.src_base.parent().unwrap().parent().unwrap(); let src_root = cwd.join(&src_root); let tmpdir = cwd.join(self.output_base_name()); @@ -3548,8 +3546,8 @@ impl<'test> TestCx<'test> { normalize_path(parent_dir, "$DIR"); let source_bases = &[ - // Source base on the current filesystem (calculated as parent of `src/test/$suite`): - Some(self.config.src_base.parent().unwrap().parent().unwrap().parent().unwrap().into()), + // Source base on the current filesystem (calculated as parent of `tests/$suite`): + Some(self.config.src_base.parent().unwrap().parent().unwrap().into()), // Source base on the sysroot (from the src components downloaded by `download-rustc`): Some(self.config.sysroot_base.join("lib").join("rustlib").join("src").join("rust")), // Virtual `/rustc/$sha` remapped paths (if `remap-debuginfo` is enabled): diff --git a/src/tools/rust-analyzer/crates/hir-def/src/macro_expansion_tests/mbe/meta_syntax.rs b/src/tools/rust-analyzer/crates/hir-def/src/macro_expansion_tests/mbe/meta_syntax.rs index 8aff784087c..7e7b4004421 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/macro_expansion_tests/mbe/meta_syntax.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/macro_expansion_tests/mbe/meta_syntax.rs @@ -94,7 +94,7 @@ macro_rules! m2 { () => ( ${invalid()} ) } #[test] fn test_rustc_issue_57597() { - // <https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-57597.rs> + // <https://github.com/rust-lang/rust/blob/master/tests/ui/issues/issue-57597.rs> check( r#" macro_rules! m0 { ($($($i:ident)?)+) => {}; } diff --git a/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs b/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs index 64dd2bb5f2d..f0c3690962a 100644 --- a/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs +++ b/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs @@ -3624,7 +3624,7 @@ of a library. Plugins can extend [Rust's lint infrastructure](../../reference/attributes/diagnostics.md#lint-check-attributes) with additional checks for code style, safety, etc. Now let's write a plugin -[`lint-plugin-test.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs) +[`lint-plugin-test.rs`](https://github.com/rust-lang/rust/blob/master/tests/ui-fulldeps/auxiliary/lint-plugin-test.rs) that warns about any item named `lintme`. ```rust,ignore (requires-stage-2) diff --git a/src/tools/rustdoc-gui/tester.js b/src/tools/rustdoc-gui/tester.js index 554b2f81fa3..2f0ca1ec3d0 100644 --- a/src/tools/rustdoc-gui/tester.js +++ b/src/tools/rustdoc-gui/tester.js @@ -262,7 +262,7 @@ async function main(argv) { console.log(""); console.log( "`browser-ui-test` crashed unexpectedly. Please try again with adding `--test-args \ ---no-sandbox` at the end. For example: `x.py test src/test/rustdoc-gui --test-args --no-sandbox`"); +--no-sandbox` at the end. For example: `x.py test tests/rustdoc-gui --test-args --no-sandbox`"); console.log(""); } }; diff --git a/src/tools/rustfmt/tests/source/issue-2445.rs b/src/tools/rustfmt/tests/source/issue-2445.rs index 84ce6e647b8..deef429dbee 100644 --- a/src/tools/rustfmt/tests/source/issue-2445.rs +++ b/src/tools/rustfmt/tests/source/issue-2445.rs @@ -1,6 +1,6 @@ test!(RunPassPretty { // comment - path: "src/test/run-pass/pretty", + path: "tests/run-pass/pretty", mode: "pretty", suite: "run-pass", default: false, @@ -9,7 +9,7 @@ test!(RunPassPretty { test!(RunPassPretty { // comment - path: "src/test/run-pass/pretty", + path: "tests/run-pass/pretty", mode: "pretty", suite: "run-pass", default: false, diff --git a/src/tools/rustfmt/tests/target/issue-2445.rs b/src/tools/rustfmt/tests/target/issue-2445.rs index 1bc7752fd16..463c5d49576 100644 --- a/src/tools/rustfmt/tests/target/issue-2445.rs +++ b/src/tools/rustfmt/tests/target/issue-2445.rs @@ -1,6 +1,6 @@ test!(RunPassPretty { // comment - path: "src/test/run-pass/pretty", + path: "tests/run-pass/pretty", mode: "pretty", suite: "run-pass", default: false, @@ -9,7 +9,7 @@ test!(RunPassPretty { test!(RunPassPretty { // comment - path: "src/test/run-pass/pretty", + path: "tests/run-pass/pretty", mode: "pretty", suite: "run-pass", default: false, diff --git a/src/tools/tidy/src/debug_artifacts.rs b/src/tools/tidy/src/debug_artifacts.rs index 9880a32ad0c..0dd9c1e160c 100644 --- a/src/tools/tidy/src/debug_artifacts.rs +++ b/src/tools/tidy/src/debug_artifacts.rs @@ -1,14 +1,12 @@ //! Tidy check to prevent creation of unnecessary debug artifacts while running tests. use crate::walk::{filter_dirs, walk}; -use std::path::{Path, PathBuf}; +use std::path::Path; const GRAPHVIZ_POSTFLOW_MSG: &str = "`borrowck_graphviz_postflow` attribute in test"; -pub fn check(path: &Path, bad: &mut bool) { - let test_dir: PathBuf = path.join("test"); - - walk(&test_dir, &mut filter_dirs, &mut |entry, contents| { +pub fn check(test_dir: &Path, bad: &mut bool) { + walk(test_dir, &mut filter_dirs, &mut |entry, contents| { let filename = entry.path(); let is_rust = filename.extension().map_or(false, |ext| ext == "rs"); if !is_rust { diff --git a/src/tools/tidy/src/edition.rs b/src/tools/tidy/src/edition.rs index 8a7c4460dc7..8172e3d292b 100644 --- a/src/tools/tidy/src/edition.rs +++ b/src/tools/tidy/src/edition.rs @@ -11,7 +11,10 @@ fn is_edition_2021(mut line: &str) -> bool { pub fn check(path: &Path, bad: &mut bool) { walk( path, - &mut |path| filter_dirs(path) || path.ends_with("src/test"), + &mut |path| { + filter_dirs(path) + || (path.ends_with("tests") && path.join("COMPILER_TESTS.md").exists()) + }, &mut |entry, contents| { let file = entry.path(); let filename = file.file_name().unwrap(); diff --git a/src/tools/tidy/src/error_codes.rs b/src/tools/tidy/src/error_codes.rs index 9aacc07e0ab..ac8b5f6834c 100644 --- a/src/tools/tidy/src/error_codes.rs +++ b/src/tools/tidy/src/error_codes.rs @@ -8,7 +8,7 @@ //! - The explanation is expected to contain a `doctest` that fails with the correct error code. (`EXEMPT_FROM_DOCTEST` *currently* bypasses this check) //! - Note that other stylistic conventions for markdown files are checked in the `style.rs` tidy check. //! -//! 3. We check that the error code has a UI test in `src/test/ui/error-codes/`. +//! 3. We check that the error code has a UI test in `tests/ui/error-codes/`. //! - We ensure that there is both a `Exxxx.rs` file and a corresponding `Exxxx.stderr` file. //! - We also ensure that the error code is used in the tests. //! - *Currently*, it is possible to opt-out of this check with the `EXEMPTED_FROM_TEST` constant. @@ -24,7 +24,7 @@ use crate::walk::{filter_dirs, walk, walk_many}; const ERROR_CODES_PATH: &str = "compiler/rustc_error_codes/src/error_codes.rs"; const ERROR_DOCS_PATH: &str = "compiler/rustc_error_codes/src/error_codes/"; -const ERROR_TESTS_PATH: &str = "src/test/ui/error-codes/"; +const ERROR_TESTS_PATH: &str = "tests/ui/error-codes/"; // Error codes that (for some reason) can't have a doctest in their explanation. Error codes are still expected to provide a code example, even if untested. const IGNORE_DOCTEST_CHECK: &[&str] = @@ -270,14 +270,14 @@ fn check_error_codes_tests( if !test_path.exists() && !IGNORE_UI_TEST_CHECK.contains(&code.as_str()) { verbose_print!( verbose, - "warning: Error code `{code}` needs to have at least one UI test in the `src/test/ui/error-codes/` directory`!" + "warning: Error code `{code}` needs to have at least one UI test in the `tests/error-codes/` directory`!" ); continue; } if IGNORE_UI_TEST_CHECK.contains(&code.as_str()) { if test_path.exists() { errors.push(format!( - "Error code `{code}` has a UI test in `src/test/ui/error-codes/{code}.rs`, it shouldn't be listed in `EXEMPTED_FROM_TEST`!" + "Error code `{code}` has a UI test in `tests/ui/error-codes/{code}.rs`, it shouldn't be listed in `EXEMPTED_FROM_TEST`!" )); } continue; diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index f10ecf5f201..af92e6eb863 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -82,6 +82,7 @@ pub fn collect_lib_features(base_src_path: &Path) -> Features { pub fn check( src_path: &Path, + tests_path: &Path, compiler_path: &Path, lib_path: &Path, bad: &mut bool, @@ -95,10 +96,10 @@ pub fn check( walk_many( &[ - &src_path.join("test/ui"), - &src_path.join("test/ui-fulldeps"), - &src_path.join("test/rustdoc-ui"), - &src_path.join("test/rustdoc"), + &tests_path.join("ui"), + &tests_path.join("ui-fulldeps"), + &tests_path.join("rustdoc-ui"), + &tests_path.join("rustdoc"), ], &mut filter_dirs, &mut |entry, contents| { @@ -480,7 +481,7 @@ fn map_lib_features( ) { walk( base_src_path, - &mut |path| filter_dirs(path) || path.ends_with("src/test"), + &mut |path| filter_dirs(path) || path.ends_with("tests"), &mut |entry, contents| { let file = entry.path(); let filename = file.file_name().unwrap().to_string_lossy(); diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index a5685ba7c94..2a4853b37be 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -25,6 +25,7 @@ fn main() { .expect("concurrency must be a number"); let src_path = root_path.join("src"); + let tests_path = root_path.join("tests"); let library_path = root_path.join("library"); let compiler_path = root_path.join("compiler"); let librustdoc_path = src_path.join("librustdoc"); @@ -68,16 +69,16 @@ fn main() { } } - check!(target_specific_tests, &src_path); + check!(target_specific_tests, &tests_path); // Checks that are done on the cargo workspace. check!(deps, &root_path, &cargo); check!(extdeps, &root_path); // Checks over tests. - check!(debug_artifacts, &src_path); - check!(ui_tests, &src_path); - check!(mir_opt_tests, &src_path, bless); + check!(debug_artifacts, &tests_path); + check!(ui_tests, &tests_path); + check!(mir_opt_tests, &tests_path, bless); // Checks that only make sense for the compiler. check!(error_codes, &root_path, &[&compiler_path, &librustdoc_path], verbose); @@ -88,6 +89,7 @@ fn main() { // Checks that need to be done for both the compiler and std libraries. check!(unit_tests, &src_path); + check!(unit_tests, &tests_path); check!(unit_tests, &compiler_path); check!(unit_tests, &library_path); @@ -96,14 +98,17 @@ fn main() { } check!(style, &src_path); + check!(style, &tests_path); check!(style, &compiler_path); check!(style, &library_path); check!(edition, &src_path); check!(edition, &compiler_path); check!(edition, &library_path); + check!(edition, &tests_path); check!(alphabetical, &src_path); + check!(alphabetical, &tests_path); check!(alphabetical, &compiler_path); check!(alphabetical, &library_path); @@ -113,7 +118,14 @@ fn main() { drain_handles(&mut handles); let mut flag = false; - let r = features::check(&src_path, &compiler_path, &library_path, &mut flag, verbose); + let r = features::check( + &src_path, + &tests_path, + &compiler_path, + &library_path, + &mut flag, + verbose, + ); if flag { bad.store(true, Ordering::Relaxed); } diff --git a/src/tools/tidy/src/mir_opt_tests.rs b/src/tools/tidy/src/mir_opt_tests.rs index 018573284ea..2a9dcac2e8d 100644 --- a/src/tools/tidy/src/mir_opt_tests.rs +++ b/src/tools/tidy/src/mir_opt_tests.rs @@ -6,7 +6,7 @@ use std::path::{Path, PathBuf}; fn check_unused_files(path: &Path, bless: bool, bad: &mut bool) { let mut rs_files = Vec::<PathBuf>::new(); let mut output_files = HashSet::<PathBuf>::new(); - let files = walkdir::WalkDir::new(&path.join("test/mir-opt")).into_iter(); + let files = walkdir::WalkDir::new(&path.join("mir-opt")).into_iter(); for file in files.filter_map(Result::ok).filter(|e| e.file_type().is_file()) { let filepath = file.path(); @@ -41,7 +41,7 @@ fn check_unused_files(path: &Path, bless: bool, bad: &mut bool) { } fn check_dash_files(path: &Path, bless: bool, bad: &mut bool) { - for file in walkdir::WalkDir::new(&path.join("test/mir-opt")) + for file in walkdir::WalkDir::new(&path.join("mir-opt")) .into_iter() .filter_map(Result::ok) .filter(|e| e.file_type().is_file()) diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index b293efdc585..5c4ba869364 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -246,7 +246,7 @@ pub fn check(path: &Path, bad: &mut bool) { // This list should ideally be sourced from rustfmt.toml but we don't want to add a toml // parser to tidy. !file.ancestors().any(|a| { - a.ends_with("src/test") || + (a.ends_with("tests") && a.join("COMPILER_TESTS.md").exists()) || a.ends_with("src/doc/book") }); @@ -324,9 +324,10 @@ pub fn check(path: &Path, bad: &mut bool) { if trimmed.contains("dbg!") && !trimmed.starts_with("//") - && !file - .ancestors() - .any(|a| a.ends_with("src/test") || a.ends_with("library/alloc/tests")) + && !file.ancestors().any(|a| { + (a.ends_with("tests") && a.join("COMPILER_TESTS.md").exists()) + || a.ends_with("library/alloc/tests") + }) && filename != "tests.rs" { suppressible_tidy_err!( diff --git a/src/tools/tidy/src/target_specific_tests.rs b/src/tools/tidy/src/target_specific_tests.rs index 8ba25705666..d7a157672cf 100644 --- a/src/tools/tidy/src/target_specific_tests.rs +++ b/src/tools/tidy/src/target_specific_tests.rs @@ -35,9 +35,8 @@ struct RevisionInfo<'a> { } pub fn check(path: &Path, bad: &mut bool) { - let tests = path.join("test"); crate::walk::walk( - &tests, + path, &mut |path| path.extension().map(|p| p == "rs") == Some(false), &mut |entry, content| { let file = entry.path().display(); diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 166d09fa8b0..806e84025c4 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -13,13 +13,13 @@ const ROOT_ENTRY_LIMIT: usize = 939; const ISSUES_ENTRY_LIMIT: usize = 1998; fn check_entries(path: &Path, bad: &mut bool) { - for dir in Walk::new(&path.join("test/ui")) { + for dir in Walk::new(&path.join("ui")) { if let Ok(entry) = dir { if entry.file_type().map(|ft| ft.is_dir()).unwrap_or(false) { let dir_path = entry.path(); // Use special values for these dirs. - let is_root = path.join("test/ui") == dir_path; - let is_issues_dir = path.join("test/ui/issues") == dir_path; + let is_root = path.join("ui") == dir_path; + let is_issues_dir = path.join("ui/issues") == dir_path; let limit = if is_root { ROOT_ENTRY_LIMIT } else if is_issues_dir { @@ -53,7 +53,7 @@ fn check_entries(path: &Path, bad: &mut bool) { pub fn check(path: &Path, bad: &mut bool) { check_entries(&path, bad); - for path in &[&path.join("test/ui"), &path.join("test/ui-fulldeps")] { + for path in &[&path.join("ui"), &path.join("ui-fulldeps")] { crate::walk::walk_no_read(path, &mut |_| false, &mut |entry| { let file_path = entry.path(); if let Some(ext) = file_path.extension() { diff --git a/src/tools/tidy/src/unit_tests.rs b/src/tools/tidy/src/unit_tests.rs index 2c23b6ebc75..27f36c85561 100644 --- a/src/tools/tidy/src/unit_tests.rs +++ b/src/tools/tidy/src/unit_tests.rs @@ -22,7 +22,7 @@ pub fn check(root_path: &Path, bad: &mut bool) { let file_name = path.file_name().unwrap_or_default(); if path.is_dir() { filter_dirs(path) - || path.ends_with("src/test") + || path.ends_with("tests") || path.ends_with("src/doc") || (file_name == "tests" || file_name == "benches") && !is_core(path) } else { |
