compiletest: Make all other modules non-public
All APIs used from outside the compiletest library crate have been isolated to the `cli` and `rustdoc_gui_test` modules, so no other items need to be publicly exported.
This commit is contained in:
parent
b4f64fda4f
commit
ce4699deff
6 changed files with 17 additions and 31 deletions
|
|
@ -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);
|
||||
}
|
||||
if builder.config.rust_optimize_tests {
|
||||
cmd.arg("--optimize-tests");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -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")
|
||||
|
|
@ -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"),
|
||||
|
||||
|
|
@ -488,14 +487,7 @@ 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,
|
||||
|
|
@ -503,7 +495,7 @@ pub fn opt_str2(maybestr: Option<String>) -> String {
|
|||
}
|
||||
|
||||
/// 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();
|
||||
|
|
@ -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 =
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue