Skip to content

Commit

Permalink
Clean up and rework CI script
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Mar 24, 2024
1 parent 351d48e commit 4c14cf6
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 24 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ jobs:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-unknown-linux-gnu
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/thumbv6m-none-eabi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ RUN apt-get update && \
gcc libc6-dev ca-certificates \
gcc-arm-none-eabi \
libnewlib-arm-none-eabi
ENV XARGO=1
ENV NO_STD=1
2 changes: 1 addition & 1 deletion ci/docker/thumbv7em-none-eabi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ RUN apt-get update && \
gcc libc6-dev ca-certificates \
gcc-arm-none-eabi \
libnewlib-arm-none-eabi
ENV XARGO=1
ENV NO_STD=1
2 changes: 1 addition & 1 deletion ci/docker/thumbv7em-none-eabihf/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ RUN apt-get update && \
gcc libc6-dev ca-certificates \
gcc-arm-none-eabi \
libnewlib-arm-none-eabi
ENV XARGO=1
ENV NO_STD=1
2 changes: 1 addition & 1 deletion ci/docker/thumbv7m-none-eabi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ RUN apt-get update && \
gcc libc6-dev ca-certificates \
gcc-arm-none-eabi \
libnewlib-arm-none-eabi
ENV XARGO=1
ENV NO_STD=1
40 changes: 20 additions & 20 deletions ci/run.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
set -ex

cargo=cargo

# Test our implementation
if [ "$XARGO" = "1" ]; then
# FIXME: currently these tests don't work...
if [ "$NO_STD" = "1" ]; then
echo nothing to do
else
run="cargo test --manifest-path testcrate/Cargo.toml --target $1"
Expand Down Expand Up @@ -47,6 +44,9 @@ else
path=target/${1}/debug/deps/libcompiler_builtins-*.rlib
fi

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

# Look out for duplicated symbols when we include the compiler-rt (C) implementation
for rlib in $(echo $path); do
set +x
Expand Down Expand Up @@ -79,29 +79,29 @@ done
rm -f $path

# Verify that we haven't drop any intrinsic/symbol
build_intrinsics="$cargo build --target $1 -v --example intrinsics"
RUSTFLAGS="-C debug-assertions=no" $build_intrinsics
RUSTFLAGS="-C debug-assertions=no" $build_intrinsics --release
RUSTFLAGS="-C debug-assertions=no" $build_intrinsics --features c
RUSTFLAGS="-C debug-assertions=no" $build_intrinsics --features c --release
build_intrinsics="cargo build --target $1 -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
#
# TODO(#79) fix the undefined references problem for debug-assertions+lto
if [ -z "$DEBUG_LTO_BUILD_DOESNT_WORK" ]; then
RUSTFLAGS="-C debug-assertions=no" \
CARGO_INCREMENTAL=0 \
CARGO_PROFILE_DEV_LTO=true \
$cargo rustc --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics
fi
CARGO_PROFILE_DEV_LTO=true \
cargo build --target $1 --example intrinsics
CARGO_PROFILE_RELEASE_LTO=true \
$cargo rustc --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics --release
cargo build --target $1 --example intrinsics --release

# Ensure no references to a panicking function
# Ensure no references to any symbols from core
for rlib in $(echo $path); do
set +ex
$NM -u $rlib 2>&1 | grep panicking
echo "================================================================"
echo checking $rlib for references to core
echo "================================================================"

$NM --quiet -U $rlib | grep 'T _ZN4core' | awk '{print $3}' | sort | uniq > defined_symbols.txt
$NM --quiet -u $rlib | grep 'U _ZN4core' | awk '{print $2}' | sort | uniq > undefined_symbols.txt
grep -v -F -x -f defined_symbols.txt undefined_symbols.txt

if test $? = 0; then
exit 1
Expand Down

0 comments on commit 4c14cf6

Please sign in to comment.