From cf925284269a1fbefbf1dfb53c1040c50d5be243 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Sat, 16 Sep 2017 13:32:38 +0200 Subject: [PATCH] Add windows support --- appveyor.yml | 35 +++++++++++++++++++ miri/fn_call.rs | 6 ++++ tests/compiletest.rs | 9 ++--- tests/run-pass-fullmir/catch.rs | 1 + tests/run-pass-fullmir/foreign-fn-linkname.rs | 3 +- tests/run-pass-fullmir/format.rs | 1 + tests/run-pass-fullmir/from_utf8.rs | 1 + tests/run-pass-fullmir/hashmap.rs | 1 + tests/run-pass-fullmir/heap.rs | 1 + tests/run-pass-fullmir/hello.rs | 1 + tests/run-pass-fullmir/integer-ops.rs | 1 + tests/run-pass-fullmir/issue-15080.rs | 1 + tests/run-pass-fullmir/issue-3794.rs | 1 + tests/run-pass-fullmir/loop-break-value.rs | 2 ++ tests/run-pass-fullmir/move-arg-2-unique.rs | 2 ++ tests/run-pass-fullmir/regions-mock-trans.rs | 2 ++ tests/run-pass-fullmir/u128.rs | 2 ++ tests/run-pass-fullmir/unsized-tuple-impls.rs | 2 ++ tests/run-pass-fullmir/vecs.rs | 2 ++ tests/run-pass/issue-17877.rs | 1 + 20 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000000..6a497193d7 --- /dev/null +++ b/appveyor.yml @@ -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 diff --git a/miri/fn_call.rs b/miri/fn_call.rs index 5285d02b4f..36d9c0b481 100644 --- a/miri/fn_call.rs +++ b/miri/fn_call.rs @@ -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)), } diff --git a/tests/compiletest.rs b/tests/compiletest.rs index b87fd7d243..82fc4968a4 100644 --- a/tests/compiletest.rs +++ b/tests/compiletest.rs @@ -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())); @@ -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 { @@ -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] diff --git a/tests/run-pass-fullmir/catch.rs b/tests/run-pass-fullmir/catch.rs index efcfee68ee..490f17d4cf 100644 --- a/tests/run-pass-fullmir/catch.rs +++ b/tests/run-pass-fullmir/catch.rs @@ -1,3 +1,4 @@ +//ignore-msvc use std::panic::{catch_unwind, AssertUnwindSafe}; fn main() { diff --git a/tests/run-pass-fullmir/foreign-fn-linkname.rs b/tests/run-pass-fullmir/foreign-fn-linkname.rs index b569cd0a66..20cb713590 100644 --- a/tests/run-pass-fullmir/foreign-fn-linkname.rs +++ b/tests/run-pass-fullmir/foreign-fn-linkname.rs @@ -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; diff --git a/tests/run-pass-fullmir/format.rs b/tests/run-pass-fullmir/format.rs index 78729b9156..a14d7054e7 100644 --- a/tests/run-pass-fullmir/format.rs +++ b/tests/run-pass-fullmir/format.rs @@ -1,3 +1,4 @@ +//ignore-msvc fn main() { println!("Hello {}", 13); } diff --git a/tests/run-pass-fullmir/from_utf8.rs b/tests/run-pass-fullmir/from_utf8.rs index 69e6c521af..c5d4abcfda 100644 --- a/tests/run-pass-fullmir/from_utf8.rs +++ b/tests/run-pass-fullmir/from_utf8.rs @@ -1,3 +1,4 @@ +//ignore-msvc fn main() { let _ = ::std::str::from_utf8(b"a"); } diff --git a/tests/run-pass-fullmir/hashmap.rs b/tests/run-pass-fullmir/hashmap.rs index f4a358174f..99f05e2598 100644 --- a/tests/run-pass-fullmir/hashmap.rs +++ b/tests/run-pass-fullmir/hashmap.rs @@ -1,3 +1,4 @@ +//ignore-msvc use std::collections::{self, HashMap}; use std::hash::BuildHasherDefault; diff --git a/tests/run-pass-fullmir/heap.rs b/tests/run-pass-fullmir/heap.rs index b533f91646..917d51d0e4 100644 --- a/tests/run-pass-fullmir/heap.rs +++ b/tests/run-pass-fullmir/heap.rs @@ -1,3 +1,4 @@ +//ignore-msvc #![feature(box_syntax)] fn make_box() -> Box<(i16, i16)> { diff --git a/tests/run-pass-fullmir/hello.rs b/tests/run-pass-fullmir/hello.rs index e7a11a969c..986efcaf90 100644 --- a/tests/run-pass-fullmir/hello.rs +++ b/tests/run-pass-fullmir/hello.rs @@ -1,3 +1,4 @@ +//ignore-msvc fn main() { println!("Hello, world!"); } diff --git a/tests/run-pass-fullmir/integer-ops.rs b/tests/run-pass-fullmir/integer-ops.rs index 0964b1b32b..97c694fd56 100644 --- a/tests/run-pass-fullmir/integer-ops.rs +++ b/tests/run-pass-fullmir/integer-ops.rs @@ -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() { diff --git a/tests/run-pass-fullmir/issue-15080.rs b/tests/run-pass-fullmir/issue-15080.rs index cee0caeb46..4a84f2bc5d 100644 --- a/tests/run-pass-fullmir/issue-15080.rs +++ b/tests/run-pass-fullmir/issue-15080.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +//ignore-msvc #![feature(slice_patterns)] diff --git a/tests/run-pass-fullmir/issue-3794.rs b/tests/run-pass-fullmir/issue-3794.rs index badb833ee8..8d55af58ee 100644 --- a/tests/run-pass-fullmir/issue-3794.rs +++ b/tests/run-pass-fullmir/issue-3794.rs @@ -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 { diff --git a/tests/run-pass-fullmir/loop-break-value.rs b/tests/run-pass-fullmir/loop-break-value.rs index 8631909a2a..8a0ea113c5 100644 --- a/tests/run-pass-fullmir/loop-break-value.rs +++ b/tests/run-pass-fullmir/loop-break-value.rs @@ -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)] diff --git a/tests/run-pass-fullmir/move-arg-2-unique.rs b/tests/run-pass-fullmir/move-arg-2-unique.rs index d44c83763b..f3c6566237 100644 --- a/tests/run-pass-fullmir/move-arg-2-unique.rs +++ b/tests/run-pass-fullmir/move-arg-2-unique.rs @@ -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)] diff --git a/tests/run-pass-fullmir/regions-mock-trans.rs b/tests/run-pass-fullmir/regions-mock-trans.rs index 6eeb7cd511..cef62e47a5 100644 --- a/tests/run-pass-fullmir/regions-mock-trans.rs +++ b/tests/run-pass-fullmir/regions-mock-trans.rs @@ -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)] diff --git a/tests/run-pass-fullmir/u128.rs b/tests/run-pass-fullmir/u128.rs index a05308acbe..5b2efdd205 100644 --- a/tests/run-pass-fullmir/u128.rs +++ b/tests/run-pass-fullmir/u128.rs @@ -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 } diff --git a/tests/run-pass-fullmir/unsized-tuple-impls.rs b/tests/run-pass-fullmir/unsized-tuple-impls.rs index ccb6883e87..828e5c2692 100644 --- a/tests/run-pass-fullmir/unsized-tuple-impls.rs +++ b/tests/run-pass-fullmir/unsized-tuple-impls.rs @@ -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; diff --git a/tests/run-pass-fullmir/vecs.rs b/tests/run-pass-fullmir/vecs.rs index 776791bbc9..9a8912a6b9 100644 --- a/tests/run-pass-fullmir/vecs.rs +++ b/tests/run-pass-fullmir/vecs.rs @@ -1,3 +1,5 @@ +//ignore-msvc + fn make_vec() -> Vec { let mut v = Vec::with_capacity(4); v.push(1); diff --git a/tests/run-pass/issue-17877.rs b/tests/run-pass/issue-17877.rs index 6c87e8d35f..b4b74b9905 100644 --- a/tests/run-pass/issue-17877.rs +++ b/tests/run-pass/issue-17877.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +//ignore-msvc #![feature(slice_patterns)]