Skip to content

Commit 44f0f0c

Browse files
committed
Harden macOS host target checks
1 parent 527c781 commit 44f0f0c

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

scripts/check_macos.sh

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,9 @@ if [ "$machine" = "x86_64" ] && [ "$host" != "x86_64-apple-darwin" ]; then
3333
exit 1
3434
fi
3535

36-
echo "macOS checks: host test default features"
37-
rustup run "$toolchain" cargo test --all-targets
38-
39-
echo "macOS checks: host test all features"
40-
rustup run "$toolchain" cargo test --all-targets --all-features
41-
42-
echo "macOS checks: host check no_std library"
43-
rustup run "$toolchain" cargo check --no-default-features --lib
44-
45-
echo "macOS checks: host test no default features"
46-
rustup run "$toolchain" cargo test --no-default-features --all-targets
47-
48-
echo "macOS checks: host clippy all features"
49-
rustup run "$toolchain" cargo clippy --all-targets --all-features -- -D warnings
36+
if [ -n "${CARGO_BUILD_TARGET:-}" ]; then
37+
echo "macOS checks: CARGO_BUILD_TARGET=$CARGO_BUILD_TARGET is set; host checks force --target $host"
38+
fi
5039

5140
for target in aarch64-apple-darwin x86_64-apple-darwin; do
5241
if ! rustup target list --installed --toolchain "$toolchain" | grep -qx "$target"; then
@@ -60,7 +49,24 @@ for target in aarch64-apple-darwin x86_64-apple-darwin; do
6049
rustup target list --installed --toolchain "$toolchain" >&2
6150
exit 1
6251
fi
52+
done
6353

54+
echo "macOS checks: host test default features"
55+
rustup run "$toolchain" cargo test --target "$host" --all-targets
56+
57+
echo "macOS checks: host test all features"
58+
rustup run "$toolchain" cargo test --target "$host" --all-targets --all-features
59+
60+
echo "macOS checks: host check no_std library"
61+
rustup run "$toolchain" cargo check --target "$host" --no-default-features --lib
62+
63+
echo "macOS checks: host test no default features"
64+
rustup run "$toolchain" cargo test --target "$host" --no-default-features --all-targets
65+
66+
echo "macOS checks: host clippy all features"
67+
rustup run "$toolchain" cargo clippy --target "$host" --all-targets --all-features -- -D warnings
68+
69+
for target in aarch64-apple-darwin x86_64-apple-darwin; do
6470
echo "macOS checks: target compile all features for $target"
6571
rustup run "$toolchain" cargo check --target "$target" --all-features --lib
6672

0 commit comments

Comments
 (0)