Skip to content

Commit 6026476

Browse files
committed
Revert "Add some more shellcheck fixes"
This reverts commit 59c51b7.
1 parent 59c51b7 commit 6026476

File tree

2 files changed

+31
-38
lines changed

2 files changed

+31
-38
lines changed

ci/run-docker.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Small script to run tests for a target (or all targets) inside all the
44
# respective docker images.
55

6-
set -euxo pipefail
6+
set -eux
77

88
run() {
99
local target="$1"

ci/run.sh

+30-37
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#!/bin/bash
2-
3-
set -euxo pipefail
1+
set -eux
42

53
target="$1"
64

@@ -24,15 +22,14 @@ else
2422
$run --features no-asm --release
2523
fi
2624

27-
shopt -s nullglob
2825
if [ -d /builtins-target ]; then
29-
rlib_paths=(/builtins-target/"${target}"/debug/deps/libcompiler_builtins-*.rlib)
26+
path=/builtins-target/${target}/debug/deps/libcompiler_builtins-*.rlib
3027
else
31-
rlib_paths=(target/"${target}"/debug/deps/libcompiler_builtins-*.rlib)
28+
path=target/${target}/debug/deps/libcompiler_builtins-*.rlib
3229
fi
3330

3431
# Remove any existing artifacts from previous tests that don't set #![compiler_builtins]
35-
rm -f "${rlib_paths[@]}"
32+
rm -f $path
3633

3734
cargo build --target "$target"
3835
cargo build --target "$target" --release
@@ -41,7 +38,7 @@ cargo build --target "$target" --release --features c
4138
cargo build --target "$target" --features no-asm
4239
cargo build --target "$target" --release --features no-asm
4340

44-
PREFIX=${target//unknown-/}-
41+
PREFIX=$(echo "$target" | sed -e 's/unknown-//')-
4542
case "$target" in
4643
armv7-*)
4744
PREFIX=arm-linux-gnueabihf-
@@ -54,7 +51,7 @@ case "$target" in
5451
;;
5552
esac
5653

57-
NM=$(find "$(rustc --print sysroot)" \( -name llvm-nm -o -name llvm-nm.exe \) )
54+
NM=$(find $(rustc --print sysroot) \( -name llvm-nm -o -name llvm-nm.exe \) )
5855
if [ "$NM" = "" ]; then
5956
NM="${PREFIX}nm"
6057
fi
@@ -66,41 +63,37 @@ if [[ "$TOOLCHAIN" == *i686-pc-windows-gnu ]]; then
6663
fi
6764

6865
# Look out for duplicated symbols when we include the compiler-rt (C) implementation
69-
for rlib in "${rlib_paths[@]}"; do
66+
for rlib in $(echo $path); do
7067
set +x
7168
echo "================================================================"
7269
echo "checking $rlib for duplicate symbols"
7370
echo "================================================================"
74-
75-
duplicates_found=0
7671

72+
stdout=$($NM -g --defined-only $rlib 2>&1)
7773
# NOTE On i586, It's normal that the get_pc_thunk symbol appears several
7874
# times so ignore it
79-
$NM -g --defined-only "$rlib" 2>&1 |
80-
sort |
81-
uniq -d |
82-
grep -v __x86.get_pc_thunk --quiet |
83-
grep 'T __' && duplicates_found=1
84-
85-
if [ "$duplicates_found" != 0 ]; then
86-
echo "error: found duplicate symbols"
75+
set +e
76+
echo "$stdout" | \
77+
sort | \
78+
uniq -d | \
79+
grep -v __x86.get_pc_thunk | \
80+
grep 'T __'
81+
82+
if test $? = 0; then
8783
exit 1
88-
else
89-
echo "success; no duplicate symbols found"
9084
fi
91-
done
9285

93-
rm -f "${rlib_paths[@]}"
86+
set -ex
87+
done
9488

95-
build_intrinsics() {
96-
cargo build --target "$target" -v --example intrinsics "$@"
97-
}
89+
rm -f $path
9890

9991
# Verify that we haven't drop any intrinsic/symbol
100-
build_intrinsics
101-
build_intrinsics --release
102-
build_intrinsics --features cr
103-
build_intrinsics --features c --release
92+
build_intrinsics="cargo build --target "$target" -v --example intrinsics"
93+
$build_intrinsics
94+
$build_intrinsics --release
95+
$build_intrinsics --features c
96+
$build_intrinsics --features c --release
10497

10598
# Verify that there are no undefined symbols to `panic` within our
10699
# implementations
@@ -110,7 +103,7 @@ CARGO_PROFILE_RELEASE_LTO=true \
110103
cargo build --target "$target" --example intrinsics --release
111104

112105
# Ensure no references to any symbols from core
113-
for rlib in "${rlib_paths[@]}"; do
106+
for rlib in $(echo $path); do
114107
set +x
115108
echo "================================================================"
116109
echo "checking $rlib for references to core"
@@ -122,14 +115,14 @@ for rlib in "${rlib_paths[@]}"; do
122115
defined="$tmpdir/defined_symbols.txt"
123116
undefined="$tmpdir/defined_symbols.txt"
124117

125-
$NM --quiet -U "$rlib" | grep 'T _ZN4core' | awk '{print $3}' | sort | uniq > "$defined"
126-
$NM --quiet -u "$rlib" | grep 'U _ZN4core' | awk '{print $2}' | sort | uniq > "$undefined"
127-
grep_has_results=0
128-
grep -v -F -x -f "$defined" "$undefined" && grep_has_results=1
118+
$NM --quiet -U $rlib | grep 'T _ZN4core' | awk '{print $3}' | sort | uniq > "$defined"
119+
$NM --quiet -u $rlib | grep 'U _ZN4core' | awk '{print $2}' | sort | uniq > "$undefined"
120+
grep_failed=0
121+
grep -v -F -x -f "$defined" "$undefined" && grep_failed=1
129122

130123
if [ "$target" = "powerpc64-unknown-linux-gnu" ]; then
131124
echo "FIXME: powerpc64 fails these tests"
132-
elif [ "$grep_has_results" != 0 ]; then
125+
elif [ "$grep_failed" != 0 ]; then
133126
echo "error: found unexpected references to core"
134127
exit 1
135128
else

0 commit comments

Comments
 (0)