run test suite also against libstd with full MIR
This commit is contained in:
parent
6619ed89ba
commit
44a45f7c34
17
.travis.yml
17
.travis.yml
@ -6,16 +6,29 @@ before_script:
|
||||
- rustup target add i686-unknown-linux-gnu
|
||||
- rustup target add i686-pc-windows-gnu
|
||||
- rustup target add i686-pc-windows-msvc
|
||||
- rustup component add rust-src
|
||||
- chmod +x -R ~/.rustup/toolchains/*/lib/rustlib/src/rust/src/jemalloc/include/jemalloc/
|
||||
- cargo install xargo
|
||||
- export RUST_SYSROOT=$HOME/rust
|
||||
script:
|
||||
- |
|
||||
export RUST_SYSROOT=$HOME/rust &&
|
||||
# Test plain miri
|
||||
cargo build &&
|
||||
cargo test &&
|
||||
cargo install &&
|
||||
cargo install
|
||||
- |
|
||||
# Test cargo miri
|
||||
cd cargo-miri-test &&
|
||||
cargo miri &&
|
||||
cargo miri test &&
|
||||
cd ..
|
||||
- |
|
||||
# get ourselves a MIR-ful libstd
|
||||
cd xargo &&
|
||||
RUSTFLAGS='-Zalways-encode-mir' xargo build &&
|
||||
cd .. &&
|
||||
# and run the tests with it
|
||||
MIRI_SYSROOT=~/.xargo/HOST cargo test
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
|
@ -71,7 +71,7 @@ RUSTFLAGS='-Zalways-encode-mir' xargo build
|
||||
Now you can run miri against the libstd compiled by xargo:
|
||||
|
||||
```sh
|
||||
cargo run --bin miri -- --sysroot ~/.xargo/HOST tests/run-pass/vecs.rs
|
||||
MIRI_SYSROOT=~/.xargo/HOST cargo run --bin miri tests/run-pass/vecs.rs
|
||||
```
|
||||
|
||||
Notice that you will have to re-run the last step of the preparations above when
|
||||
|
@ -175,6 +175,10 @@ fn init_logger() {
|
||||
}
|
||||
|
||||
fn find_sysroot() -> String {
|
||||
if let Ok(sysroot) = std::env::var("MIRI_SYSROOT") {
|
||||
return sysroot;
|
||||
}
|
||||
|
||||
// Taken from https://github.com/Manishearth/rust-clippy/pull/911.
|
||||
let home = option_env!("RUSTUP_HOME").or(option_env!("MULTIRUST_HOME"));
|
||||
let toolchain = option_env!("RUSTUP_TOOLCHAIN").or(option_env!("MULTIRUST_TOOLCHAIN"));
|
||||
|
@ -1,24 +1,18 @@
|
||||
#![feature(custom_attribute, attr_literals)]
|
||||
#![miri(stack_limit=16)]
|
||||
|
||||
//error-pattern: reached the configured maximum number of stack frames
|
||||
|
||||
fn bar() {
|
||||
foo();
|
||||
}
|
||||
|
||||
fn foo() {
|
||||
cake(); //~ ERROR reached the configured maximum number of stack frames
|
||||
cake();
|
||||
}
|
||||
|
||||
fn cake() {
|
||||
flubber(3);
|
||||
}
|
||||
|
||||
fn flubber(i: u32) {
|
||||
if i > 0 {
|
||||
flubber(i-1);
|
||||
} else {
|
||||
bar();
|
||||
}
|
||||
bar();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -65,14 +65,16 @@ fn for_all_targets<F: FnMut(String)>(sysroot: &Path, mut f: F) {
|
||||
|
||||
#[test]
|
||||
fn compile_test() {
|
||||
let sysroot = std::process::Command::new("rustc")
|
||||
.arg("--print")
|
||||
.arg("sysroot")
|
||||
.output()
|
||||
.expect("rustc not found")
|
||||
.stdout;
|
||||
let sysroot = std::str::from_utf8(&sysroot).expect("sysroot is not utf8").trim();
|
||||
let sysroot = &Path::new(&sysroot);
|
||||
let sysroot = std::env::var("MIRI_SYSROOT").unwrap_or_else(|_| {
|
||||
let sysroot = std::process::Command::new("rustc")
|
||||
.arg("--print")
|
||||
.arg("sysroot")
|
||||
.output()
|
||||
.expect("rustc not found")
|
||||
.stdout;
|
||||
String::from_utf8(sysroot).expect("sysroot is not utf8")
|
||||
});
|
||||
let sysroot = &Path::new(sysroot.trim());
|
||||
let host = std::process::Command::new("rustc")
|
||||
.arg("-vV")
|
||||
.output()
|
||||
|
Loading…
x
Reference in New Issue
Block a user