Skip to content

Commit

Permalink
Auto merge of #1407 - RalfJung:appveyor, r=RalfJung
Browse files Browse the repository at this point in the history
Share CI code between Travis and AppVeyor
  • Loading branch information
bors committed May 11, 2020
2 parents a85f061 + 131bdf8 commit 10419b3
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 113 deletions.
105 changes: 35 additions & 70 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,84 +1,49 @@
build: off # No Visual Studio auto-build.
environment:
global:
PROJECT_NAME: miri
matrix:
- TARGET: i686-pc-windows-msvc
global:
PROJECT_NAME: miri
matrix:
- TARGET: i686-pc-windows-msvc
matrix:
fast_finish: true # Immediately finish build once one of the jobs fails.
cache:
- '%USERPROFILE%\.cargo'
- '%USERPROFILE%\.rustup'

# branches to build
branches:
# whitelist
only:
- auto
- try

matrix:
fast_finish: true # set this flag to immediately finish build once one of the jobs fails.

cache:
- '%USERPROFILE%\.cargo'
- '%USERPROFILE%\.rustup'
- auto
- try

install:
# Compute the rust version we use
- set /p RUSTC_HASH=<rust-version
# Install Rust
- curl -sSf --retry 3 -o rustup-init.exe https://win.rustup.rs/
- rustup-init.exe -y --default-host %TARGET% --default-toolchain stable --profile minimal
- set PATH=%USERPROFILE%\.cargo\bin;%PATH%
- rustup default stable
- rustup toolchain uninstall beta
- rustup update
# Install "master" toolchain
- cargo install rustup-toolchain-install-master
# We need to install cargo here as well or else the DLL search path inside `cargo run`
# will be for the wrong toolchain. (On Unix, `./miri` takes care of this, but not here.)
- rustup-toolchain-install-master -f -n master %RUSTC_HASH% -c rust-src -c rustc-dev -c cargo
- rustup default master
- rustc --version
- cargo --version

build_script:
- set RUSTFLAGS=-C debug-assertions
# Build and install miri
- cargo build --release --all-features --all-targets --locked
- cargo install --all-features --force --path . --locked --offline
# Compute the Rust version we use.
- set /p RUSTC_HASH=<rust-version
# Install Rust. We use the "stable" toolchain for better caching, it is just used to build `rustup-toolchain-install-master`.
# But we also need to take into account that the build cache might have a different, outdated default.
- curl -sSf --retry 3 -o rustup-init.exe https://win.rustup.rs/
- rustup-init.exe -y --default-host %TARGET% --default-toolchain none --profile minimal
- set PATH=%USERPROFILE%\.cargo\bin;%PATH%
- rustup default stable
- rustup toolchain uninstall beta nightly
- rustup update
# Install "master" toolchain.
- cargo install rustup-toolchain-install-master
- rustup-toolchain-install-master -f -n master %RUSTC_HASH% -c rust-src -c rustc-dev
- rustup default master
- rustc --version
- cargo --version

test_script:
- set RUST_TEST_NOCAPTURE=1
- set RUST_BACKTRACE=1
- set CARGO_INCREMENTAL=0
# Test host miri: 32bit Windows
- cargo miri setup
- set MIRI_SYSROOT=%USERPROFILE%\AppData\Local\rust-lang\miri\cache\HOST
- cargo test --release --all-features --locked
- cd test-cargo-miri
- '"C:\msys64\mingw64\bin\python3.exe" run-test.py'
- cd ..
- ps: $env:MIRI_SYSROOT = ""
# Test foreign miri: 64bit Linux
- cargo miri setup --target x86_64-unknown-linux-gnu
- set MIRI_SYSROOT=%USERPROFILE%\AppData\Local\rust-lang\miri\cache
- set MIRI_TEST_TARGET=x86_64-unknown-linux-gnu
- cargo test --release --all-features --locked
- cd test-cargo-miri
- '"C:\msys64\mingw64\bin\python3.exe" run-test.py'
- cd ..
- ps: $env:MIRI_SYSROOT = ""
# Test foreign miri: 64bit macOS
- cargo miri setup --target x86_64-apple-darwin
- set MIRI_SYSROOT=%USERPROFILE%\AppData\Local\rust-lang\miri\cache
- set MIRI_TEST_TARGET=x86_64-apple-darwin
- cargo test --release --all-features --locked
- cd test-cargo-miri
- '"C:\msys64\mingw64\bin\python3.exe" run-test.py'
- cd ..
- ps: $env:MIRI_SYSROOT = ""
- set PYTHON=C:\msys64\mingw64\bin\python3.exe
- bash ci.sh

after_test:
# Don't cache "master" toolchain, it's a waste
- rustup default stable
- rustup toolchain uninstall master
# Don't cache "master" toolchain, it's a waste.
- rustup default stable
- rustup toolchain uninstall master

notifications:
- provider: Email
on_build_success: false
- provider: Email
on_build_success: false
48 changes: 21 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,57 @@
language: generic
os:
- linux
- osx
dist: xenial
cache:
# Cache the global cargo directory, but NOT the local `target` directory which
# we cannot reuse anyway when the nightly changes (and it grows quite large
# over time).
directories:
- $HOME/.cargo
- $HOME/.rustup

os:
- linux
- osx
dist: xenial
- $HOME/.cargo
- $HOME/.rustup

# Run in PRs and for bors, but not on master.
branches:
only:
- master
- auto
- try
if: branch = auto OR branch = try OR type = pull_request OR type = cron

env:
global:
- RUST_TEST_NOCAPTURE=1
- RUST_BACKTRACE=1
- CARGO_INCREMENTAL=0

before_script:
# Compute the rust version we use. We do not use "language: rust" to have more control here.
# Compute the Rust version we use. We do not use "language: rust" to have more control here.
- |
if [[ "$TRAVIS_EVENT_TYPE" == cron ]]; then
RUSTC_HASH=$(git ls-remote https://github.com/rust-lang/rust.git master | awk '{print $1}')
else
RUSTC_HASH=$(cat rust-version)
fi
# Install Rust ("stable" toolchain for better caching, it is just used to build rustup-toolchain-install-master)
- curl https://build.travis-ci.org/files/rustup-init.sh -sSf | sh -s -- -y --default-toolchain stable --profile minimal
# Install Rust. We use the "stable" toolchain for better caching, it is just used to build `rustup-toolchain-install-master`.
# But we also need to take into account that the build cache might have a different, outdated default.
- curl https://build.travis-ci.org/files/rustup-init.sh -sSf | sh -s -- -y --default-toolchain none --profile minimal
- export PATH=$HOME/.cargo/bin:$PATH
- rustup default stable
- rustup toolchain uninstall beta
- rustup toolchain uninstall beta nightly
- rustup update
# Install "master" toolchain
# Install "master" toolchain.
- cargo install rustup-toolchain-install-master
- travis_retry rustup-toolchain-install-master -f -n master $RUSTC_HASH -c rust-src -c rustc-dev
- rustup default master
- rustc --version
- cargo --version

script:
- ./travis.sh
- ./ci.sh

before_cache:
# Don't cache "master" toolchain, it's a waste
# Don't cache "master" toolchain, it's a waste.
- rustup default stable
- rustup toolchain uninstall master

notifications:
email:
on_success: never
recipients:
- [email protected]
- [email protected]
branches:
only:
- master
- auto
- try
- [email protected]
- [email protected]
23 changes: 12 additions & 11 deletions travis.sh → ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
set -euo pipefail

# Determine configuration
export CARGO_EXTRA_FLAGS="--all-features"
export RUST_TEST_NOCAPTURE=1
export RUST_BACKTRACE=1
export RUSTC_EXTRA_FLAGS="-D warnings"
export CARGO_INCREMENTAL=0
export CARGO_EXTRA_FLAGS="--all-features"

# Prepare
echo "Build and install miri"
Expand All @@ -22,28 +25,26 @@ function run_tests {
./miri test --locked
if ! [ -n "${MIRI_TEST_TARGET+exists}" ]; then
# Only for host architecture: tests with MIR optimizations
MIRI_TEST_FLAGS="-Z mir-opt-level=3" ./miri test
MIRI_TEST_FLAGS="-Z mir-opt-level=3" ./miri test --locked
fi
# "miri test" has built the sysroot for us, now this should pass without
# any interactive questions.
test-cargo-miri/run-test.py
${PYTHON:-python3} test-cargo-miri/run-test.py

echo
}

# host
run_tests
# cross-test 32bit Linux from everywhere
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests

if [ "$TRAVIS_OS_NAME" == linux ]; then
# cross-test 64bit macOS from Linux
if [ "${TRAVIS_OS_NAME:-}" == linux ]; then
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
# cross-test 32bit Windows from Linux
MIRI_TEST_TARGET=i686-pc-windows-msvc run_tests
elif [ "$TRAVIS_OS_NAME" == osx ]; then
# cross-test 64bit Windows from macOS
elif [ "${TRAVIS_OS_NAME:-}" == osx ]; then
MIRI_TEST_TARGET=x86_64-pc-windows-msvc run_tests
# cross-test 32bit GNU Windows from macOS
MIRI_TEST_TARGET=i686-pc-windows-gnu run_tests
elif [ "${CI_WINDOWS:-}" == True ]; then
MIRI_TEST_TARGET=x86_64-unknown-linux-gnu run_tests
MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
fi
12 changes: 7 additions & 5 deletions src/shims/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,12 +549,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
target_op: OpTy<'tcx, Tag>,
linkpath_op: OpTy<'tcx, Tag>
) -> InterpResult<'tcx, i32> {
#[cfg(target_family = "unix")]
#[cfg(unix)]
fn create_link(src: &Path, dst: &Path) -> std::io::Result<()> {
std::os::unix::fs::symlink(src, dst)
}

#[cfg(target_family = "windows")]
#[cfg(windows)]
fn create_link(src: &Path, dst: &Path) -> std::io::Result<()> {
use std::os::windows::fs;
if src.is_dir() {
Expand Down Expand Up @@ -816,22 +816,24 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx

this.check_no_isolation("mkdir")?;

let _mode = if this.tcx.sess.target.target.target_os == "macos" {
#[cfg_attr(not(unix), allow(unused_variables))]
let mode = if this.tcx.sess.target.target.target_os == "macos" {
u32::from(this.read_scalar(mode_op)?.not_undef()?.to_u16()?)
} else {
this.read_scalar(mode_op)?.to_u32()?
};

let path = this.read_path_from_c_str(this.read_scalar(path_op)?.not_undef()?)?;

#[cfg_attr(not(unix), allow(unused_mut))]
let mut builder = DirBuilder::new();

// If the host supports it, forward on the mode of the directory
// (i.e. permission bits and the sticky bit)
#[cfg(target_family = "unix")]
#[cfg(unix)]
{
use std::os::unix::fs::DirBuilderExt;
builder.mode(_mode.into());
builder.mode(mode.into());
}

let result = builder.create(path).map(|_| 0i32);
Expand Down

0 comments on commit 10419b3

Please sign in to comment.