compiletest::runtest

Struct TestCx

Source
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<'_>

Source§

impl TestCx<'_>

Source

pub(super) fn run_codegen_test(&self)

Source§

impl TestCx<'_>

Source

pub(super) fn run_codegen_units_test(&self)

Source§

impl<'test> TestCx<'test>

Source

fn coverage_dump_path(&self) -> &Path

Source

pub(super) fn run_coverage_map_test(&self)

Source

pub(super) fn run_coverage_run_test(&self)

Source

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.

Source

fn run_llvm_tool( &self, name: &str, configure_cmd_fn: impl FnOnce(&mut Command), ) -> ProcRes

Source

fn normalize_coverage_output(&self, coverage: &str) -> Result<String, String>

Source

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.

Source

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.

Source

fn sort_coverage_subviews(coverage_lines: &mut Vec<&str>) -> Result<(), String>

Source§

impl TestCx<'_>

Source

pub(super) fn run_crash_test(&self)

Source§

impl TestCx<'_>

Source§

impl TestCx<'_>

Source§

impl TestCx<'_>

Source

pub(super) fn run_js_doc_test(&self)

Source§

impl TestCx<'_>

Source

pub(super) fn run_mir_opt_test(&self)

Source

fn check_mir_dump(&self, test_info: MiroptTest)

Source

fn diff_mir_files(&self, before: PathBuf, after: PathBuf) -> String

Source

fn check_mir_test_timestamp(&self, test_name: &str, output_file: &Path)

Source§

impl TestCx<'_>

Source

pub(super) fn run_pretty_test(&self)

Source§

impl TestCx<'_>

Source§

impl TestCx<'_>

Source

pub(super) fn run_rustdoc_test(&self)

Source§

impl TestCx<'_>

Source

pub(super) fn run_rustdoc_json_test(&self)

Source§

impl TestCx<'_>

Source

pub(super) fn run_ui_test(&self)

Source§

impl<'test> TestCx<'test>

Source

fn run_revision(&self)

Code executed for each revision in turn (or, if there are no revisions, exactly once, with revision == None).

Source

fn pass_mode(&self) -> Option<PassMode>

Source

fn should_run(&self, pm: Option<PassMode>) -> WillExecute

Source

fn run_if_enabled(&self) -> WillExecute

Source

fn should_run_successfully(&self, pm: Option<PassMode>) -> bool

Source

fn should_compile_successfully(&self, pm: Option<PassMode>) -> bool

Source

fn check_if_test_should_compile( &self, fail_mode: Option<FailMode>, pass_mode: Option<PassMode>, proc_res: &ProcRes, )

Source

fn get_output(&self, proc_res: &ProcRes) -> String

Source

fn check_correct_failure_status(&self, proc_res: &ProcRes)

Source

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).

Source

fn print_source(&self, read_from: ReadFrom, pretty_type: &str) -> ProcRes

Source

fn compare_source(&self, expected: &str, actual: &str)

Source

fn set_revision_flags(&self, cmd: &mut Command)

Source

fn typecheck_source(&self, src: String) -> ProcRes

Source

fn maybe_add_external_args(&self, cmd: &mut Command, args: &Vec<String>)

Source

fn check_all_error_patterns( &self, output_to_check: &str, proc_res: &ProcRes, pm: Option<PassMode>, )

Source

fn check_error_patterns( &self, output_to_check: &str, missing_patterns: &mut Vec<String>, )

Source

fn check_regex_error_patterns( &self, output_to_check: &str, proc_res: &ProcRes, missing_patterns: &mut Vec<String>, )

Source

fn check_no_compiler_crash(&self, proc_res: &ProcRes, should_ice: bool)

Source

fn check_forbid_output(&self, output_to_check: &str, proc_res: &ProcRes)

Source

fn check_expected_errors(&self, expected_errors: Vec<Error>, proc_res: &ProcRes)

Source

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.

Source

fn should_emit_metadata(&self, pm: Option<PassMode>) -> Emit

Source

fn compile_test(&self, will_execute: WillExecute, emit: Emit) -> ProcRes

Source

fn compile_test_with_passes( &self, will_execute: WillExecute, emit: Emit, passes: Vec<String>, ) -> ProcRes

Source

fn compile_test_general( &self, will_execute: WillExecute, emit: Emit, local_pm: Option<PassMode>, passes: Vec<String>, ) -> ProcRes

Source

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.

Source

fn exec_compiled_test(&self) -> ProcRes

Source

fn exec_compiled_test_general( &self, env_extra: &[(&str, &str)], delete_after_success: bool, ) -> ProcRes

Source

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).

Source

fn is_vxworks_pure_static(&self) -> bool

Source

fn is_vxworks_pure_dynamic(&self) -> bool

Source

fn has_aux_dir(&self) -> bool

Source

fn aux_output_dir(&self) -> PathBuf

Source

fn build_all_auxiliary( &self, of: &TestPaths, aux_dir: &Path, rustc: &mut Command, )

Source

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.

Source

fn build_minicore(&self) -> PathBuf

Builds minicore. Returns the path to the minicore rlib within the base test output directory.

Source

fn build_auxiliary( &self, of: &TestPaths, source_path: &str, aux_dir: &Path, is_bin: bool, ) -> AuxType

Builds an aux dependency.

Source

fn read2_abbreviated(&self, child: Child) -> (Output, Truncated)

Source

fn compose_and_run( &self, command: Command, lib_path: &str, aux_path: Option<&str>, input: Option<String>, ) -> ProcRes

Source

fn is_rustdoc(&self) -> bool

Source

fn get_mir_dump_dir(&self) -> PathBuf

Source

fn make_compile_args( &self, input_file: &Path, output_file: TargetLocation, emit: Emit, allow_unused: AllowUnused, link_to_aux: LinkToAux, passes: Vec<String>, ) -> Command

Source

fn make_exe_name(&self) -> PathBuf

Source

fn make_run_args(&self) -> ProcArgs

Source

fn split_maybe_args(&self, argstr: &Option<String>) -> Vec<OsString>

Source

fn make_cmdline(&self, command: &Command, libpath: &str) -> String

Source

fn dump_output(&self, out: &str, err: &str)

Source

fn dump_output_file(&self, out: &str, extension: &str)

Source

fn make_out_name(&self, extension: &str) -> PathBuf

Creates a filename for output with the given extension. E.g., /.../testname.revision.mode/testname.extension.

Source

fn aux_output_dir_name(&self) -> PathBuf

Gets the directory where auxiliary files are written. E.g., /.../testname.revision.mode/auxiliary/.

Source

fn aux_bin_output_dir_name(&self) -> PathBuf

Gets the directory where auxiliary binaries are written. E.g., /.../testname.revision.mode/auxiliary/bin.

Source

fn output_testname_unique(&self) -> PathBuf

Generates a unique name for the test, such as testname.revision.mode.

Source

fn safe_revision(&self) -> Option<&str>

The revision, ignored for incremental compilation since it wants all revisions in the same directory.

Source

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/.

Source

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.

Source

fn maybe_dump_to_stdout(&self, out: &str, err: &str)

Source

fn error(&self, err: &str)

Source

fn fatal(&self, err: &str) -> !

Source

fn fatal_proc_rec(&self, err: &str, proc_res: &ProcRes) -> !

Source

fn fatal_proc_rec_with_ctx( &self, err: &str, proc_res: &ProcRes, on_failure: impl FnOnce(Self), ) -> !

Source

fn compile_test_and_save_ir(&self) -> (ProcRes, PathBuf)

Source

fn verify_with_filecheck(&self, output: &Path) -> ProcRes

Source

fn charset() -> &'static str

Source

fn compare_to_default_rustdoc(&mut self, out_dir: &Path)

Source

fn get_lines<P: AsRef<Path>>( &self, path: &P, other_files: Option<&mut Vec<String>>, ) -> Vec<usize>

Source

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.

Source

fn force_color_svg(&self) -> bool

Source

fn load_compare_outputs( &self, proc_res: &ProcRes, output_kind: TestOutput, explicit_format: bool, ) -> usize

Source

fn normalize_output( &self, output: &str, custom_rules: &[(String, String)], ) -> String

Source

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.

Source

fn expected_output_path(&self, kind: &str) -> PathBuf

Source

fn load_expected_output(&self, kind: &str) -> String

Source

fn load_expected_output_from_path(&self, path: &Path) -> Result<String, String>

Source

fn delete_file(&self, file: &PathBuf)

Source

fn compare_output(&self, stream: &str, actual: &str, expected: &str) -> usize

Source

fn check_and_prune_duplicate_outputs( &self, proc_res: &ProcRes, modes: &[CompareMode], require_same_modes: &[CompareMode], )

Source

fn create_stamp(&self)

Source

fn init_incremental_test(&self)

Source

fn aggressive_rm_rf(&self, path: &Path) -> Result<()>

Trait Implementations§

Source§

impl<'test> Clone for TestCx<'test>

Source§

fn clone(&self) -> TestCx<'test>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'test> Copy for TestCx<'test>

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more

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