Skip to content

Fix some warnings from shellcheck #701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions ci/run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ run() {
# will be owned by root
mkdir -p target

if [ $(uname -s) = "Linux" ] && [ -z "${DOCKER_BASE_IMAGE:-}" ]; then
if [ "$(uname -s)" = "Linux" ] && [ -z "${DOCKER_BASE_IMAGE:-}" ]; then
# Share the host rustc and target. Do this only on Linux and if the image
# isn't overridden
run_args=(
Expand Down Expand Up @@ -43,19 +43,21 @@ run() {

if [ "${GITHUB_ACTIONS:-}" = "true" ]; then
# Enable Docker image caching on GHA

build_cmd=("buildx" "build")
build_args=(
"--cache-from" "type=local,src=/tmp/.buildx-cache"
"--cache-to" "type=local,dest=/tmp/.buildx-cache-new"
"${build_args[@]:-}"
# This is the beautiful bash syntax for expanding an array but neither
# raising an error nor returning an empty string if the array is empty.
"${build_args[@]:+"${build_args[@]}"}"
"--load"
)
fi

docker ${build_cmd[@]:-build} \
docker "${build_cmd[@]:-build}" \
-t "builtins-$target" \
${build_args[@]:-} \
"${build_args[@]:-}" \
"ci/docker/$target"
docker run \
--rm \
Expand All @@ -64,7 +66,7 @@ run() {
-e "CARGO_TARGET_DIR=/builtins-target" \
-v "$(pwd):/checkout:ro" \
-w /checkout \
${run_args[@]:-} \
"${run_args[@]:-}" \
--init \
"builtins-$target" \
sh -c "$run_cmd"
Expand Down
31 changes: 21 additions & 10 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,24 @@ fi

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

if [ -d /builtins-target ]; then
rlib_paths=/builtins-target/"${target}"/debug/deps/libcompiler_builtins-*.rlib
else
rlib_paths=target/"${target}"/debug/deps/libcompiler_builtins-*.rlib
fi
declare -a rlib_paths

# Set the `rlib_paths` global array to a list of all compiler-builtins rlibs
update_rlib_paths() {
if [ -d /builtins-target ]; then
rlib_paths=( /builtins-target/"${target}"/debug/deps/libcompiler_builtins-*.rlib )
else
rlib_paths=( 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
update_rlib_paths
rm -f "${rlib_paths[@]}"

cargo build --target "$target"
cargo build --target "$target" --release
Expand Down Expand Up @@ -76,6 +83,7 @@ NM=$(find "$(rustc --print sysroot)" \( -name llvm-nm -o -name llvm-nm.exe \) )
if [ "$NM" = "" ]; then
NM="${PREFIX}nm"
fi

# i686-pc-windows-gnu tools have a dependency on some DLLs, so run it with
# rustup run to ensure that those are in PATH.
TOOLCHAIN="$(rustup show active-toolchain | sed 's/ (default)//')"
Expand All @@ -84,11 +92,13 @@ 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
update_rlib_paths
for rlib in "${rlib_paths[@]}"; do
set +x
echo "================================================================"
echo "checking $rlib for duplicate symbols"
echo "================================================================"
set -x

duplicates_found=0

Expand All @@ -108,7 +118,7 @@ for rlib in $rlib_paths; do
fi
done

rm -f $rlib_paths
rm -f "${rlib_paths[@]}"

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

# Ensure no references to any symbols from core
for rlib in $(echo $rlib_paths); do
update_rlib_paths
for rlib in "${rlib_paths[@]}"; do
set +x
echo "================================================================"
echo "checking $rlib for references to core"
Expand Down
Loading