@@ -55,6 +55,7 @@ impl TestMode {
55
55
56
56
// Note that coverage tests use the same test files for multiple test modes.
57
57
string_enum ! {
58
+ no_from_str,
58
59
#[ derive( Clone , Copy , PartialEq , Debug ) ]
59
60
pub enum TestSuite {
60
61
Assembly => "assembly" ,
@@ -79,6 +80,42 @@ string_enum! {
79
80
}
80
81
}
81
82
83
+ impl :: std:: str:: FromStr for TestSuite {
84
+ type Err = String ;
85
+
86
+ fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
87
+ Ok ( match s {
88
+ "codegen-units" => Self :: CodegenUnits ,
89
+ "coverage" => Self :: Coverage ,
90
+ "coverage-run-rustdoc" => Self :: CoverageRunRustdoc ,
91
+ "crashes" => Self :: Crashes ,
92
+ "debuginfo" => Self :: Debuginfo ,
93
+ "incremental" => Self :: Incremental ,
94
+ "mir-opt" => Self :: MirOpt ,
95
+ "pretty" => Self :: Pretty ,
96
+ "run-make" => Self :: RunMake ,
97
+ "rustdoc" => Self :: Rustdoc ,
98
+ "rustdoc-gui" => Self :: RustdocGui ,
99
+ "rustdoc-js" => Self :: RustdocJs ,
100
+ "rustdoc-js-std" => Self :: RustdocJsStd ,
101
+ "rustdoc-json" => Self :: RustdocJson ,
102
+ "rustdoc-ui" => Self :: RustdocUi ,
103
+ "ui" => Self :: Ui ,
104
+ "ui-fulldeps" => Self :: UiFullDeps ,
105
+ s => {
106
+ if let Some ( ( test_suite @ ( "assembly" | "codegen" ) , codegen_backend) ) =
107
+ s. split_once ( '-' )
108
+ && CodegenBackend :: try_from ( codegen_backend) . is_ok ( )
109
+ {
110
+ if test_suite == "assembly" { Self :: Assembly } else { Self :: Codegen }
111
+ } else {
112
+ return Err ( format ! ( "unknown `TestSuite` variant: `{s}`" ) ) ;
113
+ }
114
+ }
115
+ } )
116
+ }
117
+ }
118
+
82
119
string_enum ! {
83
120
#[ derive( Clone , Copy , PartialEq , Debug , Hash ) ]
84
121
pub enum PassMode {
0 commit comments