Skip to content

Commit b5202e5

Browse files
authored
Merge pull request rust-lang#307 from tgross35/shellcheck-fixes
Fix shellcheck warnings in scripts
2 parents b9c38d3 + 2a763a6 commit b5202e5

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

ci/run-docker.sh

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,40 @@
1+
#!/bin/bash
2+
13
# Small script to run tests for a target (or all targets) inside all the
24
# respective docker images.
35

4-
set -ex
6+
set -euxo pipefail
57

68
run() {
79
local target=$1
810

9-
echo $target
11+
echo "testing target: $target"
1012

1113
# This directory needs to exist before calling docker, otherwise docker will create it but it
1214
# will be owned by root
1315
mkdir -p target
1416

15-
docker build -t $target ci/docker/$target
17+
docker build -t "$target" "ci/docker/$target"
1618
docker run \
1719
--rm \
18-
--user $(id -u):$(id -g) \
20+
--user "$(id -u):$(id -g)" \
1921
-e RUSTFLAGS \
2022
-e CARGO_HOME=/cargo \
2123
-e CARGO_TARGET_DIR=/target \
22-
-v "${HOME}/.cargo":/cargo \
23-
-v `pwd`/target:/target \
24-
-v `pwd`:/checkout:ro \
25-
-v `rustc --print sysroot`:/rust:ro \
24+
-v "${HOME}/.cargo:/cargo" \
25+
-v "$(pwd)/target:/target" \
26+
-v "$(pwd):/checkout:ro" \
27+
-v "$(rustc --print sysroot):/rust:ro" \
2628
--init \
2729
-w /checkout \
28-
$target \
30+
"$target" \
2931
sh -c "HOME=/tmp PATH=\$PATH:/rust/bin exec ci/run.sh $target"
3032
}
3133

3234
if [ -z "$1" ]; then
33-
for d in `ls ci/docker/`; do
35+
echo "running tests for all targets"
36+
37+
for d in ci/docker/*; do
3438
run $d
3539
done
3640
else

ci/run.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
#!/usr/bin/env sh
1+
#!/bin/sh
22

3-
set -ex
4-
TARGET=$1
3+
set -eux
54

6-
cmd="cargo test --all --target $TARGET"
5+
target="$1"
6+
7+
cmd="cargo test --all --target $target"
78

89
# Needed for no-panic to correct detect a lack of panics
910
export RUSTFLAGS="$RUSTFLAGS -Ccodegen-units=1"

0 commit comments

Comments
 (0)