Skip to content

Commit 10419b3

Browse files
committed
Auto merge of #1407 - RalfJung:appveyor, r=RalfJung
Share CI code between Travis and AppVeyor
2 parents a85f061 + 131bdf8 commit 10419b3

File tree

4 files changed

+75
-113
lines changed

4 files changed

+75
-113
lines changed

.appveyor.yml

Lines changed: 35 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,49 @@
1+
build: off # No Visual Studio auto-build.
12
environment:
2-
global:
3-
PROJECT_NAME: miri
4-
matrix:
5-
- TARGET: i686-pc-windows-msvc
3+
global:
4+
PROJECT_NAME: miri
5+
matrix:
6+
- TARGET: i686-pc-windows-msvc
7+
matrix:
8+
fast_finish: true # Immediately finish build once one of the jobs fails.
9+
cache:
10+
- '%USERPROFILE%\.cargo'
11+
- '%USERPROFILE%\.rustup'
612

713
# branches to build
814
branches:
915
# whitelist
1016
only:
11-
- auto
12-
- try
13-
14-
matrix:
15-
fast_finish: true # set this flag to immediately finish build once one of the jobs fails.
16-
17-
cache:
18-
- '%USERPROFILE%\.cargo'
19-
- '%USERPROFILE%\.rustup'
17+
- auto
18+
- try
2019

2120
install:
22-
# Compute the rust version we use
23-
- set /p RUSTC_HASH=<rust-version
24-
# Install Rust
25-
- curl -sSf --retry 3 -o rustup-init.exe https://win.rustup.rs/
26-
- rustup-init.exe -y --default-host %TARGET% --default-toolchain stable --profile minimal
27-
- set PATH=%USERPROFILE%\.cargo\bin;%PATH%
28-
- rustup default stable
29-
- rustup toolchain uninstall beta
30-
- rustup update
31-
# Install "master" toolchain
32-
- cargo install rustup-toolchain-install-master
33-
# We need to install cargo here as well or else the DLL search path inside `cargo run`
34-
# will be for the wrong toolchain. (On Unix, `./miri` takes care of this, but not here.)
35-
- rustup-toolchain-install-master -f -n master %RUSTC_HASH% -c rust-src -c rustc-dev -c cargo
36-
- rustup default master
37-
- rustc --version
38-
- cargo --version
39-
40-
build_script:
41-
- set RUSTFLAGS=-C debug-assertions
42-
# Build and install miri
43-
- cargo build --release --all-features --all-targets --locked
44-
- cargo install --all-features --force --path . --locked --offline
21+
# Compute the Rust version we use.
22+
- set /p RUSTC_HASH=<rust-version
23+
# Install Rust. We use the "stable" toolchain for better caching, it is just used to build `rustup-toolchain-install-master`.
24+
# But we also need to take into account that the build cache might have a different, outdated default.
25+
- curl -sSf --retry 3 -o rustup-init.exe https://win.rustup.rs/
26+
- rustup-init.exe -y --default-host %TARGET% --default-toolchain none --profile minimal
27+
- set PATH=%USERPROFILE%\.cargo\bin;%PATH%
28+
- rustup default stable
29+
- rustup toolchain uninstall beta nightly
30+
- rustup update
31+
# Install "master" toolchain.
32+
- cargo install rustup-toolchain-install-master
33+
- rustup-toolchain-install-master -f -n master %RUSTC_HASH% -c rust-src -c rustc-dev
34+
- rustup default master
35+
- rustc --version
36+
- cargo --version
4537

4638
test_script:
47-
- set RUST_TEST_NOCAPTURE=1
48-
- set RUST_BACKTRACE=1
49-
- set CARGO_INCREMENTAL=0
50-
# Test host miri: 32bit Windows
51-
- cargo miri setup
52-
- set MIRI_SYSROOT=%USERPROFILE%\AppData\Local\rust-lang\miri\cache\HOST
53-
- cargo test --release --all-features --locked
54-
- cd test-cargo-miri
55-
- '"C:\msys64\mingw64\bin\python3.exe" run-test.py'
56-
- cd ..
57-
- ps: $env:MIRI_SYSROOT = ""
58-
# Test foreign miri: 64bit Linux
59-
- cargo miri setup --target x86_64-unknown-linux-gnu
60-
- set MIRI_SYSROOT=%USERPROFILE%\AppData\Local\rust-lang\miri\cache
61-
- set MIRI_TEST_TARGET=x86_64-unknown-linux-gnu
62-
- cargo test --release --all-features --locked
63-
- cd test-cargo-miri
64-
- '"C:\msys64\mingw64\bin\python3.exe" run-test.py'
65-
- cd ..
66-
- ps: $env:MIRI_SYSROOT = ""
67-
# Test foreign miri: 64bit macOS
68-
- cargo miri setup --target x86_64-apple-darwin
69-
- set MIRI_SYSROOT=%USERPROFILE%\AppData\Local\rust-lang\miri\cache
70-
- set MIRI_TEST_TARGET=x86_64-apple-darwin
71-
- cargo test --release --all-features --locked
72-
- cd test-cargo-miri
73-
- '"C:\msys64\mingw64\bin\python3.exe" run-test.py'
74-
- cd ..
75-
- ps: $env:MIRI_SYSROOT = ""
39+
- set PYTHON=C:\msys64\mingw64\bin\python3.exe
40+
- bash ci.sh
7641

7742
after_test:
78-
# Don't cache "master" toolchain, it's a waste
79-
- rustup default stable
80-
- rustup toolchain uninstall master
43+
# Don't cache "master" toolchain, it's a waste.
44+
- rustup default stable
45+
- rustup toolchain uninstall master
8146

8247
notifications:
83-
- provider: Email
84-
on_build_success: false
48+
- provider: Email
49+
on_build_success: false

.travis.yml

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,57 @@
11
language: generic
2+
os:
3+
- linux
4+
- osx
5+
dist: xenial
26
cache:
37
# Cache the global cargo directory, but NOT the local `target` directory which
48
# we cannot reuse anyway when the nightly changes (and it grows quite large
59
# over time).
610
directories:
7-
- $HOME/.cargo
8-
- $HOME/.rustup
9-
10-
os:
11-
- linux
12-
- osx
13-
dist: xenial
11+
- $HOME/.cargo
12+
- $HOME/.rustup
1413

1514
# Run in PRs and for bors, but not on master.
15+
branches:
16+
only:
17+
- master
18+
- auto
19+
- try
1620
if: branch = auto OR branch = try OR type = pull_request OR type = cron
1721

18-
env:
19-
global:
20-
- RUST_TEST_NOCAPTURE=1
21-
- RUST_BACKTRACE=1
22-
- CARGO_INCREMENTAL=0
23-
2422
before_script:
25-
# Compute the rust version we use. We do not use "language: rust" to have more control here.
23+
# Compute the Rust version we use. We do not use "language: rust" to have more control here.
2624
- |
2725
if [[ "$TRAVIS_EVENT_TYPE" == cron ]]; then
2826
RUSTC_HASH=$(git ls-remote https://github.com/rust-lang/rust.git master | awk '{print $1}')
2927
else
3028
RUSTC_HASH=$(cat rust-version)
3129
fi
32-
# Install Rust ("stable" toolchain for better caching, it is just used to build rustup-toolchain-install-master)
33-
- curl https://build.travis-ci.org/files/rustup-init.sh -sSf | sh -s -- -y --default-toolchain stable --profile minimal
30+
# Install Rust. We use the "stable" toolchain for better caching, it is just used to build `rustup-toolchain-install-master`.
31+
# But we also need to take into account that the build cache might have a different, outdated default.
32+
- curl https://build.travis-ci.org/files/rustup-init.sh -sSf | sh -s -- -y --default-toolchain none --profile minimal
3433
- export PATH=$HOME/.cargo/bin:$PATH
3534
- rustup default stable
36-
- rustup toolchain uninstall beta
35+
- rustup toolchain uninstall beta nightly
3736
- rustup update
38-
# Install "master" toolchain
37+
# Install "master" toolchain.
3938
- cargo install rustup-toolchain-install-master
4039
- travis_retry rustup-toolchain-install-master -f -n master $RUSTC_HASH -c rust-src -c rustc-dev
4140
- rustup default master
4241
- rustc --version
4342
- cargo --version
4443

4544
script:
46-
- ./travis.sh
45+
- ./ci.sh
4746

4847
before_cache:
49-
# Don't cache "master" toolchain, it's a waste
48+
# Don't cache "master" toolchain, it's a waste.
5049
- rustup default stable
5150
- rustup toolchain uninstall master
5251

5352
notifications:
5453
email:
5554
on_success: never
5655
recipients:
57-
58-
59-
branches:
60-
only:
61-
- master
62-
- auto
63-
- try
56+
57+

travis.sh renamed to ci.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
set -euo pipefail
33

44
# Determine configuration
5-
export CARGO_EXTRA_FLAGS="--all-features"
5+
export RUST_TEST_NOCAPTURE=1
6+
export RUST_BACKTRACE=1
67
export RUSTC_EXTRA_FLAGS="-D warnings"
8+
export CARGO_INCREMENTAL=0
9+
export CARGO_EXTRA_FLAGS="--all-features"
710

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

3134
echo
3235
}
3336

3437
# host
3538
run_tests
36-
# cross-test 32bit Linux from everywhere
37-
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
3839

39-
if [ "$TRAVIS_OS_NAME" == linux ]; then
40-
# cross-test 64bit macOS from Linux
40+
if [ "${TRAVIS_OS_NAME:-}" == linux ]; then
41+
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
4142
MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
42-
# cross-test 32bit Windows from Linux
4343
MIRI_TEST_TARGET=i686-pc-windows-msvc run_tests
44-
elif [ "$TRAVIS_OS_NAME" == osx ]; then
45-
# cross-test 64bit Windows from macOS
44+
elif [ "${TRAVIS_OS_NAME:-}" == osx ]; then
4645
MIRI_TEST_TARGET=x86_64-pc-windows-msvc run_tests
47-
# cross-test 32bit GNU Windows from macOS
4846
MIRI_TEST_TARGET=i686-pc-windows-gnu run_tests
47+
elif [ "${CI_WINDOWS:-}" == True ]; then
48+
MIRI_TEST_TARGET=x86_64-unknown-linux-gnu run_tests
49+
MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
4950
fi

src/shims/fs.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -549,12 +549,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
549549
target_op: OpTy<'tcx, Tag>,
550550
linkpath_op: OpTy<'tcx, Tag>
551551
) -> InterpResult<'tcx, i32> {
552-
#[cfg(target_family = "unix")]
552+
#[cfg(unix)]
553553
fn create_link(src: &Path, dst: &Path) -> std::io::Result<()> {
554554
std::os::unix::fs::symlink(src, dst)
555555
}
556556

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

817817
this.check_no_isolation("mkdir")?;
818818

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

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

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

829831
// If the host supports it, forward on the mode of the directory
830832
// (i.e. permission bits and the sticky bit)
831-
#[cfg(target_family = "unix")]
833+
#[cfg(unix)]
832834
{
833835
use std::os::unix::fs::DirBuilderExt;
834-
builder.mode(_mode.into());
836+
builder.mode(mode.into());
835837
}
836838

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

0 commit comments

Comments
 (0)