Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set -u (error on unset) in all script files #4108

Merged
merged 3 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/android-install-ndk.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

set -ex
set -eux

ndk=android-ndk-r27
wget --tries=20 -q "https://dl.google.com/android/repository/${ndk}-linux.zip"
Expand Down
2 changes: 1 addition & 1 deletion ci/android-install-sdk.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

set -ex
set -eux

# Prep the SDK and emulator
#
Expand Down
2 changes: 1 addition & 1 deletion ci/android-sysimage.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -ex
set -eux

URL=https://dl.google.com/android/repository/sys-img/android

Expand Down
2 changes: 1 addition & 1 deletion ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# The FILTER environment variable can be used to select which target(s) to build.
# For example: set FILTER to vxworks to select the targets that has vxworks in name

set -ex
set -eux

: "${TOOLCHAIN?The TOOLCHAIN environment variable must be set.}"
: "${OS?The OS environment variable must be set.}"
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/wasm32-unknown-emscripten/node-wrapper.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

set -e
set -eux

me="$1"
shift
Expand Down
2 changes: 1 addition & 1 deletion ci/emscripten-entry.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -ex
set -eux

# shellcheck disable=SC1091
source /emsdk-portable/emsdk_env.sh &> /dev/null
Expand Down
2 changes: 1 addition & 1 deletion ci/emscripten.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -ex
set -eux

# Note: keep in sync with:
# https://github.com/rust-lang/rust/blob/master/src/ci/docker/scripts/emscripten.sh
Expand Down
2 changes: 1 addition & 1 deletion ci/install-musl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Install musl and musl-sanitized linux kernel headers
# to musl-{$1} directory

set -ex
set -eux

musl_version=1.1.24
musl="musl-${musl_version}"
Expand Down
23 changes: 10 additions & 13 deletions ci/install-rust.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
#!/usr/bin/env sh
# This is intended to be used in CI only.

set -ex
set -eux

echo "Setup toolchain"
toolchain=
if [ -n "$TOOLCHAIN" ]; then
toolchain=$TOOLCHAIN
else
toolchain=nightly
fi

if [ "$OS" = "windows" ]; then
toolchain="${TOOLCHAIN:-nightly}"
os="${OS:-}"

if [ "$os" = "windows" ]; then
: "${TARGET?The TARGET environment variable must be set.}"
rustup set profile minimal
rustup update --force "$toolchain-$TARGET"
Expand All @@ -22,18 +19,18 @@ else
rustup default "$toolchain"
fi

if [ -n "$TARGET" ]; then
if [ -n "${TARGET:-}" ]; then
echo "Install target"
rustup target add "$TARGET"
fi

if [ -n "$INSTALL_RUST_SRC" ]; then
if [ -n "${INSTALL_RUST_SRC:-}" ]; then
echo "Install rust-src"
rustup component add rust-src
fi

if [ "$OS" = "windows" ]; then
if [ "$ARCH_BITS" = "i686" ]; then
if [ "$os" = "windows" ]; then
if [ "${ARCH_BITS:-}" = "i686" ]; then
echo "Install MinGW32"
choco install mingw --x86 --force
fi
Expand All @@ -44,7 +41,7 @@ if [ "$OS" = "windows" ]; then
/usr/bin/find "C:\ProgramData\Chocolatey" -name "dllcrt2*"
/usr/bin/find "C:\ProgramData\Chocolatey" -name "libmsvcrt*"

if [ -n "$ARCH_BITS" ]; then
if [ -n "${ARCH_BITS:-}" ]; then
echo "Fix MinGW"
for i in crt2.o dllcrt2.o libmingwex.a libmsvcrt.a ; do
cp -f "/C/ProgramData/Chocolatey/lib/mingw/tools/install/mingw$ARCH_BITS/$ARCH-w64-mingw32/lib/$i" "$(rustc --print sysroot)/lib/rustlib/$TARGET/lib"
Expand Down
2 changes: 1 addition & 1 deletion ci/linux-s390x.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

set -ex
set -eux

mkdir -m 777 /qemu
cd /qemu
Expand Down
2 changes: 1 addition & 1 deletion ci/linux-sparc64.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

set -ex
set -eux

mkdir -m 777 /qemu
cd /qemu
Expand Down
18 changes: 9 additions & 9 deletions ci/run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Small script to run tests for a target (or all targets) inside all the
# respective docker images.

set -ex
set -eux

# Default to assuming the CARGO_HOME is one directory up (to account for a `bin`
# subdir) from where the `cargo` binary in `$PATH` lives.
Expand Down Expand Up @@ -89,13 +89,13 @@ build_switch() {
}

if [ -z "${1}" ]; then
for d in ci/docker/*; do
run "${d}"
done
for d in ci/docker/*; do
run "${d}"
done
else
if [ "${1}" != "switch" ]; then
run "${1}"
else
build_switch
fi
if [ "${1}" != "switch" ]; then
run "${1}"
else
build_switch
fi
fi
4 changes: 2 additions & 2 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Builds and runs tests for a particular target passed as an argument to this
# script.

set -ex
set -eux

mirrors_url="https://ci-mirrors.rust-lang.org/libc"

Expand All @@ -15,7 +15,7 @@ target="$1"
#
# It's assume that all images, when run with two disks, will run the `run.sh`
# script from the second which we place inside.
if [ "$QEMU" != "" ]; then
if [ -n "${QEMU:-}" ]; then
tmpdir=/tmp/qemu-img-creation
mkdir -p "${tmpdir}"

Expand Down
2 changes: 1 addition & 1 deletion ci/style.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

set -ex
set -eux

rustc ci/style.rs && ./style src

Expand Down
2 changes: 1 addition & 1 deletion ci/test-runner-linux
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

set -e
set -eux

arch="$1"
prog="$2"
Expand Down
2 changes: 1 addition & 1 deletion ci/wasi.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -ex
set -eux

apt-get update
apt-get install -y --no-install-recommends \
Expand Down