Skip to content

Commit b74654f

Browse files
committed
Bump UI test dependency
1 parent 284b59c commit b74654f

File tree

3 files changed

+43
-84
lines changed

3 files changed

+43
-84
lines changed

Cargo.lock

Lines changed: 5 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ libc = "0.2"
4040

4141
[dev-dependencies]
4242
colored = "2"
43-
ui_test = "0.1"
43+
ui_test = "0.2"
4444
# Features chosen to match those required by env_logger, to avoid rebuilds
4545
regex = { version = "1.5.5", default-features = false, features = ["perf", "std"] }
4646
lazy_static = "1.4.0"

tests/compiletest.rs

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use colored::*;
22
use regex::Regex;
33
use std::path::{Path, PathBuf};
4-
use std::{env, ffi::OsString, process::Command};
4+
use std::{env, process::Command};
55
use ui_test::{color_eyre::Result, Config, DependencyBuilder, Mode, OutputConflictHandling};
66

77
fn miri_path() -> PathBuf {
@@ -43,30 +43,40 @@ fn run_tests(
4343
target: Option<String>,
4444
with_dependencies: bool,
4545
) -> Result<()> {
46+
let mut config = Config {
47+
target,
48+
stderr_filters: STDERR.clone(),
49+
stdout_filters: STDOUT.clone(),
50+
root_dir: PathBuf::from(path),
51+
mode,
52+
program: miri_path(),
53+
quiet: false,
54+
..Config::default()
55+
};
56+
4657
let in_rustc_test_suite = option_env!("RUSTC_STAGE").is_some();
4758

4859
// Add some flags we always want.
49-
let mut flags: Vec<OsString> = Vec::new();
50-
flags.push("--edition".into());
51-
flags.push("2018".into());
60+
config.args.push("--edition".into());
61+
config.args.push("2018".into());
5262
if in_rustc_test_suite {
5363
// Less aggressive warnings to make the rustc toolstate management less painful.
5464
// (We often get warnings when e.g. a feature gets stabilized or some lint gets added/improved.)
55-
flags.push("-Astable-features".into());
56-
flags.push("-Aunused".into());
65+
config.args.push("-Astable-features".into());
66+
config.args.push("-Aunused".into());
5767
} else {
58-
flags.push("-Dwarnings".into());
59-
flags.push("-Dunused".into());
68+
config.args.push("-Dwarnings".into());
69+
config.args.push("-Dunused".into());
6070
}
6171
if let Ok(extra_flags) = env::var("MIRIFLAGS") {
6272
for flag in extra_flags.split_whitespace() {
63-
flags.push(flag.into());
73+
config.args.push(flag.into());
6474
}
6575
}
66-
flags.push("-Zui-testing".into());
67-
if let Some(target) = &target {
68-
flags.push("--target".into());
69-
flags.push(target.into());
76+
config.args.push("-Zui-testing".into());
77+
if let Some(target) = &config.target {
78+
config.args.push("--target".into());
79+
config.args.push(target.into());
7080
}
7181

7282
// If we're on linux, and we're testing the extern-so functionality,
@@ -76,45 +86,35 @@ fn run_tests(
7686
let so_file_path = build_so_for_c_ffi_tests();
7787
let mut flag = std::ffi::OsString::from("-Zmiri-extern-so-file=");
7888
flag.push(so_file_path.into_os_string());
79-
flags.push(flag);
89+
config.args.push(flag);
8090
}
8191

8292
let skip_ui_checks = env::var_os("MIRI_SKIP_UI_CHECKS").is_some();
8393

84-
let output_conflict_handling = match (env::var_os("MIRI_BLESS").is_some(), skip_ui_checks) {
94+
config.output_conflict_handling = match (env::var_os("MIRI_BLESS").is_some(), skip_ui_checks) {
8595
(false, false) => OutputConflictHandling::Error,
8696
(true, false) => OutputConflictHandling::Bless,
8797
(false, true) => OutputConflictHandling::Ignore,
8898
(true, true) => panic!("cannot use MIRI_BLESS and MIRI_SKIP_UI_CHECKS at the same time"),
8999
};
90100

91-
// Pass on all unknown arguments as filters.
92-
let mut quiet = false;
93-
let path_filter = std::env::args().skip(1).filter(|arg| {
101+
// Handle command-line arguments.
102+
config.path_filter.extend(std::env::args().skip(1).filter(|arg| {
94103
match &**arg {
95104
"--quiet" => {
96-
quiet = true;
105+
config.quiet = true;
97106
false
98107
}
99108
_ => true,
100109
}
101-
});
110+
}));
102111

103112
let use_std = env::var_os("MIRI_NO_STD").is_none();
104113

105-
let config = Config {
106-
args: flags,
107-
target,
108-
stderr_filters: STDERR.clone(),
109-
stdout_filters: STDOUT.clone(),
110-
root_dir: PathBuf::from(path),
111-
mode,
112-
path_filter: path_filter.collect(),
113-
program: miri_path(),
114-
output_conflict_handling,
115-
dependencies_crate_manifest_path: (with_dependencies && use_std)
116-
.then(|| Path::new("test_dependencies").join("Cargo.toml")),
117-
dependency_builder: Some(DependencyBuilder {
114+
if with_dependencies && use_std {
115+
config.dependencies_crate_manifest_path =
116+
Some(Path::new("test_dependencies").join("Cargo.toml"));
117+
config.dependency_builder = Some(DependencyBuilder {
118118
program: std::env::var_os("CARGO").unwrap().into(),
119119
args: vec![
120120
"run".into(),
@@ -124,9 +124,8 @@ fn run_tests(
124124
"miri".into(),
125125
],
126126
envs: vec![],
127-
}),
128-
quiet,
129-
};
127+
});
128+
}
130129
ui_test::run_tests(config)
131130
}
132131

@@ -214,10 +213,10 @@ fn main() -> Result<()> {
214213
ui(Mode::Pass, "tests/pass", WithoutDependencies)?;
215214
ui(Mode::Pass, "tests/pass-dep", WithDependencies)?;
216215
ui(Mode::Panic, "tests/panic", WithDependencies)?;
217-
ui(Mode::Fail, "tests/fail", WithDependencies)?;
216+
ui(Mode::Fail { require_patterns: true }, "tests/fail", WithDependencies)?;
218217
if cfg!(target_os = "linux") {
219218
ui(Mode::Pass, "tests/extern-so/pass", WithoutDependencies)?;
220-
ui(Mode::Fail, "tests/extern-so/fail", WithDependencies)?;
219+
ui(Mode::Fail { require_patterns: true }, "tests/extern-so/fail", WithDependencies)?;
221220
}
222221

223222
Ok(())

0 commit comments

Comments
 (0)