Skip to content

Commit ef29e6a

Browse files
committed
Add fullmir tests
1 parent a82fe9a commit ef29e6a

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

.travis.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ before_script:
1010
- cargo install xargo
1111
- export RUST_SYSROOT=$HOME/rust
1212
script:
13+
- |
14+
# get ourselves a MIR-ful libstd
15+
cd xargo &&
16+
RUSTFLAGS='-Zalways-encode-mir' xargo build &&
17+
cd ..
1318
- |
1419
# Test plain miri
1520
cargo build &&
@@ -22,11 +27,7 @@ script:
2227
cargo miri test &&
2328
cd ..
2429
- |
25-
# get ourselves a MIR-ful libstd
26-
cd xargo &&
27-
RUSTFLAGS='-Zalways-encode-mir' xargo build &&
28-
cd .. &&
29-
# and run the tests with it
30+
# and run all tests with full mir
3031
MIRI_SYSROOT=~/.xargo/HOST cargo test
3132
notifications:
3233
email:

tests/compiletest.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,17 @@ fn run_pass() {
2727
compiletest::run_tests(&config);
2828
}
2929

30-
fn miri_pass(path: &str, target: &str, host: &str) {
30+
fn miri_pass(path: &str, target: &str, host: &str, fullmir: bool) {
3131
let mut config = compiletest::default_config();
3232
config.mode = "mir-opt".parse().expect("Invalid mode");
3333
config.src_base = PathBuf::from(path);
3434
config.target = target.to_owned();
3535
config.host = host.to_owned();
3636
config.rustc_path = PathBuf::from("target/debug/miri");
37+
if fullmir {
38+
let sysroot = Path::new(&std::env::var("HOME").unwrap()).join(".xargo").join("HOST");
39+
config.target_rustcflags = Some(format!("--sysroot {}", sysroot.to_str().unwrap()));
40+
}
3741
// don't actually execute the final binary, it might be for other targets and we only care
3842
// about running miri, not the binary.
3943
config.runtool = Some("echo \"\" || ".to_owned());
@@ -116,6 +120,7 @@ fn compile_test() {
116120
let sysroot = libs.join("rustlib").join(&host).join("lib");
117121
let paths = std::env::join_paths(&[libs, sysroot]).unwrap();
118122
cmd.env(compiletest::procsrv::dylib_env_var(), paths);
123+
cmd.env("MIRI_SYSROOT", Path::new(&std::env::var("HOME").unwrap()).join(".xargo").join("HOST"));
119124

120125
match cmd.output() {
121126
Ok(ref output) if output.status.success() => {
@@ -197,8 +202,9 @@ fn compile_test() {
197202
} else {
198203
run_pass();
199204
for_all_targets(sysroot, |target| {
200-
miri_pass("tests/run-pass", &target, host);
205+
miri_pass("tests/run-pass", &target, host, false);
201206
});
207+
miri_pass("tests/run-pass-fullmir", host, host, true);
202208
compile_fail(sysroot);
203209
}
204210
}

0 commit comments

Comments
 (0)