From ce105a486a5371abce0220b3d9c61e18ff7ea588 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Sun, 24 Mar 2024 20:27:38 +0000 Subject: [PATCH] Clean up and rework CI script --- .github/workflows/main.yml | 1 + ci/docker/thumbv6m-none-eabi/Dockerfile | 2 +- ci/docker/thumbv7em-none-eabi/Dockerfile | 2 +- ci/docker/thumbv7em-none-eabihf/Dockerfile | 2 +- ci/docker/thumbv7m-none-eabi/Dockerfile | 2 +- ci/run.sh | 54 +++++++++++----------- 6 files changed, 32 insertions(+), 31 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9071e4ff..f5600c1e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,6 +6,7 @@ jobs: name: Test runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: include: - target: aarch64-unknown-linux-gnu diff --git a/ci/docker/thumbv6m-none-eabi/Dockerfile b/ci/docker/thumbv6m-none-eabi/Dockerfile index 04d4f442..dc7dd431 100644 --- a/ci/docker/thumbv6m-none-eabi/Dockerfile +++ b/ci/docker/thumbv6m-none-eabi/Dockerfile @@ -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 diff --git a/ci/docker/thumbv7em-none-eabi/Dockerfile b/ci/docker/thumbv7em-none-eabi/Dockerfile index 04d4f442..dc7dd431 100644 --- a/ci/docker/thumbv7em-none-eabi/Dockerfile +++ b/ci/docker/thumbv7em-none-eabi/Dockerfile @@ -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 diff --git a/ci/docker/thumbv7em-none-eabihf/Dockerfile b/ci/docker/thumbv7em-none-eabihf/Dockerfile index 04d4f442..dc7dd431 100644 --- a/ci/docker/thumbv7em-none-eabihf/Dockerfile +++ b/ci/docker/thumbv7em-none-eabihf/Dockerfile @@ -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 diff --git a/ci/docker/thumbv7m-none-eabi/Dockerfile b/ci/docker/thumbv7m-none-eabi/Dockerfile index 04d4f442..dc7dd431 100644 --- a/ci/docker/thumbv7m-none-eabi/Dockerfile +++ b/ci/docker/thumbv7m-none-eabi/Dockerfile @@ -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 diff --git a/ci/run.sh b/ci/run.sh index 6376d221..935c08c8 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -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" @@ -16,6 +13,15 @@ else $run --features no-asm --release fi +if [ -d /target ]; then + path=/target/${1}/debug/deps/libcompiler_builtins-*.rlib +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 + cargo build --target $1 cargo build --target $1 --release cargo build --target $1 --features c @@ -36,17 +42,11 @@ case $1 in ;; esac -NM=$(find $(rustc --print sysroot) -name llvm-nm) +NM=$(find $(rustc --print sysroot) \( -name llvm-nm -o -name llvm-nm.exe \) ) if [ "$NM" = "" ]; then NM=${PREFIX}nm fi -if [ -d /target ]; then - path=/target/${1}/debug/deps/libcompiler_builtins-*.rlib -else - path=target/${1}/debug/deps/libcompiler_builtins-*.rlib -fi - # Look out for duplicated symbols when we include the compiler-rt (C) implementation for rlib in $(echo $path); do set +x @@ -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