提交 44a45f7c 编写于 作者: R Ralf Jung

run test suite also against libstd with full MIR

上级 6619ed89
......@@ -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"));
......
#![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()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册