struct TestCx<'test> {
config: &'test Config,
props: &'test TestProps,
testpaths: &'test TestPaths,
revision: Option<&'test str>,
}
Fields§
§config: &'test Config
§props: &'test TestProps
§testpaths: &'test TestPaths
§revision: Option<&'test str>
Implementations§
Source§impl TestCx<'_>
impl TestCx<'_>
pub(super) fn run_assembly_test(&self)
fn compile_test_and_save_assembly(&self) -> (ProcRes, PathBuf)
Source§impl TestCx<'_>
impl TestCx<'_>
pub(super) fn run_codegen_test(&self)
Source§impl TestCx<'_>
impl TestCx<'_>
pub(super) fn run_codegen_units_test(&self)
Source§impl<'test> TestCx<'test>
impl<'test> TestCx<'test>
fn coverage_dump_path(&self) -> &Path
pub(super) fn run_coverage_map_test(&self)
pub(super) fn run_coverage_run_test(&self)
Sourcefn run_doctests_for_coverage(
&self,
profraw_paths: &mut Vec<PathBuf>,
bin_paths: &mut Vec<PathBuf>,
)
fn run_doctests_for_coverage( &self, profraw_paths: &mut Vec<PathBuf>, bin_paths: &mut Vec<PathBuf>, )
Run any doctests embedded in this test file, and add any resulting
.profraw
files and doctest executables to the given vectors.
fn run_llvm_tool( &self, name: &str, configure_cmd_fn: impl FnOnce(&mut Command), ) -> ProcRes
fn normalize_coverage_output(&self, coverage: &str) -> Result<String, String>
Sourcefn anonymize_coverage_line_numbers(coverage: &str) -> String
fn anonymize_coverage_line_numbers(coverage: &str) -> String
Replace line numbers in coverage reports with the placeholder LL
,
so that the tests are less sensitive to lines being added/removed.
Sourcefn sort_coverage_file_sections(
coverage_lines: &mut Vec<&str>,
) -> Result<(), String>
fn sort_coverage_file_sections( coverage_lines: &mut Vec<&str>, ) -> Result<(), String>
Coverage reports can describe multiple source files, separated by blank lines. The order of these files is unpredictable (since it depends on implementation details), so we need to sort the file sections into a consistent order before comparing against a snapshot.
fn sort_coverage_subviews(coverage_lines: &mut Vec<&str>) -> Result<(), String>
Source§impl TestCx<'_>
impl TestCx<'_>
pub(super) fn run_crash_test(&self)
Source§impl TestCx<'_>
impl TestCx<'_>
pub(super) fn run_debuginfo_test(&self)
fn run_debuginfo_cdb_test(&self)
fn run_debuginfo_cdb_test_no_opt(&self)
fn run_debuginfo_gdb_test(&self)
fn run_debuginfo_gdb_test_no_opt(&self)
fn run_debuginfo_lldb_test(&self)
fn run_debuginfo_lldb_test_no_opt(&self)
fn run_lldb( &self, test_executable: &Path, debugger_script: &Path, rust_src_root: &Path, ) -> ProcRes
fn cleanup_debug_info_options(&self, options: &Vec<String>) -> Vec<String>
Source§impl TestCx<'_>
impl TestCx<'_>
pub(super) fn run_incremental_test(&self)
fn run_cpass_test(&self)
fn run_rpass_test(&self)
fn run_cfail_test(&self)
fn run_rfail_test(&self)
Source§impl TestCx<'_>
impl TestCx<'_>
pub(super) fn run_js_doc_test(&self)
Source§impl TestCx<'_>
impl TestCx<'_>
pub(super) fn run_mir_opt_test(&self)
fn check_mir_dump(&self, test_info: MiroptTest)
fn diff_mir_files(&self, before: PathBuf, after: PathBuf) -> String
fn check_mir_test_timestamp(&self, test_name: &str, output_file: &Path)
Source§impl TestCx<'_>
impl TestCx<'_>
pub(super) fn run_pretty_test(&self)
Source§impl TestCx<'_>
impl TestCx<'_>
pub(super) fn run_rmake_test(&self)
fn run_rmake_legacy_test(&self)
fn run_rmake_v2_test(&self)
Source§impl TestCx<'_>
impl TestCx<'_>
pub(super) fn run_rustdoc_test(&self)
Source§impl TestCx<'_>
impl TestCx<'_>
pub(super) fn run_rustdoc_json_test(&self)
Source§impl TestCx<'_>
impl TestCx<'_>
pub(super) fn run_ui_test(&self)
Source§impl<'test> TestCx<'test>
impl<'test> TestCx<'test>
Sourcefn run_revision(&self)
fn run_revision(&self)
Code executed for each revision in turn (or, if there are no revisions, exactly once, with revision == None).
fn pass_mode(&self) -> Option<PassMode>
fn should_run(&self, pm: Option<PassMode>) -> WillExecute
fn run_if_enabled(&self) -> WillExecute
fn should_run_successfully(&self, pm: Option<PassMode>) -> bool
fn should_compile_successfully(&self, pm: Option<PassMode>) -> bool
fn check_if_test_should_compile( &self, fail_mode: Option<FailMode>, pass_mode: Option<PassMode>, proc_res: &ProcRes, )
fn get_output(&self, proc_res: &ProcRes) -> String
fn check_correct_failure_status(&self, proc_res: &ProcRes)
Sourcefn run_command_to_procres(&self, cmd: &mut Command) -> ProcRes
fn run_command_to_procres(&self, cmd: &mut Command) -> ProcRes
Runs a Command
and waits for it to finish, then converts its exit
status and output streams into a ProcRes
.
The command might have succeeded or failed; it is the caller’s responsibility to check the exit status and take appropriate action.
§Panics
Panics if the command couldn’t be executed at all (e.g. because the executable could not be found).
fn print_source(&self, read_from: ReadFrom, pretty_type: &str) -> ProcRes
fn compare_source(&self, expected: &str, actual: &str)
fn set_revision_flags(&self, cmd: &mut Command)
fn typecheck_source(&self, src: String) -> ProcRes
fn maybe_add_external_args(&self, cmd: &mut Command, args: &Vec<String>)
fn check_all_error_patterns( &self, output_to_check: &str, proc_res: &ProcRes, pm: Option<PassMode>, )
fn check_error_patterns( &self, output_to_check: &str, missing_patterns: &mut Vec<String>, )
fn check_regex_error_patterns( &self, output_to_check: &str, proc_res: &ProcRes, missing_patterns: &mut Vec<String>, )
fn check_no_compiler_crash(&self, proc_res: &ProcRes, should_ice: bool)
fn check_forbid_output(&self, output_to_check: &str, proc_res: &ProcRes)
fn check_expected_errors(&self, expected_errors: Vec<Error>, proc_res: &ProcRes)
Sourcefn is_unexpected_compiler_message(
&self,
actual_error: &Error,
expect_help: bool,
expect_note: bool,
) -> bool
fn is_unexpected_compiler_message( &self, actual_error: &Error, expect_help: bool, expect_note: bool, ) -> bool
Returns true
if we should report an error about actual_error
,
which did not match any of the expected error. We always require
errors/warnings to be explicitly listed, but only require
helps/notes if there are explicit helps/notes given.
fn should_emit_metadata(&self, pm: Option<PassMode>) -> Emit
fn compile_test(&self, will_execute: WillExecute, emit: Emit) -> ProcRes
fn compile_test_with_passes( &self, will_execute: WillExecute, emit: Emit, passes: Vec<String>, ) -> ProcRes
fn compile_test_general( &self, will_execute: WillExecute, emit: Emit, local_pm: Option<PassMode>, passes: Vec<String>, ) -> ProcRes
Sourcefn document(&self, root_out_dir: &Path, root_testpaths: &TestPaths) -> ProcRes
fn document(&self, root_out_dir: &Path, root_testpaths: &TestPaths) -> ProcRes
root_out_dir
and root_testpaths
refer to the parameters of the actual test being run.
Auxiliaries, no matter how deep, have the same root_out_dir and root_testpaths.
fn exec_compiled_test(&self) -> ProcRes
fn exec_compiled_test_general( &self, env_extra: &[(&str, &str)], delete_after_success: bool, ) -> ProcRes
Sourcefn compute_aux_test_paths(&self, of: &TestPaths, rel_ab: &str) -> TestPaths
fn compute_aux_test_paths(&self, of: &TestPaths, rel_ab: &str) -> TestPaths
For each aux-build: foo/bar
annotation, we check to find the file in an auxiliary
directory relative to the test itself (not any intermediate auxiliaries).
fn is_vxworks_pure_static(&self) -> bool
fn is_vxworks_pure_dynamic(&self) -> bool
fn has_aux_dir(&self) -> bool
fn aux_output_dir(&self) -> PathBuf
fn build_all_auxiliary( &self, of: &TestPaths, aux_dir: &Path, rustc: &mut Command, )
Sourcefn compose_and_run_compiler(
&self,
rustc: Command,
input: Option<String>,
root_testpaths: &TestPaths,
) -> ProcRes
fn compose_and_run_compiler( &self, rustc: Command, input: Option<String>, root_testpaths: &TestPaths, ) -> ProcRes
root_testpaths
refers to the path of the original test. the auxiliary and the test with an
aux-build have the same root_testpaths
.
Sourcefn build_minicore(&self) -> PathBuf
fn build_minicore(&self) -> PathBuf
Builds minicore
. Returns the path to the minicore rlib within the base test output
directory.
Sourcefn build_auxiliary(
&self,
of: &TestPaths,
source_path: &str,
aux_dir: &Path,
is_bin: bool,
) -> AuxType
fn build_auxiliary( &self, of: &TestPaths, source_path: &str, aux_dir: &Path, is_bin: bool, ) -> AuxType
Builds an aux dependency.
fn read2_abbreviated(&self, child: Child) -> (Output, Truncated)
fn compose_and_run( &self, command: Command, lib_path: &str, aux_path: Option<&str>, input: Option<String>, ) -> ProcRes
fn is_rustdoc(&self) -> bool
fn get_mir_dump_dir(&self) -> PathBuf
fn make_compile_args( &self, input_file: &Path, output_file: TargetLocation, emit: Emit, allow_unused: AllowUnused, link_to_aux: LinkToAux, passes: Vec<String>, ) -> Command
fn make_exe_name(&self) -> PathBuf
fn make_run_args(&self) -> ProcArgs
fn split_maybe_args(&self, argstr: &Option<String>) -> Vec<OsString>
fn make_cmdline(&self, command: &Command, libpath: &str) -> String
fn dump_output(&self, out: &str, err: &str)
fn dump_output_file(&self, out: &str, extension: &str)
Sourcefn make_out_name(&self, extension: &str) -> PathBuf
fn make_out_name(&self, extension: &str) -> PathBuf
Creates a filename for output with the given extension.
E.g., /.../testname.revision.mode/testname.extension
.
Sourcefn aux_output_dir_name(&self) -> PathBuf
fn aux_output_dir_name(&self) -> PathBuf
Gets the directory where auxiliary files are written.
E.g., /.../testname.revision.mode/auxiliary/
.
Sourcefn aux_bin_output_dir_name(&self) -> PathBuf
fn aux_bin_output_dir_name(&self) -> PathBuf
Gets the directory where auxiliary binaries are written.
E.g., /.../testname.revision.mode/auxiliary/bin
.
Sourcefn output_testname_unique(&self) -> PathBuf
fn output_testname_unique(&self) -> PathBuf
Generates a unique name for the test, such as testname.revision.mode
.
Sourcefn safe_revision(&self) -> Option<&str>
fn safe_revision(&self) -> Option<&str>
The revision, ignored for incremental compilation since it wants all revisions in the same directory.
Sourcefn output_base_dir(&self) -> PathBuf
fn output_base_dir(&self) -> PathBuf
Gets the absolute path to the directory where all output for the given
test/revision should reside.
E.g., /path/to/build/host-tuple/test/ui/relative/testname.revision.mode/
.
Sourcefn output_base_name(&self) -> PathBuf
fn output_base_name(&self) -> PathBuf
Gets the absolute path to the base filename used as output for the given
test/revision.
E.g., /.../relative/testname.revision.mode/testname
.
fn maybe_dump_to_stdout(&self, out: &str, err: &str)
fn error(&self, err: &str)
fn fatal(&self, err: &str) -> !
fn fatal_proc_rec(&self, err: &str, proc_res: &ProcRes) -> !
fn fatal_proc_rec_with_ctx( &self, err: &str, proc_res: &ProcRes, on_failure: impl FnOnce(Self), ) -> !
fn compile_test_and_save_ir(&self) -> (ProcRes, PathBuf)
fn verify_with_filecheck(&self, output: &Path) -> ProcRes
fn charset() -> &'static str
fn compare_to_default_rustdoc(&mut self, out_dir: &Path)
fn get_lines<P: AsRef<Path>>( &self, path: &P, other_files: Option<&mut Vec<String>>, ) -> Vec<usize>
Sourcefn check_rustdoc_test_option(&self, res: ProcRes)
fn check_rustdoc_test_option(&self, res: ProcRes)
This method is used for //@ check-test-line-numbers-match
.
It checks that doctests line in the displayed doctest “name” matches where they are defined in source code.
fn force_color_svg(&self) -> bool
fn load_compare_outputs( &self, proc_res: &ProcRes, output_kind: TestOutput, explicit_format: bool, ) -> usize
fn normalize_output( &self, output: &str, custom_rules: &[(String, String)], ) -> String
Sourcefn normalize_platform_differences(output: &str) -> String
fn normalize_platform_differences(output: &str) -> String
Normalize output differences across platforms. Generally changes Windows output to be more Unix-like.
Replaces backslashes in paths with forward slashes, and replaces CRLF line endings with LF.
fn expected_output_path(&self, kind: &str) -> PathBuf
fn load_expected_output(&self, kind: &str) -> String
fn load_expected_output_from_path(&self, path: &Path) -> Result<String, String>
fn delete_file(&self, file: &PathBuf)
fn compare_output(&self, stream: &str, actual: &str, expected: &str) -> usize
fn check_and_prune_duplicate_outputs( &self, proc_res: &ProcRes, modes: &[CompareMode], require_same_modes: &[CompareMode], )
fn create_stamp(&self)
fn init_incremental_test(&self)
fn aggressive_rm_rf(&self, path: &Path) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl<'test> Freeze for TestCx<'test>
impl<'test> RefUnwindSafe for TestCx<'test>
impl<'test> Send for TestCx<'test>
impl<'test> Sync for TestCx<'test>
impl<'test> Unpin for TestCx<'test>
impl<'test> UnwindSafe for TestCx<'test>
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> 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: 40 bytes