Merge pull request rust-lang/libm#307 from tgross35/shellcheck-fixes

Fix shellcheck warnings in scripts
This commit is contained in:
Trevor Gross 2024-10-06 14:47:49 -04:00 committed by GitHub
commit 217baa6196
2 changed files with 19 additions and 14 deletions

View file

@ -1,36 +1,40 @@
#!/bin/bash
# Small script to run tests for a target (or all targets) inside all the
# respective docker images.
set -ex
set -euxo pipefail
run() {
local target=$1
echo $target
echo "testing target: $target"
# This directory needs to exist before calling docker, otherwise docker will create it but it
# will be owned by root
mkdir -p target
docker build -t $target ci/docker/$target
docker build -t "$target" "ci/docker/$target"
docker run \
--rm \
--user $(id -u):$(id -g) \
--user "$(id -u):$(id -g)" \
-e RUSTFLAGS \
-e CARGO_HOME=/cargo \
-e CARGO_TARGET_DIR=/target \
-v "${HOME}/.cargo":/cargo \
-v `pwd`/target:/target \
-v `pwd`:/checkout:ro \
-v `rustc --print sysroot`:/rust:ro \
-v "${HOME}/.cargo:/cargo" \
-v "$(pwd)/target:/target" \
-v "$(pwd):/checkout:ro" \
-v "$(rustc --print sysroot):/rust:ro" \
--init \
-w /checkout \
$target \
"$target" \
sh -c "HOME=/tmp PATH=\$PATH:/rust/bin exec ci/run.sh $target"
}
if [ -z "$1" ]; then
for d in `ls ci/docker/`; do
echo "running tests for all targets"
for d in ci/docker/*; do
run $d
done
else

View file

@ -1,9 +1,10 @@
#!/usr/bin/env sh
#!/bin/sh
set -ex
TARGET=$1
set -eux
cmd="cargo test --all --target $TARGET"
target="$1"
cmd="cargo test --all --target $target"
# Needed for no-panic to correct detect a lack of panics
export RUSTFLAGS="$RUSTFLAGS -Ccodegen-units=1"