Skip to content

Commit efbd9f4

Browse files
committed
Fix some warnings from shellcheck
1 parent ea86bf9 commit efbd9f4

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

ci/run-docker.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ run() {
1414
# will be owned by root
1515
mkdir -p target
1616

17-
if [ $(uname -s) = "Linux" ] && [ -z "${DOCKER_BASE_IMAGE:-}" ]; then
17+
if [ "$(uname -s)" = "Linux" ] && [ -z "${DOCKER_BASE_IMAGE:-}" ]; then
1818
# Share the host rustc and target. Do this only on Linux and if the image
1919
# isn't overridden
2020
run_args=(

ci/run.sh

+21-10
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,24 @@ fi
3838

3939
if [ "${TEST_VERBATIM:-}" = "1" ]; then
4040
verb_path=$(cmd.exe //C echo \\\\?\\%cd%\\testcrate\\target2)
41-
cargo build --manifest-path testcrate/Cargo.toml --target $target --target-dir $verb_path --features c
41+
cargo build --manifest-path testcrate/Cargo.toml \
42+
--target "$target" --target-dir "$verb_path" --features c
4243
fi
4344

44-
if [ -d /builtins-target ]; then
45-
rlib_paths=/builtins-target/"${target}"/debug/deps/libcompiler_builtins-*.rlib
46-
else
47-
rlib_paths=target/"${target}"/debug/deps/libcompiler_builtins-*.rlib
48-
fi
45+
declare -a rlib_paths
46+
47+
# Set the `rlib_paths` global array to a list of all compiler-builtins rlibs
48+
update_rlib_paths() {
49+
if [ -d /builtins-target ]; then
50+
rlib_paths=( /builtins-target/"${target}"/debug/deps/libcompiler_builtins-*.rlib )
51+
else
52+
rlib_paths=( target/"${target}"/debug/deps/libcompiler_builtins-*.rlib )
53+
fi
54+
}
4955

5056
# Remove any existing artifacts from previous tests that don't set #![compiler_builtins]
51-
rm -f $rlib_paths
57+
update_rlib_paths
58+
rm -f "${rlib_paths[@]}"
5259

5360
cargo build --target "$target"
5461
cargo build --target "$target" --release
@@ -76,6 +83,7 @@ NM=$(find "$(rustc --print sysroot)" \( -name llvm-nm -o -name llvm-nm.exe \) )
7683
if [ "$NM" = "" ]; then
7784
NM="${PREFIX}nm"
7885
fi
86+
7987
# i686-pc-windows-gnu tools have a dependency on some DLLs, so run it with
8088
# rustup run to ensure that those are in PATH.
8189
TOOLCHAIN="$(rustup show active-toolchain | sed 's/ (default)//')"
@@ -84,11 +92,13 @@ if [[ "$TOOLCHAIN" == *i686-pc-windows-gnu ]]; then
8492
fi
8593

8694
# Look out for duplicated symbols when we include the compiler-rt (C) implementation
87-
for rlib in $rlib_paths; do
95+
update_rlib_paths
96+
for rlib in "${rlib_paths[@]}"; do
8897
set +x
8998
echo "================================================================"
9099
echo "checking $rlib for duplicate symbols"
91100
echo "================================================================"
101+
set -x
92102

93103
duplicates_found=0
94104

@@ -108,7 +118,7 @@ for rlib in $rlib_paths; do
108118
fi
109119
done
110120

111-
rm -f $rlib_paths
121+
rm -f "${rlib_paths[@]}"
112122

113123
build_intrinsics() {
114124
cargo build --target "$target" -v --example intrinsics "$@"
@@ -128,7 +138,8 @@ CARGO_PROFILE_RELEASE_LTO=true \
128138
cargo build --target "$target" --example intrinsics --release
129139

130140
# Ensure no references to any symbols from core
131-
for rlib in $(echo $rlib_paths); do
141+
update_rlib_paths
142+
for rlib in "${rlib_paths[@]}"; do
132143
set +x
133144
echo "================================================================"
134145
echo "checking $rlib for references to core"

0 commit comments

Comments
 (0)