pub struct Config {Show 84 fields
pub bless: bool,
pub fail_fast: bool,
pub compile_lib_path: Utf8PathBuf,
pub run_lib_path: Utf8PathBuf,
pub rustc_path: Utf8PathBuf,
pub cargo_path: Option<Utf8PathBuf>,
pub stage0_rustc_path: Option<Utf8PathBuf>,
pub rustdoc_path: Option<Utf8PathBuf>,
pub coverage_dump_path: Option<Utf8PathBuf>,
pub python: String,
pub jsondocck_path: Option<String>,
pub jsondoclint_path: Option<String>,
pub llvm_filecheck: Option<Utf8PathBuf>,
pub llvm_bin_dir: Option<Utf8PathBuf>,
pub run_clang_based_tests_with: Option<String>,
pub src_root: Utf8PathBuf,
pub src_test_suite_root: Utf8PathBuf,
pub build_root: Utf8PathBuf,
pub build_test_suite_root: Utf8PathBuf,
pub sysroot_base: Utf8PathBuf,
pub stage: u32,
pub stage_id: String,
pub mode: Mode,
pub suite: String,
pub debugger: Option<Debugger>,
pub run_ignored: bool,
pub with_rustc_debug_assertions: bool,
pub with_std_debug_assertions: bool,
pub filters: Vec<String>,
pub skip: Vec<String>,
pub filter_exact: bool,
pub force_pass_mode: Option<PassMode>,
pub run: Option<bool>,
pub runner: Option<String>,
pub host_rustcflags: Vec<String>,
pub target_rustcflags: Vec<String>,
pub rust_randomized_layout: bool,
pub optimize_tests: bool,
pub target: String,
pub host: String,
pub cdb: Option<Utf8PathBuf>,
pub cdb_version: Option<[u16; 4]>,
pub gdb: Option<String>,
pub gdb_version: Option<u32>,
pub lldb_version: Option<u32>,
pub llvm_version: Option<Version>,
pub system_llvm: bool,
pub android_cross_path: Utf8PathBuf,
pub adb_path: String,
pub adb_test_dir: String,
pub adb_device_status: bool,
pub lldb_python_dir: Option<String>,
pub verbose: bool,
pub format: OutputFormat,
pub color: ColorConfig,
pub remote_test_client: Option<Utf8PathBuf>,
pub compare_mode: Option<CompareMode>,
pub rustfix_coverage: bool,
pub has_html_tidy: bool,
pub has_enzyme: bool,
pub channel: String,
pub git_hash: bool,
pub edition: Option<String>,
pub cc: String,
pub cxx: String,
pub cflags: String,
pub cxxflags: String,
pub ar: String,
pub target_linker: Option<String>,
pub host_linker: Option<String>,
pub llvm_components: String,
pub nodejs: Option<String>,
pub npm: Option<String>,
pub force_rerun: bool,
pub only_modified: bool,
pub target_cfgs: OnceLock<TargetCfgs>,
pub builtin_cfg_names: OnceLock<HashSet<String>>,
pub supported_crate_types: OnceLock<HashSet<String>>,
pub nocapture: bool,
pub nightly_branch: String,
pub git_merge_commit_email: String,
pub profiler_runtime: bool,
pub diff_command: Option<String>,
pub minicore_path: Utf8PathBuf,
}
Expand description
Configuration for compiletest
per invocation.
In terms of bootstrap
, this means that ./x test tests/ui tests/run-make
actually correspond
to two separate invocations of compiletest
.
FIXME: this Config
struct should be broken up into smaller logically contained sub-config
structs, it’s too much of a “soup” of everything at the moment.
§Configuration sources
Configuration values for compiletest
comes from several sources:
- CLI args passed from
bootstrap
while running thecompiletest
binary. - Env vars.
- Discovery (e.g. trying to identify a suitable debugger based on filesystem discovery).
- Cached output of running the
rustc
under test (e.g. output ofrustc
print requests).
FIXME: make sure we clearly account for sources of all config options.
FIXME: audit these options to make sure we are not hashing less than necessary for build stamp (for changed test detection).
Fields§
§bless: bool
Some test Mode
s support snapshot testing, where a reference snapshot of outputs (of
stdout
, stderr
, or other form of artifacts) can be compared to the actual output.
This option can be set to true
to update the reference snapshots in-place, otherwise
compiletest
will only try to compare.
fail_fast: bool
Attempt to stop as soon as possible after any test fails. We may still run a few more tests before stopping when multiple test threads are used.
compile_lib_path: Utf8PathBuf
Path to libraries needed to run the staged rustc
-under-test on the host platform.
FIXME: maybe rename this to reflect (1) which target platform (host, not target), and (2)
which rustc
(the rustc
-under-test, not the stage 0 rustc
unless forced).
run_lib_path: Utf8PathBuf
Path to libraries needed to run the compiled executable for the target platform. This corresponds to the target sysroot libraries, including the target standard library.
FIXME: maybe rename this to reflect (1) which target platform (target, not host), and (2) what “run libraries” are against.
FIXME: this is very under-documented in conjunction with the remote-test-client
scheme and
RUNNER
scheme to actually run the target executable under the target platform environment,
cf. Self::remote_test_client
and Self::runner
.
rustc_path: Utf8PathBuf
Path to the staged rustc
-under-test. Unless forced, this rustc
is staged, and must
not be confused with Self::stage0_rustc_path
.
FIXME: maybe rename this to reflect that this is the rustc
-under-test.
cargo_path: Option<Utf8PathBuf>
Path to a staged host platform cargo executable (unless stage 0 is forced). This
staged cargo
is only used within run-make
test recipes during recipe run time (and is
not used to compile the test recipes), and so must be staged as there may be differences
between e.g. beta cargo
vs in-tree cargo
.
FIXME: maybe rename this to reflect that this is a staged host cargo.
FIXME(#134109): split run-make
into two test suites, a test suite with staged cargo, and
another test suite without.
stage0_rustc_path: Option<Utf8PathBuf>
Path to the stage 0 rustc
used to build run-make
recipes. This must not be confused with
Self::rustc_path
.
rustdoc_path: Option<Utf8PathBuf>
Path to the rustdoc
-under-test. Like Self::rustc_path
, this rustdoc
is staged.
coverage_dump_path: Option<Utf8PathBuf>
Path to the src/tools/coverage-dump/
bootstrap tool executable.
python: String
Path to the Python 3 executable to use for LLDB and htmldocck.
FIXME: the lldb
setup currently requires I believe Python 3.10 exactly, it can’t even
be Python 3.11 or 3.9…
jsondocck_path: Option<String>
Path to the src/tools/jsondocck/
bootstrap tool executable.
jsondoclint_path: Option<String>
Path to the src/tools/jsondoclint/
bootstrap tool executable.
llvm_filecheck: Option<Utf8PathBuf>
Path to a host LLVM FileCheck
executable.
llvm_bin_dir: Option<Utf8PathBuf>
Path to a host LLVM bintools directory.
run_clang_based_tests_with: Option<String>
The path to the target clang
executable to run clang
-based tests with. If None
,
then these tests will be ignored.
src_root: Utf8PathBuf
Path to the directory containing the sources. This corresponds to the root folder of a
rust-lang/rust
checkout.
FIXME: this name is confusing, because this is actually $checkout_root
, not the
$checkout_root/src/
folder.
src_test_suite_root: Utf8PathBuf
Path to the directory containing the test suites sources. This corresponds to the
$src_root/tests/
folder.
Must be an immediate subdirectory of Self::src_root
.
FIXME: this name is also confusing, maybe just call it tests_root
.
build_root: Utf8PathBuf
Path to the build directory (e.g. build/
).
build_test_suite_root: Utf8PathBuf
Path to the test suite specific build directory (e.g. build/host/test/ui/
).
Must be a subdirectory of Self::build_root
.
sysroot_base: Utf8PathBuf
Path to the directory containing the sysroot of the rustc
-under-test.
When stage 0 is forced, this will correspond to the sysroot of that specified stage 0
rustc
.
FIXME: this name is confusing, because it doesn’t specify which compiler this sysroot
corresponds to. It’s actually the rustc
-under-test, and not the bootstrap rustc
, unless
stage 0 is forced and no custom stage 0 rustc
was otherwise specified (so that it
happens to run against the bootstrap rustc
, but this non-custom bootstrap rustc
case
is not really supported).
stage: u32
The number of the stage under test.
stage_id: String
The id of the stage under test (stage1-xxx, etc).
FIXME: reconsider this string; this is hashed for test build stamp.
mode: Mode
The test Mode
. E.g. Mode::Ui
. Each test mode can correspond to one or more test
suites.
FIXME: stop using stringly-typed test suites!
suite: String
The test suite.
Example: tests/ui/
is the “UI” test suite, which happens to also be of the Mode::Ui
test mode.
Note that the same test directory (e.g. tests/coverage/
) may correspond to multiple test
modes, e.g. tests/coverage/
can be run under both Mode::CoverageRun
and
Mode::CoverageMap
.
FIXME: stop using stringly-typed test suites!
debugger: Option<Debugger>
When specified, only the specified Debugger
will be used to run against the
tests/debuginfo
test suite. When unspecified, compiletest
will attempt to find all three
of {lldb
, cdb
, gdb
} implicitly, and then try to run the debuginfo
test suite against
all three debuggers.
FIXME: this implicit behavior is really nasty, in that it makes it hard for the user to
control which debugger(s) are available and used to run the debuginfo test suite. We
should have bootstrap
allow the user to explicitly configure the debuggers, and not
try to implicitly discover some random debugger from the user environment. This makes the
debuginfo test suite particularly hard to work with.
run_ignored: bool
Run ignored tests unconditionally, overriding their ignore reason.
FIXME: this is wired up through the test execution logic, but not accessible from
bootstrap
directly; compiletest
exposes this as --ignored
. I.e. you’d have to use ./x test $test_suite -- --ignored=true
.
with_rustc_debug_assertions: bool
Whether staged rustc
-under-test was built with debug assertions.
FIXME: make it clearer that this refers to the staged rustc
-under-test, not stage 0
rustc
.
with_std_debug_assertions: bool
Whether staged std
was built with debug assertions.
FIXME: make it clearer that this refers to the staged std
, not stage 0 std
.
filters: Vec<String>
Only run tests that match these filters (using libtest
“test name contains” filter logic).
FIXME(#139660): the current hand-rolled test executor intentionally mimics the libtest
“test name contains” filter matching logic to preserve previous libtest
executor behavior,
but this is often not intuitive. We should consider changing that behavior with an MCP to do
test path prefix matching which better corresponds to how compiletest
tests/
are
organized, and how users would intuitively expect the filtering logic to work like.
skip: Vec<String>
Skip tests matching these substrings. The matching logic exactly corresponds to
Self::filters
but inverted.
FIXME(#139660): ditto on test matching behavior.
filter_exact: bool
Exactly match the filter, rather than a substring.
FIXME(#139660): ditto on test matching behavior.
force_pass_mode: Option<PassMode>
Force the pass mode of a check/build/run test to instead use this mode instead.
FIXME: make it even more obvious (especially in PR CI where --pass=check
is used) when a
pass mode is forced when the test fails, because it can be very non-obvious when e.g. an
error is emitted only when //@ build-pass
but not //@ check-pass
.
run: Option<bool>
Explicitly enable or disable running of the target test binary.
FIXME: this scheme is a bit confusing, and at times questionable. Re-evaluate this run scheme.
FIXME: Currently --run
is a tri-state, it can be --run={auto,always,never}
, and when
--run=auto
is specified, it’s run if the platform doesn’t end with -fuchsia
. See
Config::run_enabled
.
runner: Option<String>
A command line to prefix target program execution with, for running under valgrind for
example, i.e. $runner target.exe [args..]
. Similar to CARGO_*_RUNNER
configuration.
Note: this is not to be confused with Self::remote_test_client
, which is a different
scheme.
FIXME: the runner scheme is very under-documented.
host_rustcflags: Vec<String>
Compiler flags to pass to the staged rustc
-under-test when building for the host
platform.
target_rustcflags: Vec<String>
Compiler flags to pass to the staged rustc
-under-test when building for the target
platform.
rust_randomized_layout: bool
Whether the staged rustc
-under-test and the associated staged std
has been built
with randomized struct layouts.
optimize_tests: bool
Whether tests should be optimized by default (-O
). Individual test suites and test files
may override this setting.
FIXME: this flag / config option is somewhat misleading. For instance, in ui tests, it’s
only applied to the PassMode::Run
test crate and not its auxiliaries.
target: String
Target platform tuple.
host: String
Host platform tuple.
cdb: Option<Utf8PathBuf>
Path to / name of the Microsoft Console Debugger (CDB) executable.
FIXME: this is an opt-in “override” option. When this isn’t provided, we try to conjure a
cdb by looking at the user’s program files on Windows… See debuggers::find_cdb
.
cdb_version: Option<[u16; 4]>
Version of CDB.
FIXME: cdb_version
is derived from cdb, but it’s not technically a config!
FIXME: audit cdb version gating.
gdb: Option<String>
Path to / name of the GDB executable.
FIXME: the fallback path when gdb
isn’t provided tries to find a gdb
or gdb.exe
from
PATH
, which is… arguably questionable.
FIXME: we are propagating a python from PYTHONPATH
, not from an explicit config for gdb
debugger script.
gdb_version: Option<u32>
Version of GDB, encoded as ((major * 1000) + minor) * 1000 + patch
FIXME: this gdb version gating scheme is possibly questionable – gdb does not use semver,
only its major version is likely materially meaningful, cf.
https://sourceware.org/gdb/wiki/Internals%20Versions. Even the major version I’m not sure
is super meaningful. Maybe min gdb major.minor
version gating is sufficient for the
purposes of debuginfo tests?
FIXME: gdb_version
is derived from gdb, but it’s not technically a config!
lldb_version: Option<u32>
Version of LLDB.
FIXME: lldb_version
is derived from lldb, but it’s not technically a config!
llvm_version: Option<Version>
Version of LLVM.
FIXME: Audit the fallback derivation of
crate::directives::extract_llvm_version_from_binary
, that seems very questionable?
system_llvm: bool
Is LLVM a system LLVM.
android_cross_path: Utf8PathBuf
Path to the android tools.
Note: this is only used for android gdb debugger script in the debuginfo test suite.
FIXME: take a look at this; this is piggy-backing off of gdb code paths but only for
arm-linux-androideabi
target.
adb_path: String
Extra parameter to run adb on arm-linux-androideabi
.
FIXME: is this only arm-linux-androideabi
, or is it also for other Tier 2/3 android
targets?
FIXME: take a look at this; this is piggy-backing off of gdb code paths but only for
arm-linux-androideabi
target.
adb_test_dir: String
Extra parameter to run test suite on arm-linux-androideabi
.
FIXME: is this only arm-linux-androideabi
, or is it also for other Tier 2/3 android
targets?
FIXME: take a look at this; this is piggy-backing off of gdb code paths but only for
arm-linux-androideabi
target.
adb_device_status: bool
Status whether android device available or not. When unavailable, this will cause tests to panic when the test binary is attempted to be run.
FIXME: take a look at this; this also influences adb in gdb code paths in a strange way.
lldb_python_dir: Option<String>
Path containing LLDB’s Python module.
FIXME: PYTHONPATH
takes precedence over this flag…? See runtest::run_lldb
.
verbose: bool
Verbose dump a lot of info.
FIXME: this is way too coarse; the user can’t select which info to verbosely dump.
format: OutputFormat
(Useless) Adjust libtest output format.
FIXME: the hand-rolled executor does not support non-JSON output, because compiletest
need
to package test outcome as libtest
-esque JSON that bootstrap
can intercept anyway.
However, now that we don’t use the libtest
executor, this is useless.
color: ColorConfig
Whether to use colors in test output.
Note: the exact control mechanism is delegated to [colored
].
remote_test_client: Option<Utf8PathBuf>
Where to find the remote test client process, if we’re using it.
Note: this is only used for target platform executables created by run-make
test
recipes.
Note: this is not to be confused with Self::runner
, which is a different scheme.
FIXME: the remote_test_client
scheme is very under-documented.
compare_mode: Option<CompareMode>
CompareMode
describing what file the actual ui output will be compared to.
FIXME: currently, CompareMode
is a mishmash of lot of things (different borrow-checker
model, different trait solver, different debugger, etc.).
rustfix_coverage: bool
If true, this will generate a coverage file with UI test files that run MachineApplicable
diagnostics but are missing run-rustfix
annotations. The generated coverage file is
created in $test_suite_build_root/rustfix_missing_coverage.txt
has_html_tidy: bool
Whether to run tidy
(html-tidy) when a rustdoc test fails.
has_enzyme: bool
Whether to run enzyme
autodiff tests.
channel: String
The current Rust channel info.
FIXME: treat this more carefully; “stable”, “beta” and “nightly” are definitely valid, but channel might also be “dev” or such, which should be treated as “nightly”.
git_hash: bool
Whether adding git commit information such as the commit hash has been enabled for building.
FIXME: compiletest
cannot trust bootstrap
for this information, because bootstrap
can
have bugs and had bugs on that logic. We need to figure out how to obtain this e.g. directly
from CI or via git locally.
edition: Option<String>
The default Rust edition.
FIXME: perform stronger validation for this. There are editions that definitely exists, but there might also be “future” edition.
cc: String
§cxx: String
§cflags: String
§cxxflags: String
§ar: String
§target_linker: Option<String>
§host_linker: Option<String>
§llvm_components: String
§nodejs: Option<String>
Path to a NodeJS executable. Used for JS doctests, emscripten and WASM tests.
npm: Option<String>
Path to a npm executable. Used for rustdoc GUI tests.
force_rerun: bool
Whether to rerun tests even if the inputs are unchanged.
only_modified: bool
Only rerun the tests that result has been modified according to git status
.
FIXME: this is undocumented.
FIXME: how does this interact with Self::force_rerun
?
target_cfgs: OnceLock<TargetCfgs>
§builtin_cfg_names: OnceLock<HashSet<String>>
§supported_crate_types: OnceLock<HashSet<String>>
§nocapture: bool
FIXME: this is why we still need to depend on staged std
, it’s because we currently rely
on #![feature(internal_output_capture)]
for std::io::set_output_capture
to implement
libtest
-esque --no-capture
.
FIXME: rename this to the more canonical no_capture
, or better, invert this to capture
to avoid !nocapture
double-negatives.
nightly_branch: String
Needed both to construct build_helper::git::GitConfig
.
git_merge_commit_email: String
§profiler_runtime: bool
True if the profiler runtime is enabled for this target. Used by the
needs-profiler-runtime
directive in test files.
diff_command: Option<String>
Command for visual diff display, e.g. diff-tool --color=always
.
minicore_path: Utf8PathBuf
Path to minicore aux library (tests/auxiliary/minicore.rs
), used for no_core
tests that
need core
stubs in cross-compilation scenarios that do not otherwise want/need to
-Zbuild-std
. Used in e.g. ABI tests.
Implementations§
Source§impl Config
impl Config
Sourcepub fn run_enabled(&self) -> bool
pub fn run_enabled(&self) -> bool
FIXME: this run scheme is… confusing.
pub fn target_cfgs(&self) -> &TargetCfgs
pub fn target_cfg(&self) -> &TargetCfg
pub fn matches_arch(&self, arch: &str) -> bool
pub fn matches_os(&self, os: &str) -> bool
pub fn matches_env(&self, env: &str) -> bool
pub fn matches_abi(&self, abi: &str) -> bool
pub fn matches_family(&self, family: &str) -> bool
pub fn is_big_endian(&self) -> bool
pub fn get_pointer_width(&self) -> u32
pub fn can_unwind(&self) -> bool
Sourcepub fn builtin_cfg_names(&self) -> &HashSet<String>
pub fn builtin_cfg_names(&self) -> &HashSet<String>
Get the list of builtin, ‘well known’ cfg names
Sourcepub fn supported_crate_types(&self) -> &HashSet<String>
pub fn supported_crate_types(&self) -> &HashSet<String>
Get the list of crate types that the target platform supports.
pub fn has_threads(&self) -> bool
pub fn has_asm_support(&self) -> bool
pub fn git_config(&self) -> GitConfig<'_>
pub fn has_subprocess_support(&self) -> bool
Source§impl Config
impl Config
fn parse_and_update_revisions( &self, testfile: &Utf8Path, line: &str, existing: &mut Vec<String>, )
fn parse_env(nv: String) -> (String, String)
fn parse_pp_exact(&self, line: &str, testfile: &Utf8Path) -> Option<Utf8PathBuf>
fn parse_custom_normalization( &self, raw_directive: &str, ) -> Option<NormalizeRule>
fn parse_name_directive(&self, line: &str, directive: &str) -> bool
fn parse_negative_name_directive(&self, line: &str, directive: &str) -> bool
pub fn parse_name_value_directive( &self, line: &str, directive: &str, ) -> Option<String>
fn parse_edition(&self, line: &str) -> Option<String>
fn set_name_directive(&self, line: &str, directive: &str, value: &mut bool)
fn set_name_value_directive<T>( &self, line: &str, directive: &str, value: &mut Option<T>, parse: impl FnOnce(String) -> T, )
fn push_name_value_directive<T>( &self, line: &str, directive: &str, values: &mut Vec<T>, parse: impl FnOnce(String) -> T, )
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 2072 bytes