@@ -43,7 +43,7 @@ use crate::common::{
4343 expected_output_path, output_base_dir, output_relative_path,
4444} ;
4545use crate :: directives:: DirectivesCache ;
46- use crate :: executor:: { CollectedTest , ColorConfig , OutputFormat } ;
46+ use crate :: executor:: { CollectedTest , ColorConfig } ;
4747use crate :: util:: logv;
4848
4949/// Creates the `Config` instance for this invocation of compiletest.
@@ -137,9 +137,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
137137 "overwrite stderr/stdout files instead of complaining about a mismatch" ,
138138 )
139139 . optflag ( "" , "fail-fast" , "stop as soon as possible after any test fails" )
140- . optflag ( "" , "quiet" , "print one character per test instead of one line" )
141140 . optopt ( "" , "color" , "coloring: auto, always, never" , "WHEN" )
142- . optflag ( "" , "json" , "emit json output instead of plaintext output" )
143141 . optopt ( "" , "target" , "the target to build for" , "TARGET" )
144142 . optopt ( "" , "host" , "the host to build for" , "HOST" )
145143 . optopt ( "" , "cdb" , "path to CDB to use for CDB debuginfo tests" , "PATH" )
@@ -203,7 +201,6 @@ pub fn parse_config(args: Vec<String>) -> Config {
203201 "COMMAND" ,
204202 )
205203 . reqopt ( "" , "minicore-path" , "path to minicore aux library" , "PATH" )
206- . optflag ( "N" , "no-new-executor" , "disables the new test executor, and uses libtest instead" )
207204 . optopt (
208205 "" ,
209206 "debugger" ,
@@ -436,12 +433,6 @@ pub fn parse_config(args: Vec<String>) -> Config {
436433 && !opt_str2 ( matches. opt_str ( "adb-test-dir" ) ) . is_empty ( ) ,
437434 lldb_python_dir : matches. opt_str ( "lldb-python-dir" ) ,
438435 verbose : matches. opt_present ( "verbose" ) ,
439- format : match ( matches. opt_present ( "quiet" ) , matches. opt_present ( "json" ) ) {
440- ( true , true ) => panic ! ( "--quiet and --json are incompatible" ) ,
441- ( true , false ) => OutputFormat :: Terse ,
442- ( false , true ) => OutputFormat :: Json ,
443- ( false , false ) => OutputFormat :: Pretty ,
444- } ,
445436 only_modified : matches. opt_present ( "only-modified" ) ,
446437 color,
447438 remote_test_client : matches. opt_str ( "remote-test-client" ) . map ( Utf8PathBuf :: from) ,
@@ -527,7 +518,6 @@ pub fn log_config(config: &Config) {
527518 logv ( c, format ! ( "target-linker: {:?}" , config. target_linker) ) ;
528519 logv ( c, format ! ( "host-linker: {:?}" , config. host_linker) ) ;
529520 logv ( c, format ! ( "verbose: {}" , config. verbose) ) ;
530- logv ( c, format ! ( "format: {:?}" , config. format) ) ;
531521 logv ( c, format ! ( "minicore_path: {}" , config. minicore_path) ) ;
532522 logv ( c, "\n " . to_string ( ) ) ;
533523}
@@ -601,7 +591,7 @@ pub fn run_tests(config: Arc<Config>) {
601591 configs. push ( config. clone ( ) ) ;
602592 } ;
603593
604- // Discover all of the tests in the test suite directory, and build a libtest
594+ // Discover all of the tests in the test suite directory, and build a `CollectedTest`
605595 // structure for each test (or each revision of a multi-revision test).
606596 let mut tests = Vec :: new ( ) ;
607597 for c in configs {
@@ -613,50 +603,35 @@ pub fn run_tests(config: Arc<Config>) {
613603 // Delegate to the executor to filter and run the big list of test structures
614604 // created during test discovery. When the executor decides to run a test,
615605 // it will return control to the rest of compiletest by calling `runtest::run`.
616- // FIXME(Zalathar): Once we're confident that we won't need to revert the
617- // removal of the libtest-based executor, remove this Result and other
618- // remnants of the old executor.
619- let res: io:: Result < bool > = Ok ( executor:: run_tests ( & config, tests) ) ;
620-
621- // Check the outcome reported by libtest.
622- match res {
623- Ok ( true ) => { }
624- Ok ( false ) => {
625- // We want to report that the tests failed, but we also want to give
626- // some indication of just what tests we were running. Especially on
627- // CI, where there can be cross-compiled tests for a lot of
628- // architectures, without this critical information it can be quite
629- // easy to miss which tests failed, and as such fail to reproduce
630- // the failure locally.
631-
632- let mut msg = String :: from ( "Some tests failed in compiletest" ) ;
633- write ! ( msg, " suite={}" , config. suite) . unwrap ( ) ;
634-
635- if let Some ( compare_mode) = config. compare_mode . as_ref ( ) {
636- write ! ( msg, " compare_mode={}" , compare_mode) . unwrap ( ) ;
637- }
606+ let ok = executor:: run_tests ( & config, tests) ;
607+
608+ // Check the outcome reported by the executor.
609+ if !ok {
610+ // We want to report that the tests failed, but we also want to give
611+ // some indication of just what tests we were running. Especially on
612+ // CI, where there can be cross-compiled tests for a lot of
613+ // architectures, without this critical information it can be quite
614+ // easy to miss which tests failed, and as such fail to reproduce
615+ // the failure locally.
616+
617+ let mut msg = String :: from ( "Some tests failed in compiletest" ) ;
618+ write ! ( msg, " suite={}" , config. suite) . unwrap ( ) ;
619+
620+ if let Some ( compare_mode) = config. compare_mode . as_ref ( ) {
621+ write ! ( msg, " compare_mode={}" , compare_mode) . unwrap ( ) ;
622+ }
638623
639- if let Some ( pass_mode) = config. force_pass_mode . as_ref ( ) {
640- write ! ( msg, " pass_mode={}" , pass_mode) . unwrap ( ) ;
641- }
624+ if let Some ( pass_mode) = config. force_pass_mode . as_ref ( ) {
625+ write ! ( msg, " pass_mode={}" , pass_mode) . unwrap ( ) ;
626+ }
642627
643- write ! ( msg, " mode={}" , config. mode) . unwrap ( ) ;
644- write ! ( msg, " host={}" , config. host) . unwrap ( ) ;
645- write ! ( msg, " target={}" , config. target) . unwrap ( ) ;
628+ write ! ( msg, " mode={}" , config. mode) . unwrap ( ) ;
629+ write ! ( msg, " host={}" , config. host) . unwrap ( ) ;
630+ write ! ( msg, " target={}" , config. target) . unwrap ( ) ;
646631
647- println ! ( "{msg}" ) ;
632+ println ! ( "{msg}" ) ;
648633
649- std:: process:: exit ( 1 ) ;
650- }
651- Err ( e) => {
652- // We don't know if tests passed or not, but if there was an error
653- // during testing we don't want to just succeed (we may not have
654- // tested something), so fail.
655- //
656- // This should realistically "never" happen, so don't try to make
657- // this a pretty error message.
658- panic ! ( "I/O failure during tests: {:?}" , e) ;
659- }
634+ std:: process:: exit ( 1 ) ;
660635 }
661636}
662637
@@ -691,7 +666,11 @@ impl TestCollector {
691666///
692667/// This always inspects _all_ test files in the suite (e.g. all 17k+ ui tests),
693668/// regardless of whether any filters/tests were specified on the command-line,
694- /// because filtering is handled later by libtest.
669+ /// because filtering is handled later by code that was copied from libtest.
670+ ///
671+ /// FIXME(Zalathar): Now that we no longer rely on libtest, try to overhaul
672+ /// test discovery to take into account the filters/tests specified on the
673+ /// command-line, instead of having to enumerate everything.
695674pub ( crate ) fn collect_and_make_tests ( config : Arc < Config > ) -> Vec < CollectedTest > {
696675 debug ! ( "making tests from {}" , config. src_test_suite_root) ;
697676 let common_inputs_stamp = common_inputs_stamp ( & config) ;
@@ -805,7 +784,7 @@ fn modified_tests(config: &Config, dir: &Utf8Path) -> Result<Vec<Utf8PathBuf>, S
805784}
806785
807786/// Recursively scans a directory to find test files and create test structures
808- /// that will be handed over to libtest .
787+ /// that will be handed over to the executor .
809788fn collect_tests_from_dir (
810789 cx : & TestCollectorCx ,
811790 dir : & Utf8Path ,
@@ -871,7 +850,7 @@ fn collect_tests_from_dir(
871850 if is_test ( file_name)
872851 && ( !cx. config . only_modified || cx. modified_tests . contains ( & file_path) )
873852 {
874- // We found a test file, so create the corresponding libtest structures.
853+ // We found a test file, so create the corresponding test structures.
875854 debug ! ( %file_path, "found test file" ) ;
876855
877856 // Record the stem of the test file, to check for overlaps later.
@@ -915,7 +894,7 @@ pub fn is_test(file_name: &str) -> bool {
915894}
916895
917896/// For a single test file, creates one or more test structures (one per revision) that can be
918- /// handed over to libtest to run, possibly in parallel.
897+ /// handed over to the executor to run, possibly in parallel.
919898fn make_test ( cx : & TestCollectorCx , collector : & mut TestCollector , testpaths : & TestPaths ) {
920899 // For run-make tests, each "test file" is actually a _directory_ containing an `rmake.rs`. But
921900 // for the purposes of directive parsing, we want to look at that recipe file, not the directory
@@ -929,7 +908,7 @@ fn make_test(cx: &TestCollectorCx, collector: &mut TestCollector, testpaths: &Te
929908 // Scan the test file to discover its revisions, if any.
930909 let early_props = EarlyProps :: from_file ( & cx. config , & test_path) ;
931910
932- // Normally we create one libtest structure per revision, with two exceptions:
911+ // Normally we create one structure per revision, with two exceptions:
933912 // - If a test doesn't use revisions, create a dummy revision (None) so that
934913 // the test can still run.
935914 // - Incremental tests inherently can't run their revisions in parallel, so
@@ -944,12 +923,12 @@ fn make_test(cx: &TestCollectorCx, collector: &mut TestCollector, testpaths: &Te
944923 // For each revision (or the sole dummy revision), create and append a
945924 // `CollectedTest` that can be handed over to the test executor.
946925 collector. tests . extend ( revisions. into_iter ( ) . map ( |revision| {
947- // Create a test name and description to hand over to libtest .
926+ // Create a test name and description to hand over to the executor .
948927 let src_file = fs:: File :: open ( & test_path) . expect ( "open test file to parse ignores" ) ;
949928 let test_name = make_test_name ( & cx. config , testpaths, revision) ;
950- // Create a libtest description for the test/revision.
929+ // Create a description struct for the test/revision.
951930 // This is where `ignore-*`/`only-*`/`needs-*` directives are handled,
952- // because they need to set the libtest ignored flag.
931+ // because they historically needed to set the libtest ignored flag.
953932 let mut desc = make_test_description (
954933 & cx. config ,
955934 & cx. cache ,
@@ -961,10 +940,12 @@ fn make_test(cx: &TestCollectorCx, collector: &mut TestCollector, testpaths: &Te
961940 ) ;
962941
963942 // If a test's inputs haven't changed since the last time it ran,
964- // mark it as ignored so that libtest will skip it.
943+ // mark it as ignored so that the executor will skip it.
965944 if !cx. config . force_rerun && is_up_to_date ( cx, testpaths, & early_props, revision) {
966945 desc. ignore = true ;
967946 // Keep this in sync with the "up-to-date" message detected by bootstrap.
947+ // FIXME(Zalathar): Now that we are no longer tied to libtest, we could
948+ // find a less fragile way to communicate this status to bootstrap.
968949 desc. ignore_message = Some ( "up-to-date" . into ( ) ) ;
969950 }
970951
@@ -1104,7 +1085,7 @@ impl Stamp {
11041085 }
11051086}
11061087
1107- /// Creates a name for this test/revision that can be handed over to libtest .
1088+ /// Creates a name for this test/revision that can be handed over to the executor .
11081089fn make_test_name ( config : & Config , testpaths : & TestPaths , revision : Option < & str > ) -> String {
11091090 // Print the name of the file, relative to the sources root.
11101091 let path = testpaths. file . strip_prefix ( & config. src_root ) . unwrap ( ) ;
0 commit comments