@@ -43,7 +43,7 @@ use crate::common::{
43
43
expected_output_path, output_base_dir, output_relative_path,
44
44
} ;
45
45
use crate :: directives:: DirectivesCache ;
46
- use crate :: executor:: { CollectedTest , ColorConfig , OutputFormat } ;
46
+ use crate :: executor:: { CollectedTest , ColorConfig } ;
47
47
use crate :: util:: logv;
48
48
49
49
/// Creates the `Config` instance for this invocation of compiletest.
@@ -137,9 +137,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
137
137
"overwrite stderr/stdout files instead of complaining about a mismatch" ,
138
138
)
139
139
. optflag ( "" , "fail-fast" , "stop as soon as possible after any test fails" )
140
- . optflag ( "" , "quiet" , "print one character per test instead of one line" )
141
140
. optopt ( "" , "color" , "coloring: auto, always, never" , "WHEN" )
142
- . optflag ( "" , "json" , "emit json output instead of plaintext output" )
143
141
. optopt ( "" , "target" , "the target to build for" , "TARGET" )
144
142
. optopt ( "" , "host" , "the host to build for" , "HOST" )
145
143
. optopt ( "" , "cdb" , "path to CDB to use for CDB debuginfo tests" , "PATH" )
@@ -203,7 +201,6 @@ pub fn parse_config(args: Vec<String>) -> Config {
203
201
"COMMAND" ,
204
202
)
205
203
. reqopt ( "" , "minicore-path" , "path to minicore aux library" , "PATH" )
206
- . optflag ( "N" , "no-new-executor" , "disables the new test executor, and uses libtest instead" )
207
204
. optopt (
208
205
"" ,
209
206
"debugger" ,
@@ -436,12 +433,6 @@ pub fn parse_config(args: Vec<String>) -> Config {
436
433
&& !opt_str2 ( matches. opt_str ( "adb-test-dir" ) ) . is_empty ( ) ,
437
434
lldb_python_dir : matches. opt_str ( "lldb-python-dir" ) ,
438
435
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
- } ,
445
436
only_modified : matches. opt_present ( "only-modified" ) ,
446
437
color,
447
438
remote_test_client : matches. opt_str ( "remote-test-client" ) . map ( Utf8PathBuf :: from) ,
@@ -527,7 +518,6 @@ pub fn log_config(config: &Config) {
527
518
logv ( c, format ! ( "target-linker: {:?}" , config. target_linker) ) ;
528
519
logv ( c, format ! ( "host-linker: {:?}" , config. host_linker) ) ;
529
520
logv ( c, format ! ( "verbose: {}" , config. verbose) ) ;
530
- logv ( c, format ! ( "format: {:?}" , config. format) ) ;
531
521
logv ( c, format ! ( "minicore_path: {}" , config. minicore_path) ) ;
532
522
logv ( c, "\n " . to_string ( ) ) ;
533
523
}
@@ -601,7 +591,7 @@ pub fn run_tests(config: Arc<Config>) {
601
591
configs. push ( config. clone ( ) ) ;
602
592
} ;
603
593
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`
605
595
// structure for each test (or each revision of a multi-revision test).
606
596
let mut tests = Vec :: new ( ) ;
607
597
for c in configs {
@@ -613,50 +603,35 @@ pub fn run_tests(config: Arc<Config>) {
613
603
// Delegate to the executor to filter and run the big list of test structures
614
604
// created during test discovery. When the executor decides to run a test,
615
605
// 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
+ }
638
623
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
+ }
642
627
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 ( ) ;
646
631
647
- println ! ( "{msg}" ) ;
632
+ println ! ( "{msg}" ) ;
648
633
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 ) ;
660
635
}
661
636
}
662
637
@@ -691,7 +666,11 @@ impl TestCollector {
691
666
///
692
667
/// This always inspects _all_ test files in the suite (e.g. all 17k+ ui tests),
693
668
/// 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.
695
674
pub ( crate ) fn collect_and_make_tests ( config : Arc < Config > ) -> Vec < CollectedTest > {
696
675
debug ! ( "making tests from {}" , config. src_test_suite_root) ;
697
676
let common_inputs_stamp = common_inputs_stamp ( & config) ;
@@ -805,7 +784,7 @@ fn modified_tests(config: &Config, dir: &Utf8Path) -> Result<Vec<Utf8PathBuf>, S
805
784
}
806
785
807
786
/// 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 .
809
788
fn collect_tests_from_dir (
810
789
cx : & TestCollectorCx ,
811
790
dir : & Utf8Path ,
@@ -871,7 +850,7 @@ fn collect_tests_from_dir(
871
850
if is_test ( file_name)
872
851
&& ( !cx. config . only_modified || cx. modified_tests . contains ( & file_path) )
873
852
{
874
- // We found a test file, so create the corresponding libtest structures.
853
+ // We found a test file, so create the corresponding test structures.
875
854
debug ! ( %file_path, "found test file" ) ;
876
855
877
856
// Record the stem of the test file, to check for overlaps later.
@@ -915,7 +894,7 @@ pub fn is_test(file_name: &str) -> bool {
915
894
}
916
895
917
896
/// 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.
919
898
fn make_test ( cx : & TestCollectorCx , collector : & mut TestCollector , testpaths : & TestPaths ) {
920
899
// For run-make tests, each "test file" is actually a _directory_ containing an `rmake.rs`. But
921
900
// 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
929
908
// Scan the test file to discover its revisions, if any.
930
909
let early_props = EarlyProps :: from_file ( & cx. config , & test_path) ;
931
910
932
- // Normally we create one libtest structure per revision, with two exceptions:
911
+ // Normally we create one structure per revision, with two exceptions:
933
912
// - If a test doesn't use revisions, create a dummy revision (None) so that
934
913
// the test can still run.
935
914
// - 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
944
923
// For each revision (or the sole dummy revision), create and append a
945
924
// `CollectedTest` that can be handed over to the test executor.
946
925
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 .
948
927
let src_file = fs:: File :: open ( & test_path) . expect ( "open test file to parse ignores" ) ;
949
928
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.
951
930
// 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.
953
932
let mut desc = make_test_description (
954
933
& cx. config ,
955
934
& cx. cache ,
@@ -961,10 +940,12 @@ fn make_test(cx: &TestCollectorCx, collector: &mut TestCollector, testpaths: &Te
961
940
) ;
962
941
963
942
// 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.
965
944
if !cx. config . force_rerun && is_up_to_date ( cx, testpaths, & early_props, revision) {
966
945
desc. ignore = true ;
967
946
// 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.
968
949
desc. ignore_message = Some ( "up-to-date" . into ( ) ) ;
969
950
}
970
951
@@ -1104,7 +1085,7 @@ impl Stamp {
1104
1085
}
1105
1086
}
1106
1087
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 .
1108
1089
fn make_test_name ( config : & Config , testpaths : & TestPaths , revision : Option < & str > ) -> String {
1109
1090
// Print the name of the file, relative to the sources root.
1110
1091
let path = testpaths. file . strip_prefix ( & config. src_root ) . unwrap ( ) ;
0 commit comments