Skip to content

Commit bfee291

Browse files
committed
compiletest: add logic for keeping --filter-mode'ed tests.
1 parent 4507e06 commit bfee291

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/tools/compiletest/src/header.rs

+23-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::path::{Path, PathBuf};
66

77
use log::*;
88

9-
use crate::common::{self, CompareMode, Config, Mode};
9+
use crate::common::{self, CompareMode, Config, Mode, ExtraMode};
1010
use crate::util;
1111

1212
use crate::extract_gdb_version;
@@ -97,6 +97,12 @@ impl EarlyProps {
9797
let rustc_has_profiler_support = env::var_os("RUSTC_PROFILER_SUPPORT").is_some();
9898
let rustc_has_sanitizer_support = env::var_os("RUSTC_SANITIZER_SUPPORT").is_some();
9999

100+
if let Some(fm) = &config.filter_mode {
101+
if config.mode != Mode::Ui && !fm.contains(&ExtraMode::Mode(config.mode)) {
102+
props.ignore = Ignore::Ignore;
103+
}
104+
}
105+
100106
iter_header(testfile, None, &mut |ln| {
101107
// we should check if any only-<platform> exists and if it exists
102108
// and does not matches the current platform, skip the test
@@ -147,6 +153,22 @@ impl EarlyProps {
147153
props.ignore = props.ignore.no_lldb();
148154
}
149155

156+
// Apply `--filter-mode` for ui tests.
157+
if let (Some(fm), Mode::Ui) = (&config.filter_mode, config.mode) {
158+
let keep = fm.contains(&ExtraMode::Mode(Mode::Ui)) || {
159+
let run = config.parse_run_pass(ln);
160+
let compile = config.parse_compile_pass(ln);
161+
match (run, compile) {
162+
(true, _) => fm.contains(&ExtraMode::Mode(Mode::RunPass)),
163+
(_, true) => fm.contains(&ExtraMode::CompilePass),
164+
(_, _) => fm.contains(&ExtraMode::Mode(Mode::CompileFail)),
165+
}
166+
};
167+
if !keep {
168+
props.ignore = Ignore::Ignore;
169+
}
170+
}
171+
150172
if let Some(s) = config.parse_aux_build(ln) {
151173
props.aux.push(s);
152174
}

0 commit comments

Comments
 (0)