commit
3a93831c5d
@ -1 +1 @@
|
||||
nightly-2018-12-08
|
||||
nightly-2018-12-14
|
||||
|
@ -3,7 +3,7 @@
|
||||
extern crate cargo_metadata;
|
||||
|
||||
use std::path::{PathBuf, Path};
|
||||
use std::io::{self, Write};
|
||||
use std::io::{self, Write, BufRead};
|
||||
use std::process::Command;
|
||||
use std::fs::{self, File};
|
||||
|
||||
@ -114,6 +114,36 @@ fn list_targets() -> impl Iterator<Item=cargo_metadata::Target> {
|
||||
package.targets.into_iter()
|
||||
}
|
||||
|
||||
fn xargo_version() -> Option<(u32, u32, u32)> {
|
||||
let out = Command::new("xargo").arg("--version").output().ok()?;
|
||||
if !out.status.success() {
|
||||
return None;
|
||||
}
|
||||
// Parse output. The first line looks like "xargo 0.3.12 (b004f1c 2018-12-13)".
|
||||
let line = out.stderr.lines().nth(0)
|
||||
.expect("malformed `xargo --version` output: not at least one line")
|
||||
.expect("malformed `xargo --version` output: error reading first line");
|
||||
let version = line.split(' ').nth(1)
|
||||
.expect("malformed `xargo --version` output: not at least two words");
|
||||
let mut version_pieces = version.split('.');
|
||||
let major = version_pieces.next()
|
||||
.expect("malformed `xargo --version` output: not a major version piece")
|
||||
.parse()
|
||||
.expect("malformed `xargo --version` output: major version is not an integer");
|
||||
let minor = version_pieces.next()
|
||||
.expect("malformed `xargo --version` output: not a minor version piece")
|
||||
.parse()
|
||||
.expect("malformed `xargo --version` output: minor version is not an integer");
|
||||
let patch = version_pieces.next()
|
||||
.expect("malformed `xargo --version` output: not a patch version piece")
|
||||
.parse()
|
||||
.expect("malformed `xargo --version` output: patch version is not an integer");
|
||||
if !version_pieces.next().is_none() {
|
||||
panic!("malformed `xargo --version` output: more than three pieces in version");
|
||||
}
|
||||
Some((major, minor, patch))
|
||||
}
|
||||
|
||||
fn ask(question: &str) {
|
||||
let mut buf = String::new();
|
||||
print!("{} [Y/n] ", question);
|
||||
@ -134,14 +164,15 @@ fn setup(ask_user: bool) {
|
||||
}
|
||||
|
||||
// First, we need xargo
|
||||
if Command::new("xargo").arg("--version").output().is_err()
|
||||
{
|
||||
let xargo = xargo_version();
|
||||
if xargo.map_or(true, |v| v < (0, 3, 13)) {
|
||||
if ask_user {
|
||||
ask("It seems you do not have xargo installed. I will run `cargo install xargo`. Proceed?");
|
||||
ask("It seems you do not have a recent enough xargo installed. I will run `cargo install xargo -f`. Proceed?");
|
||||
} else {
|
||||
println!("Installing xargo: `cargo install xargo`");
|
||||
println!("Installing xargo: `cargo install xargo -f`");
|
||||
}
|
||||
if !Command::new("cargo").args(&["install", "xargo"]).status().unwrap().success() {
|
||||
// FIXME: Go back to using releases, once a 0.3.13 got released.
|
||||
if !Command::new("cargo").args(&["install", "xargo", "-f", "--git", "https://github.com/japaric/xargo"]).status().unwrap().success() {
|
||||
show_error(format!("Failed to install xargo"));
|
||||
}
|
||||
}
|
||||
|
@ -77,9 +77,7 @@ fn miri_pass(path: &str, target: &str, opt: bool) {
|
||||
flags.push("-Dwarnings -Dunused".to_owned()); // overwrite the -Aunused in compiletest-rs
|
||||
flags.push("--edition 2018".to_owned());
|
||||
if opt {
|
||||
// FIXME: We use opt level 1 because MIR inlining defeats the validation
|
||||
// whitelist.
|
||||
flags.push("-Zmir-opt-level=1".to_owned());
|
||||
flags.push("-Zmir-opt-level=3".to_owned());
|
||||
}
|
||||
|
||||
let mut config = mk_config("ui");
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
//ignore-windows: Uses POSIX APIs
|
||||
|
||||
#![feature(libc)]
|
||||
#![feature(rustc_private)]
|
||||
#![allow(unused_extern_crates)] // rustc bug https://github.com/rust-lang/rust/issues/56098
|
||||
|
||||
extern crate libc;
|
||||
|
@ -10,12 +10,12 @@ fn h(i: i32, j: i32) -> i32 {
|
||||
j * i * 7
|
||||
}
|
||||
|
||||
fn return_fn_ptr() -> fn() -> i32 {
|
||||
fn return_fn_ptr(f: fn() -> i32) -> fn() -> i32 {
|
||||
f
|
||||
}
|
||||
|
||||
fn call_fn_ptr() -> i32 {
|
||||
return_fn_ptr()()
|
||||
return_fn_ptr(f)()
|
||||
}
|
||||
|
||||
fn indirect<F: Fn() -> i32>(f: F) -> i32 { f() }
|
||||
@ -41,6 +41,7 @@ fn main() {
|
||||
assert_eq!(indirect3(h), 210);
|
||||
assert_eq!(indirect_mut3(h), 210);
|
||||
assert_eq!(indirect_once3(h), 210);
|
||||
assert!(return_fn_ptr() == f);
|
||||
assert!(return_fn_ptr() as unsafe fn() -> i32 == f as fn() -> i32 as unsafe fn() -> i32);
|
||||
let g = f as fn() -> i32;
|
||||
assert!(return_fn_ptr(g) == g);
|
||||
assert!(return_fn_ptr(g) as unsafe fn() -> i32 == g as fn() -> i32 as unsafe fn() -> i32);
|
||||
}
|
||||
|
@ -60,7 +60,10 @@ fn main() {
|
||||
let a = [0,1,2];
|
||||
let square_local : fn(u32) -> u32 = square;
|
||||
let (f,g) = fn_coercions(&square_local);
|
||||
assert_eq!(f as *const (), square as *const());
|
||||
// cannot use `square as *const ()` because we can't know whether the compiler duplicates
|
||||
// functions, so two function pointers are only equal if they result from the same function
|
||||
// to function pointer cast
|
||||
assert_eq!(f as *const (), square_local as *const());
|
||||
assert_eq!(g(4), 16);
|
||||
assert_eq!(identity_coercion(g)(5), 25);
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
//ignore-windows: Uses POSIX APIs
|
||||
|
||||
#![feature(libc)]
|
||||
#![feature(rustc_private)]
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
//ignore-windows: Uses POSIX APIs
|
||||
|
||||
#![feature(libc)]
|
||||
#![feature(rustc_private)]
|
||||
extern crate libc;
|
||||
|
||||
use std::mem;
|
||||
|
@ -1,6 +1,3 @@
|
||||
// FIXME: Validation disabled until https://github.com/rust-lang/rust/pull/56161 lands
|
||||
// compile-flags: -Zmiri-disable-validation
|
||||
|
||||
use std::collections::VecDeque;
|
||||
|
||||
fn main() {
|
||||
|
10
travis.sh
10
travis.sh
@ -11,20 +11,20 @@ else
|
||||
fi
|
||||
|
||||
echo "Build and install miri"
|
||||
cargo build --release --all-features --all-targets &&
|
||||
cargo build --release --all-features --all-targets
|
||||
cargo install --all-features --force --path .
|
||||
echo
|
||||
|
||||
echo "Get ourselves a MIR-full libstd for the host and a foreign architecture"
|
||||
cargo miri setup &&
|
||||
cargo miri setup
|
||||
cargo miri setup --target "$FOREIGN_TARGET"
|
||||
echo
|
||||
|
||||
echo "Test miri with full MIR, on the host and other architectures"
|
||||
MIRI_SYSROOT=$MIRI_SYSROOT_BASE/HOST cargo test --release --all-features &&
|
||||
MIRI_SYSROOT=$MIRI_SYSROOT_BASE MIRI_TARGET=$FOREIGN_TARGET cargo test --release --all-features
|
||||
MIRI_SYSROOT="$MIRI_SYSROOT_BASE"/HOST cargo test --release --all-features
|
||||
MIRI_SYSROOT="$MIRI_SYSROOT_BASE" MIRI_TARGET="$FOREIGN_TARGET" cargo test --release --all-features
|
||||
echo
|
||||
|
||||
echo "Test cargo integration"
|
||||
(cd test-cargo-miri && MIRI_SYSROOT=$MIRI_SYSROOT_BASE/HOST ./run-test.py)
|
||||
(cd test-cargo-miri && MIRI_SYSROOT="$MIRI_SYSROOT_BASE"/HOST ./run-test.py)
|
||||
echo
|
||||
|
Loading…
Reference in New Issue
Block a user