Skip to content

Commit

Permalink
Merge pull request #325 from RalfJung/test
Browse files Browse the repository at this point in the history
Update compiletest
  • Loading branch information
RalfJung committed Sep 4, 2017
2 parents ff75da2 + 8dff161 commit 9386f05
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 20 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,15 @@ build = "build.rs"
[[bin]]
doc = false
name = "miri"
test = false
path = "miri/bin/miri.rs"

[[bin]]
doc = false
name = "cargo-miri"
test = false
path = "miri/bin/cargo-miri.rs"
required-features = ["cargo_miri"]

[lib]
test = false
path = "miri/lib.rs"

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

[dev-dependencies]
compiletest_rs = "0.2.6"
tempdir = "0.3"
compiletest_rs = { version = "0.2.10", features = ["tmp"] }

[workspace]
exclude = ["xargo", "cargo-miri-test", "rustc_tests"]
14 changes: 3 additions & 11 deletions tests/compiletest.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#![feature(slice_concat_ext)]

extern crate compiletest_rs as compiletest;
extern crate tempdir;

use std::slice::SliceConcatExt;
use std::path::{PathBuf, Path};
use std::io::Write;
use tempdir::TempDir;

macro_rules! eprintln {
($($arg:tt)*) => {
Expand Down Expand Up @@ -37,10 +35,8 @@ fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, fullmir: b
path,
target
);
let build_dir = TempDir::new("miri-tests").unwrap();
let mut config = compiletest::Config::default();
let mut config = compiletest::Config::default().tempdir();
config.mode = "compile-fail".parse().expect("Invalid mode");
config.build_base = build_dir.path().to_owned();
config.rustc_path = miri_path();
let mut flags = Vec::new();
if rustc_test_suite().is_some() {
Expand Down Expand Up @@ -70,10 +66,8 @@ fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, fullmir: b

fn run_pass(path: &str) {
eprintln!("## Running run-pass tests in {} against rustc", path);
let build_dir = TempDir::new("miri-tests").unwrap();
let mut config = compiletest::Config::default();
let mut config = compiletest::Config::default().tempdir();
config.mode = "run-pass".parse().expect("Invalid mode");
config.build_base = build_dir.path().to_owned();
config.src_base = PathBuf::from(path);
if let Some(rustc_path) = rustc_test_suite() {
config.rustc_path = rustc_path;
Expand All @@ -95,10 +89,8 @@ fn miri_pass(path: &str, target: &str, host: &str, fullmir: bool, opt: bool) {
target,
opt_str
);
let build_dir = TempDir::new("miri-tests").unwrap();
let mut config = compiletest::Config::default();
let mut config = compiletest::Config::default().tempdir();
config.mode = "mir-opt".parse().expect("Invalid mode");
config.build_base = build_dir.path().to_owned();
config.src_base = PathBuf::from(path);
config.target = target.to_owned();
config.host = host.to_owned();
Expand Down

0 comments on commit 9386f05

Please sign in to comment.