Skip to content

Commit 8dff161

Browse files
committed
update compiletest; we do not need tempdir any more
1 parent df895cd commit 8dff161

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ rustc_miri = { path = "src/librustc_mir" }
3333
cargo_miri = ["cargo_metadata"]
3434

3535
[dev-dependencies]
36-
compiletest_rs = "0.2.6"
37-
tempdir = "0.3"
36+
compiletest_rs = { version = "0.2.10", features = ["tmp"] }
3837

3938
[workspace]
4039
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)