From 0962afaa8f1f0a84a298e10b68457fdfca3dfad5 Mon Sep 17 00:00:00 2001 From: binarycat Date: Sat, 11 Jan 2025 17:50:29 -0600 Subject: [PATCH 1/4] clean up code related to the rustdoc-js test suite --- src/bootstrap/src/core/build_steps/test.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 914260e38d1d9..3688065b20bf7 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -30,6 +30,7 @@ use crate::utils::render_tests::{add_flags_and_try_run_tests, try_run_tests}; use crate::{CLang, DocTests, GitRepo, Mode, PathSet, envify}; const ADB_TEST_DIR: &str = "/data/local/tmp/work"; +const RUSTDOC_JS: &str = "rustdoc-js"; /// Runs `cargo test` on various internal tools used by bootstrap. #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -914,8 +915,8 @@ impl Step for RustdocJSNotStd { builder.ensure(Compiletest { compiler: self.compiler, target: self.target, - mode: "js-doc-test", - suite: "rustdoc-js", + mode: RUSTDOC_JS, + suite: RUSTDOC_JS, path: "tests/rustdoc-js", compare_mode: None, }); @@ -1726,7 +1727,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the cmd.arg("--minicore-path") .arg(builder.src.join("tests").join("auxiliary").join("minicore.rs")); - let is_rustdoc = suite.ends_with("rustdoc-ui") || suite.ends_with("rustdoc-js"); + let is_rustdoc = suite == "rustdoc-ui" || suite == RUSTDOC_JS; if mode == "run-make" { let cargo_path = if builder.top_stage == 0 { @@ -1754,7 +1755,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the if mode == "rustdoc" || mode == "run-make" || (mode == "ui" && is_rustdoc) - || mode == "js-doc-test" + || mode == RUSTDOC_JS || mode == "rustdoc-json" || suite == "coverage-run-rustdoc" { @@ -1826,8 +1827,8 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the if let Some(ref nodejs) = builder.config.nodejs { cmd.arg("--nodejs").arg(nodejs); - } else if mode == "js-doc-test" { - panic!("need nodejs to run js-doc-test suite"); + } else if mode == RUSTDOC_JS { + panic!("need nodejs to run rustdoc-js suite"); } if let Some(ref npm) = builder.config.npm { cmd.arg("--npm").arg(npm); From a55bc72ceaec47e6a6f8e9f01ede83bdfecbb629 Mon Sep 17 00:00:00 2001 From: binarycat Date: Sat, 11 Jan 2025 19:27:26 -0600 Subject: [PATCH 2/4] don't use a string constant --- src/bootstrap/src/core/build_steps/test.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 3688065b20bf7..c8bea67238062 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -30,7 +30,6 @@ use crate::utils::render_tests::{add_flags_and_try_run_tests, try_run_tests}; use crate::{CLang, DocTests, GitRepo, Mode, PathSet, envify}; const ADB_TEST_DIR: &str = "/data/local/tmp/work"; -const RUSTDOC_JS: &str = "rustdoc-js"; /// Runs `cargo test` on various internal tools used by bootstrap. #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -915,8 +914,8 @@ impl Step for RustdocJSNotStd { builder.ensure(Compiletest { compiler: self.compiler, target: self.target, - mode: RUSTDOC_JS, - suite: RUSTDOC_JS, + mode: "rustdoc-js", + suite: "rustdoc-js", path: "tests/rustdoc-js", compare_mode: None, }); @@ -1727,7 +1726,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the cmd.arg("--minicore-path") .arg(builder.src.join("tests").join("auxiliary").join("minicore.rs")); - let is_rustdoc = suite == "rustdoc-ui" || suite == RUSTDOC_JS; + let is_rustdoc = suite == "rustdoc-ui" || suite == "rustdoc-js"; if mode == "run-make" { let cargo_path = if builder.top_stage == 0 { @@ -1755,7 +1754,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the if mode == "rustdoc" || mode == "run-make" || (mode == "ui" && is_rustdoc) - || mode == RUSTDOC_JS + || mode == "rustdoc-js" || mode == "rustdoc-json" || suite == "coverage-run-rustdoc" { @@ -1827,7 +1826,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the if let Some(ref nodejs) = builder.config.nodejs { cmd.arg("--nodejs").arg(nodejs); - } else if mode == RUSTDOC_JS { + } else if mode == "rustdoc-js" { panic!("need nodejs to run rustdoc-js suite"); } if let Some(ref npm) = builder.config.npm { From 16286cefcf020a98929733235f9d68f5505eb381 Mon Sep 17 00:00:00 2001 From: binarycat Date: Sat, 11 Jan 2025 20:37:20 -0600 Subject: [PATCH 3/4] rename 'js-doc-test' to 'rustdoc-js' in compiletest --- src/tools/compiletest/src/common.rs | 2 +- src/tools/compiletest/src/header/tests.rs | 2 +- src/tools/compiletest/src/lib.rs | 2 +- src/tools/compiletest/src/runtest.rs | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 36f876bcdc604..9539f7474c732 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -63,7 +63,7 @@ string_enum! { Incremental => "incremental", RunMake => "run-make", Ui => "ui", - JsDocTest => "js-doc-test", + RustdocJs => "rustdoc-js", MirOpt => "mir-opt", Assembly => "assembly", CoverageMap => "coverage-map", diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/header/tests.rs index 25bb1a5f42882..ebba16d41f9e8 100644 --- a/src/tools/compiletest/src/header/tests.rs +++ b/src/tools/compiletest/src/header/tests.rs @@ -591,7 +591,7 @@ fn test_forbidden_revisions_allowed_in_non_filecheck_dir() { "codegen-units", "incremental", "ui", - "js-doc-test", + "rustdoc-js", "coverage-map", "coverage-run", "crashes", diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index 74d1f5637a8f8..27a046ba5bc4a 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -71,7 +71,7 @@ pub fn parse_config(args: Vec) -> Config { "which sort of compile tests to run", "pretty | debug-info | codegen | rustdoc \ | rustdoc-json | codegen-units | incremental | run-make | ui \ - | js-doc-test | mir-opt | assembly | crashes", + | rustdoc-js | mir-opt | assembly | crashes", ) .reqopt( "", diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 9e8443cd13c5a..a8a1b7e6894eb 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -17,7 +17,7 @@ use tracing::*; use crate::common::{ Assembly, Codegen, CodegenUnits, CompareMode, Config, CoverageMap, CoverageRun, Crashes, - DebugInfo, Debugger, FailMode, Incremental, JsDocTest, MirOpt, PassMode, Pretty, RunMake, + DebugInfo, Debugger, FailMode, Incremental, RustdocJs, MirOpt, PassMode, Pretty, RunMake, Rustdoc, RustdocJson, TestPaths, UI_EXTENSIONS, UI_FIXED, UI_RUN_STDERR, UI_RUN_STDOUT, UI_STDERR, UI_STDOUT, UI_SVG, UI_WINDOWS_SVG, Ui, expected_output_path, incremental_dir, output_base_dir, output_base_name, output_testname_unique, @@ -269,7 +269,7 @@ impl<'test> TestCx<'test> { Ui => self.run_ui_test(), MirOpt => self.run_mir_opt_test(), Assembly => self.run_assembly_test(), - JsDocTest => self.run_js_doc_test(), + RustdocJs => self.run_js_doc_test(), CoverageMap => self.run_coverage_map_test(), // see self::coverage CoverageRun => self.run_coverage_run_test(), // see self::coverage Crashes => self.run_crash_test(), @@ -303,7 +303,7 @@ impl<'test> TestCx<'test> { fn should_compile_successfully(&self, pm: Option) -> bool { match self.config.mode { - JsDocTest => true, + RustdocJs => true, Ui => pm.is_some() || self.props.fail_mode > Some(FailMode::Build), Crashes => false, Incremental => { @@ -1627,7 +1627,7 @@ impl<'test> TestCx<'test> { Crashes => { set_mir_dump_dir(&mut rustc); } - Pretty | DebugInfo | Rustdoc | RustdocJson | RunMake | CodegenUnits | JsDocTest => { + Pretty | DebugInfo | Rustdoc | RustdocJson | RunMake | CodegenUnits | RustdocJs => { // do not use JSON output } } From d5f592ad588ab21a8314197e0d2a090ae2eef170 Mon Sep 17 00:00:00 2001 From: binarycat Date: Sat, 11 Jan 2025 20:46:57 -0600 Subject: [PATCH 4/4] rename run_js_doc_test to run_rustdoc_js_test --- src/tools/compiletest/src/runtest.rs | 6 +++--- src/tools/compiletest/src/runtest/js_doc.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index a8a1b7e6894eb..b6a19147eb7f3 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -17,8 +17,8 @@ use tracing::*; use crate::common::{ Assembly, Codegen, CodegenUnits, CompareMode, Config, CoverageMap, CoverageRun, Crashes, - DebugInfo, Debugger, FailMode, Incremental, RustdocJs, MirOpt, PassMode, Pretty, RunMake, - Rustdoc, RustdocJson, TestPaths, UI_EXTENSIONS, UI_FIXED, UI_RUN_STDERR, UI_RUN_STDOUT, + DebugInfo, Debugger, FailMode, Incremental, MirOpt, PassMode, Pretty, RunMake, Rustdoc, + RustdocJs, RustdocJson, TestPaths, UI_EXTENSIONS, UI_FIXED, UI_RUN_STDERR, UI_RUN_STDOUT, UI_STDERR, UI_STDOUT, UI_SVG, UI_WINDOWS_SVG, Ui, expected_output_path, incremental_dir, output_base_dir, output_base_name, output_testname_unique, }; @@ -269,7 +269,7 @@ impl<'test> TestCx<'test> { Ui => self.run_ui_test(), MirOpt => self.run_mir_opt_test(), Assembly => self.run_assembly_test(), - RustdocJs => self.run_js_doc_test(), + RustdocJs => self.run_rustdoc_js_test(), CoverageMap => self.run_coverage_map_test(), // see self::coverage CoverageRun => self.run_coverage_run_test(), // see self::coverage Crashes => self.run_crash_test(), diff --git a/src/tools/compiletest/src/runtest/js_doc.rs b/src/tools/compiletest/src/runtest/js_doc.rs index 68c74cd155c0e..a83bcd70c8718 100644 --- a/src/tools/compiletest/src/runtest/js_doc.rs +++ b/src/tools/compiletest/src/runtest/js_doc.rs @@ -3,7 +3,7 @@ use std::process::Command; use super::TestCx; impl TestCx<'_> { - pub(super) fn run_js_doc_test(&self) { + pub(super) fn run_rustdoc_js_test(&self) { if let Some(nodejs) = &self.config.nodejs { let out_dir = self.output_base_dir();