File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -937,8 +937,17 @@ impl App {
937937 profile_name : Option < & str > ,
938938 config : & ' cfg NextestConfig ,
939939 ) -> Result < NextestProfile < ' cfg > > {
940+ let profile_name = profile_name. unwrap_or_else ( || {
941+ // The "official" way to detect a miri environment is with MIRI_SYSROOT.
942+ // https://github.com/rust-lang/miri/pull/2398#issuecomment-1190747685
943+ if std:: env:: var_os ( "MIRI_SYSROOT" ) . is_some ( ) {
944+ NextestConfig :: DEFAULT_MIRI_PROFILE
945+ } else {
946+ NextestConfig :: DEFAULT_PROFILE
947+ }
948+ } ) ;
940949 let profile = config
941- . profile ( profile_name. unwrap_or ( NextestConfig :: DEFAULT_PROFILE ) )
950+ . profile ( profile_name)
942951 . map_err ( ExpectedError :: profile_not_found) ?;
943952 let store_dir = profile. store_dir ( ) ;
944953 std:: fs:: create_dir_all ( & store_dir) . map_err ( |err| ExpectedError :: StoreDirCreateError {
Original file line number Diff line number Diff line change @@ -84,3 +84,8 @@ leak-timeout = "100ms"
8484# reports across different test runs, it may be useful to provide separate names
8585# for each report.
8686report-name = " nextest-run"
87+
88+ # This profile is activated if MIRI_SYSROOT is set.
89+ [profile .default-miri ]
90+ # Miri tests take up a lot of memory, so only run 1 test at a time by default.
91+ test-threads = 1
Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ impl NextestConfig {
4848 /// The name of the default profile.
4949 pub const DEFAULT_PROFILE : & ' static str = "default" ;
5050
51+ /// The name of the default profile used for miri.
52+ pub const DEFAULT_MIRI_PROFILE : & ' static str = "default-miri" ;
53+
5154 /// Reads the nextest config from the given file, or if not specified from `.config/nextest.toml`
5255 /// in the workspace root.
5356 ///
You can’t perform that action at this time.
0 commit comments