Skip to content

Commit

Permalink
Add windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Schneider committed Sep 16, 2017
1 parent 605c82b commit cf92528
Show file tree
Hide file tree
Showing 20 changed files with 69 additions and 6 deletions.
35 changes: 35 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
environment:
global:
PROJECT_NAME: miri
matrix:
- TARGET: i686-pc-windows-msvc
MSYS2_BITS: 32
- TARGET: x86_64-pc-windows-msvc
MSYS2_BITS: 64

install:
- set PATH=C:\Program Files\Git\mingw64\bin;%PATH%
- curl -sSf -o rustup-init.exe https://win.rustup.rs/
- rustup-init.exe -y --default-host %TARGET% --default-toolchain nightly
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin;C:\Users\appveyor\.rustup\toolchains\nightly-%TARGET%\bin
- if defined MSYS2_BITS set PATH=%PATH%;C:\msys64\mingw%MSYS2_BITS%\bin
- rustc -V
- cargo -V
- rustup component add rust-src
- cargo install --git https://github.com/japaric/xargo.git
- cd xargo
- set RUSTFLAGS=-Zalways-encode-mir -Zmir-emit-validate=1
- xargo build
- set RUSTFLAGS=
- cd ..

build: false

test_script:
- set RUST_BACKTRACE=1
- cargo build
- cargo test

notifications:
- provider: Email
on_build_success: false
6 changes: 6 additions & 0 deletions miri/fn_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,12 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
let bool = self.tcx.types.bool;
self.write_primval(dest, PrimVal::from_bool(false), bool)?;
}
"std::sys::imp::c::::AddVectoredExceptionHandler" |
"std::sys::imp::c::::SetThreadStackGuarantee" => {
let usize = self.tcx.types.usize;
// any non zero value works for the stdlib. This is just used for stackoverflows anyway
self.write_primval(dest, PrimVal::Bytes(1), usize)?;
},
_ => return err!(NoMirFor(path)),
}

Expand Down
9 changes: 5 additions & 4 deletions tests/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, fullmir: b
// skip fullmir on nonhost
return;
}
let sysroot = Path::new(&std::env::var("HOME").unwrap())
let sysroot = std::env::home_dir().unwrap()
.join(".xargo")
.join("HOST");
config.target_rustcflags = Some(format!("--sysroot {}", sysroot.to_str().unwrap()));
Expand Down Expand Up @@ -110,9 +110,10 @@ fn miri_pass(path: &str, target: &str, host: &str, fullmir: bool, opt: bool) {
// skip fullmir on nonhost
return;
}
let sysroot = Path::new(&std::env::var("HOME").unwrap())
let sysroot = std::env::home_dir().unwrap()
.join(".xargo")
.join("HOST");

flags.push(format!("--sysroot {}", sysroot.to_str().unwrap()));
}
if opt {
Expand Down Expand Up @@ -192,9 +193,9 @@ fn run_pass_miri_noopt() {
}

#[test]
#[ignore] // FIXME: Disabled for now, as the optimizer is pretty broken and crashes...
fn run_pass_miri_opt() {
// FIXME: Disabled for now, as the optimizer is pretty broken and crashes...
//run_pass_miri(true);
run_pass_miri(true);
}

#[test]
Expand Down
1 change: 1 addition & 0 deletions tests/run-pass-fullmir/catch.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//ignore-msvc
use std::panic::{catch_unwind, AssertUnwindSafe};

fn main() {
Expand Down
3 changes: 1 addition & 2 deletions tests/run-pass-fullmir/foreign-fn-linkname.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.



//ignore-msvc
#![feature(libc)]

extern crate libc;
Expand Down
1 change: 1 addition & 0 deletions tests/run-pass-fullmir/format.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//ignore-msvc
fn main() {
println!("Hello {}", 13);
}
1 change: 1 addition & 0 deletions tests/run-pass-fullmir/from_utf8.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//ignore-msvc
fn main() {
let _ = ::std::str::from_utf8(b"a");
}
1 change: 1 addition & 0 deletions tests/run-pass-fullmir/hashmap.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//ignore-msvc
use std::collections::{self, HashMap};
use std::hash::BuildHasherDefault;

Expand Down
1 change: 1 addition & 0 deletions tests/run-pass-fullmir/heap.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//ignore-msvc
#![feature(box_syntax)]

fn make_box() -> Box<(i16, i16)> {
Expand Down
1 change: 1 addition & 0 deletions tests/run-pass-fullmir/hello.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//ignore-msvc
fn main() {
println!("Hello, world!");
}
1 change: 1 addition & 0 deletions tests/run-pass-fullmir/integer-ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// FIXME: remove -Zmir-opt-level once https://github.com/rust-lang/rust/issues/43359 is fixed
// compile-flags: -Zmir-opt-level=0

//ignore-msvc
use std::i32;

pub fn main() {
Expand Down
1 change: 1 addition & 0 deletions tests/run-pass-fullmir/issue-15080.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//ignore-msvc

#![feature(slice_patterns)]

Expand Down
1 change: 1 addition & 0 deletions tests/run-pass-fullmir/issue-3794.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//ignore-msvc
#![feature(box_syntax)]

trait T {
Expand Down
2 changes: 2 additions & 0 deletions tests/run-pass-fullmir/loop-break-value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//ignore-msvc

#![feature(never_type)]
#![allow(unreachable_code)]

Expand Down
2 changes: 2 additions & 0 deletions tests/run-pass-fullmir/move-arg-2-unique.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//ignore-msvc

#![allow(unused_features, unused_variables)]
#![feature(box_syntax)]

Expand Down
2 changes: 2 additions & 0 deletions tests/run-pass-fullmir/regions-mock-trans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// FIXME: We handle uninitialzied storage here, which currently makes validation fail.
// compile-flags: -Zmir-emit-validate=0

//ignore-msvc

#![feature(libc)]

#![allow(dead_code)]
Expand Down
2 changes: 2 additions & 0 deletions tests/run-pass-fullmir/u128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//ignore-msvc

#![feature(i128_type)]

fn b<T>(t: T) -> T { t }
Expand Down
2 changes: 2 additions & 0 deletions tests/run-pass-fullmir/unsized-tuple-impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//ignore-msvc

#![feature(unsized_tuple_coercion)]
use std::mem;

Expand Down
2 changes: 2 additions & 0 deletions tests/run-pass-fullmir/vecs.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//ignore-msvc

fn make_vec() -> Vec<u8> {
let mut v = Vec::with_capacity(4);
v.push(1);
Expand Down
1 change: 1 addition & 0 deletions tests/run-pass/issue-17877.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//ignore-msvc

#![feature(slice_patterns)]

Expand Down

0 comments on commit cf92528

Please sign in to comment.