Skip to content

Commit 930d89e

Browse files
committed
compiletest: support --filter-mode in Config.
1 parent 9097ff4 commit 930d89e

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/tools/compiletest/src/common.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,33 @@ impl fmt::Display for Mode {
9999
}
100100
}
101101

102+
/// Mode with extra forms.
103+
/// Used for `--filter-mode` to allow `compile-pass` to be used.
104+
#[derive(Clone, Copy, PartialEq, Debug)]
105+
pub enum ExtraMode {
106+
Mode(Mode),
107+
CompilePass,
108+
}
109+
110+
impl FromStr for ExtraMode {
111+
type Err = ();
112+
fn from_str(s: &str) -> Result<Self, ()> {
113+
match s {
114+
"compile-pass" => Ok(ExtraMode::CompilePass),
115+
s => Mode::from_str(s).map(ExtraMode::Mode),
116+
}
117+
}
118+
}
119+
120+
impl fmt::Display for ExtraMode {
121+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
122+
match *self {
123+
ExtraMode::CompilePass => fmt::Display::fmt("compile-pass", f),
124+
ExtraMode::Mode(mode) => mode.fmt(f),
125+
}
126+
}
127+
}
128+
102129
#[derive(Clone, Debug, PartialEq)]
103130
pub enum CompareMode {
104131
Nll,
@@ -184,6 +211,9 @@ pub struct Config {
184211
/// Exactly match the filter, rather than a substring
185212
pub filter_exact: bool,
186213

214+
/// Only run tests that match any of these modes.
215+
pub filter_mode: Option<Vec<ExtraMode>>,
216+
187217
/// Write out a parseable log of tests that were run
188218
pub logfile: Option<PathBuf>,
189219

0 commit comments

Comments
 (0)