Skip to content

Commit

Permalink
Revert "Add some more shellcheck fixes"
Browse files Browse the repository at this point in the history
This reverts commit 59c51b7.
  • Loading branch information
tgross35 committed Apr 15, 2024
1 parent 59c51b7 commit 6026476
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 38 deletions.
2 changes: 1 addition & 1 deletion ci/run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Small script to run tests for a target (or all targets) inside all the
# respective docker images.

set -euxo pipefail
set -eux

run() {
local target="$1"
Expand Down
67 changes: 30 additions & 37 deletions ci/run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/bash

set -euxo pipefail
set -eux

target="$1"

Expand All @@ -24,15 +22,14 @@ else
$run --features no-asm --release
fi

shopt -s nullglob
if [ -d /builtins-target ]; then
rlib_paths=(/builtins-target/"${target}"/debug/deps/libcompiler_builtins-*.rlib)
path=/builtins-target/${target}/debug/deps/libcompiler_builtins-*.rlib
else
rlib_paths=(target/"${target}"/debug/deps/libcompiler_builtins-*.rlib)
path=target/${target}/debug/deps/libcompiler_builtins-*.rlib
fi

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

cargo build --target "$target"
cargo build --target "$target" --release
Expand All @@ -41,7 +38,7 @@ cargo build --target "$target" --release --features c
cargo build --target "$target" --features no-asm
cargo build --target "$target" --release --features no-asm

PREFIX=${target//unknown-/}-
PREFIX=$(echo "$target" | sed -e 's/unknown-//')-
case "$target" in
armv7-*)
PREFIX=arm-linux-gnueabihf-
Expand All @@ -54,7 +51,7 @@ case "$target" in
;;
esac

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

# Look out for duplicated symbols when we include the compiler-rt (C) implementation
for rlib in "${rlib_paths[@]}"; do
for rlib in $(echo $path); do
set +x
echo "================================================================"
echo "checking $rlib for duplicate symbols"
echo "================================================================"

duplicates_found=0

stdout=$($NM -g --defined-only $rlib 2>&1)
# NOTE On i586, It's normal that the get_pc_thunk symbol appears several
# times so ignore it
$NM -g --defined-only "$rlib" 2>&1 |
sort |
uniq -d |
grep -v __x86.get_pc_thunk --quiet |
grep 'T __' && duplicates_found=1

if [ "$duplicates_found" != 0 ]; then
echo "error: found duplicate symbols"
set +e
echo "$stdout" | \
sort | \
uniq -d | \
grep -v __x86.get_pc_thunk | \
grep 'T __'

if test $? = 0; then
exit 1
else
echo "success; no duplicate symbols found"
fi
done

rm -f "${rlib_paths[@]}"
set -ex
done

build_intrinsics() {
cargo build --target "$target" -v --example intrinsics "$@"
}
rm -f $path

# Verify that we haven't drop any intrinsic/symbol
build_intrinsics
build_intrinsics --release
build_intrinsics --features cr
build_intrinsics --features c --release
build_intrinsics="cargo build --target "$target" -v --example intrinsics"
$build_intrinsics
$build_intrinsics --release
$build_intrinsics --features c
$build_intrinsics --features c --release

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

# Ensure no references to any symbols from core
for rlib in "${rlib_paths[@]}"; do
for rlib in $(echo $path); do
set +x
echo "================================================================"
echo "checking $rlib for references to core"
Expand All @@ -122,14 +115,14 @@ for rlib in "${rlib_paths[@]}"; do
defined="$tmpdir/defined_symbols.txt"
undefined="$tmpdir/defined_symbols.txt"

$NM --quiet -U "$rlib" | grep 'T _ZN4core' | awk '{print $3}' | sort | uniq > "$defined"
$NM --quiet -u "$rlib" | grep 'U _ZN4core' | awk '{print $2}' | sort | uniq > "$undefined"
grep_has_results=0
grep -v -F -x -f "$defined" "$undefined" && grep_has_results=1
$NM --quiet -U $rlib | grep 'T _ZN4core' | awk '{print $3}' | sort | uniq > "$defined"
$NM --quiet -u $rlib | grep 'U _ZN4core' | awk '{print $2}' | sort | uniq > "$undefined"
grep_failed=0
grep -v -F -x -f "$defined" "$undefined" && grep_failed=1

if [ "$target" = "powerpc64-unknown-linux-gnu" ]; then
echo "FIXME: powerpc64 fails these tests"
elif [ "$grep_has_results" != 0 ]; then
elif [ "$grep_failed" != 0 ]; then
echo "error: found unexpected references to core"
exit 1
else
Expand Down

0 comments on commit 6026476

Please sign in to comment.