Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1974,9 +1974,6 @@ HELP: You can add it into `bootstrap.toml` in `rust.codegen-backends = [{name:?}
} 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);
}
Comment on lines -1977 to -1979
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remark: oh nice, I didn't realize this was rustdoc-gui-test-only.

if builder.config.rust_optimize_tests {
cmd.arg("--optimize-tests");
}
Expand Down
5 changes: 2 additions & 3 deletions src/tools/compiletest/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,6 @@ pub struct Config {

/// Path to a NodeJS executable. Used for JS doctests, emscripten and WASM tests.
pub nodejs: Option<String>,
/// Path to a npm executable. Used for rustdoc GUI tests.
pub npm: Option<String>,

/// Whether to rerun tests even if the inputs are unchanged.
pub force_rerun: bool,
Expand Down Expand Up @@ -721,7 +719,8 @@ impl Config {
self.target_cfg().abi == abi
}

pub fn matches_family(&self, family: &str) -> bool {
#[cfg_attr(not(test), expect(dead_code, reason = "only used by tests for `ignore-{family}`"))]
pub(crate) fn matches_family(&self, family: &str) -> bool {
self.target_cfg().families.iter().any(|f| f == family)
}

Expand Down
3 changes: 0 additions & 3 deletions src/tools/compiletest/src/directives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ pub struct TestProps {
pub filecheck_flags: Vec<String>,
/// Don't automatically insert any `--check-cfg` args
pub no_auto_check_cfg: bool,
/// Run tests which require enzyme being build
pub has_enzyme: bool,
/// Build and use `minicore` as `core` stub for `no_core` tests in cross-compilation scenarios
/// that don't otherwise want/need `-Z build-std`.
pub add_core_stubs: bool,
Expand Down Expand Up @@ -314,7 +312,6 @@ impl TestProps {
llvm_cov_flags: vec![],
filecheck_flags: vec![],
no_auto_check_cfg: false,
has_enzyme: false,
add_core_stubs: false,
core_stubs_compile_flags: vec![],
dont_require_annotations: Default::default(),
Expand Down
34 changes: 13 additions & 21 deletions src/tools/compiletest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
mod tests;

pub mod cli;
pub mod common;
mod common;
mod debuggers;
pub mod diagnostics;
pub mod directives;
pub mod edition;
pub mod errors;
mod diagnostics;
mod directives;
mod edition;
mod errors;
mod executor;
mod json;
mod output_capture;
mod panic_hook;
mod raise_fd_limit;
mod read2;
pub mod runtest;
mod runtest;
pub mod rustdoc_gui_test;
pub mod util;
mod util;

use core::panic;
use std::collections::HashSet;
Expand Down Expand Up @@ -50,7 +50,7 @@ use crate::executor::{CollectedTest, ColorConfig};
/// The config mostly reflects command-line arguments, but there might also be
/// some code here that inspects environment variables or even runs executables
/// (e.g. when discovering debugger versions).
pub fn parse_config(args: Vec<String>) -> Config {
fn parse_config(args: Vec<String>) -> Config {
let mut opts = Options::new();
opts.reqopt("", "compile-lib-path", "path to host shared libraries", "PATH")
.reqopt("", "run-lib-path", "path to target shared libraries", "PATH")
Expand Down Expand Up @@ -464,7 +464,6 @@ pub fn parse_config(args: Vec<String>) -> Config {
host_linker: matches.opt_str("host-linker"),
llvm_components: matches.opt_str("llvm-components").unwrap(),
nodejs: matches.opt_str("nodejs"),
npm: matches.opt_str("npm"),

force_rerun: matches.opt_present("force-rerun"),

Expand All @@ -488,22 +487,15 @@ pub fn parse_config(args: Vec<String>) -> Config {
}
}

pub fn opt_str(maybestr: &Option<String>) -> &str {
match *maybestr {
None => "(none)",
Some(ref s) => s,
}
}

pub fn opt_str2(maybestr: Option<String>) -> String {
fn opt_str2(maybestr: Option<String>) -> String {
match maybestr {
None => "(none)".to_owned(),
Some(s) => s,
}
}

/// Called by `main` after the config has been parsed.
pub fn run_tests(config: Arc<Config>) {
fn run_tests(config: Arc<Config>) {
debug!(?config, "run_tests");

panic_hook::install_panic_hook();
Expand Down Expand Up @@ -641,7 +633,7 @@ impl TestCollector {
/// FIXME(Zalathar): Now that we no longer rely on libtest, try to overhaul
/// test discovery to take into account the filters/tests specified on the
/// command-line, instead of having to enumerate everything.
pub(crate) fn collect_and_make_tests(config: Arc<Config>) -> Vec<CollectedTest> {
fn collect_and_make_tests(config: Arc<Config>) -> Vec<CollectedTest> {
debug!("making tests from {}", config.src_test_suite_root);
let common_inputs_stamp = common_inputs_stamp(&config);
let modified_tests =
Expand Down Expand Up @@ -853,7 +845,7 @@ fn collect_tests_from_dir(
}

/// Returns true if `file_name` looks like a proper test file name.
pub fn is_test(file_name: &str) -> bool {
fn is_test(file_name: &str) -> bool {
if !file_name.ends_with(".rs") {
return false;
}
Expand Down Expand Up @@ -1133,7 +1125,7 @@ fn check_for_overlapping_test_paths(found_path_stems: &HashSet<Utf8PathBuf>) {
}
}

pub fn early_config_check(config: &Config) {
fn early_config_check(config: &Config) {
if !config.has_html_tidy && config.mode == TestMode::Rustdoc {
warning!("`tidy` (html-tidy.org) is not installed; diffs will not be generated");
}
Expand Down
1 change: 0 additions & 1 deletion src/tools/compiletest/src/rustdoc_gui_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ fn incomplete_config_for_rustdoc_gui_test() -> Config {
host_linker: Default::default(),
llvm_components: Default::default(),
nodejs: Default::default(),
npm: Default::default(),
force_rerun: Default::default(),
only_modified: Default::default(),
target_cfgs: Default::default(),
Expand Down
2 changes: 2 additions & 0 deletions src/tools/compiletest/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ macro_rules! string_enum {
}

impl $name {
#[allow(dead_code)]
$vis const VARIANTS: &'static [Self] = &[$(Self::$variant,)*];
#[allow(dead_code)]
$vis const STR_VARIANTS: &'static [&'static str] = &[$(Self::$variant.to_str(),)*];

$vis const fn to_str(&self) -> &'static str {
Expand Down
Loading