Skip to content

Commit 9386f05

Browse files
authored
Merge pull request rust-lang#325 from RalfJung/test
Update compiletest
2 parents ff75da2 + 8dff161 commit 9386f05

File tree

3 files changed

+8
-20
lines changed

3 files changed

+8
-20
lines changed

Cargo.lock

Lines changed: 4 additions & 4 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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,15 @@ build = "build.rs"
1010
[[bin]]
1111
doc = false
1212
name = "miri"
13-
test = false
1413
path = "miri/bin/miri.rs"
1514

1615
[[bin]]
1716
doc = false
1817
name = "cargo-miri"
19-
test = false
2018
path = "miri/bin/cargo-miri.rs"
2119
required-features = ["cargo_miri"]
2220

2321
[lib]
24-
test = false
2522
path = "miri/lib.rs"
2623

2724
[dependencies]
@@ -36,8 +33,7 @@ rustc_miri = { path = "src/librustc_mir" }
3633
cargo_miri = ["cargo_metadata"]
3734

3835
[dev-dependencies]
39-
compiletest_rs = "0.2.6"
40-
tempdir = "0.3"
36+
compiletest_rs = { version = "0.2.10", features = ["tmp"] }
4137

4238
[workspace]
4339
exclude = ["xargo", "cargo-miri-test", "rustc_tests"]

tests/compiletest.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
#![feature(slice_concat_ext)]
22

33
extern crate compiletest_rs as compiletest;
4-
extern crate tempdir;
54

65
use std::slice::SliceConcatExt;
76
use std::path::{PathBuf, Path};
87
use std::io::Write;
9-
use tempdir::TempDir;
108

119
macro_rules! eprintln {
1210
($($arg:tt)*) => {
@@ -37,10 +35,8 @@ fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, fullmir: b
3735
path,
3836
target
3937
);
40-
let build_dir = TempDir::new("miri-tests").unwrap();
41-
let mut config = compiletest::Config::default();
38+
let mut config = compiletest::Config::default().tempdir();
4239
config.mode = "compile-fail".parse().expect("Invalid mode");
43-
config.build_base = build_dir.path().to_owned();
4440
config.rustc_path = miri_path();
4541
let mut flags = Vec::new();
4642
if rustc_test_suite().is_some() {
@@ -70,10 +66,8 @@ fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, fullmir: b
7066

7167
fn run_pass(path: &str) {
7268
eprintln!("## Running run-pass tests in {} against rustc", path);
73-
let build_dir = TempDir::new("miri-tests").unwrap();
74-
let mut config = compiletest::Config::default();
69+
let mut config = compiletest::Config::default().tempdir();
7570
config.mode = "run-pass".parse().expect("Invalid mode");
76-
config.build_base = build_dir.path().to_owned();
7771
config.src_base = PathBuf::from(path);
7872
if let Some(rustc_path) = rustc_test_suite() {
7973
config.rustc_path = rustc_path;
@@ -95,10 +89,8 @@ fn miri_pass(path: &str, target: &str, host: &str, fullmir: bool, opt: bool) {
9589
target,
9690
opt_str
9791
);
98-
let build_dir = TempDir::new("miri-tests").unwrap();
99-
let mut config = compiletest::Config::default();
92+
let mut config = compiletest::Config::default().tempdir();
10093
config.mode = "mir-opt".parse().expect("Invalid mode");
101-
config.build_base = build_dir.path().to_owned();
10294
config.src_base = PathBuf::from(path);
10395
config.target = target.to_owned();
10496
config.host = host.to_owned();

0 commit comments

Comments
 (0)