From 4e423a0ddd4e383f8b0b54a12ca135316fc2539d Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Sun, 25 Aug 2024 17:18:44 +0100 Subject: [PATCH] ci: Run `tools/symbol-check.py` --- .cirrus.yml | 3 +++ .github/workflows/ci.yml | 27 +++++++++++++++++++++++++++ ci/ci.sh | 15 ++++++++++++++- ci/linux-debian.Dockerfile | 6 +++++- 4 files changed, 49 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 0c1e01dc95..45582a337f 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -28,6 +28,8 @@ env: BENCH: yes SECP256K1_BENCH_ITERS: 2 CTIMETESTS: yes + SYMBOL_CHECK: yes + VIRTUAL_ENV: /root/venv # Compile and run the tests EXAMPLES: yes @@ -52,6 +54,7 @@ cat_logs_snippet: &CAT_LOGS linux_arm64_container_snippet: &LINUX_ARM64_CONTAINER env_script: + - export PATH="$VIRTUAL_ENV/bin:$PATH" - env | tee /tmp/env build_script: - DOCKER_BUILDKIT=1 docker build --file "ci/linux-debian.Dockerfile" --tag="ci_secp256k1_arm" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0fc104d29b..c31cdaab0f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,7 @@ env: BENCH: 'yes' SECP256K1_BENCH_ITERS: 2 CTIMETESTS: 'yes' + SYMBOL_CHECK: 'yes' # Compile and run the examples. EXAMPLES: 'yes' @@ -453,6 +454,7 @@ jobs: ASAN_OPTIONS: 'strict_string_checks=1:detect_stack_use_after_return=1:detect_leaks=1' LSAN_OPTIONS: 'use_unaligned=1' SECP256K1_TEST_ITERS: 32 + SYMBOL_CHECK: 'no' steps: - name: Checkout @@ -516,6 +518,7 @@ jobs: SECP256K1_TEST_ITERS: 32 ASM: 'no' WITH_VALGRIND: 'no' + SYMBOL_CHECK: 'no' steps: - name: Checkout @@ -610,6 +613,7 @@ jobs: CC: 'clang' HOMEBREW_NO_AUTO_UPDATE: 1 HOMEBREW_NO_INSTALL_CLEANUP: 1 + SYMBOL_CHECK: 'no' strategy: fail-fast: false @@ -642,6 +646,11 @@ jobs: env: ${{ matrix.env_vars }} run: ./ci/ci.sh + - name: Symbol check + run: | + python3 -m pip install lief + python3 ./tools/symbol-check.py .libs/libsecp256k1.dylib + - run: cat tests.log || true if: ${{ always() }} - run: cat noverify_tests.log || true @@ -671,6 +680,7 @@ jobs: HOMEBREW_NO_INSTALL_CLEANUP: 1 WITH_VALGRIND: 'no' CTIMETESTS: 'no' + SYMBOL_CHECK: 'no' strategy: fail-fast: false @@ -698,6 +708,15 @@ jobs: env: ${{ matrix.env_vars }} run: ./ci/ci.sh + - name: Symbol check + env: + VIRTUAL_ENV: '${{ github.workspace }}/venv' + run: | + python3 -m venv $VIRTUAL_ENV + export PATH="$VIRTUAL_ENV/bin:$PATH" + python3 -m pip install lief + python3 ./tools/symbol-check.py .libs/libsecp256k1.dylib + - run: cat tests.log || true if: ${{ always() }} - run: cat noverify_tests.log || true @@ -753,6 +772,14 @@ jobs: run: | cd build/src/RelWithDebInfo && file *tests.exe bench*.exe libsecp256k1-*.dll || true + - name: Symbol check + if: ${{ matrix.configuration.cmake_options != '-A x64 -DBUILD_SHARED_LIBS=OFF' }} + run: | + choco install --yes --no-progress python3 + refreshenv + python -m pip install lief + python .\tools\symbol-check.py build\src\RelWithDebInfo\libsecp256k1-2.dll + - name: Check run: | ctest -C RelWithDebInfo --test-dir build -j ([int]$env:NUMBER_OF_PROCESSORS + 1) diff --git a/ci/ci.sh b/ci/ci.sh index a6c608c29c..89fb15832c 100755 --- a/ci/ci.sh +++ b/ci/ci.sh @@ -14,7 +14,7 @@ print_environment() { for var in WERROR_CFLAGS MAKEFLAGS BUILD \ ECMULTWINDOW ECMULTGENKB ASM WIDEMUL WITH_VALGRIND EXTRAFLAGS \ EXPERIMENTAL ECDH RECOVERY EXTRAKEYS SCHNORRSIG ELLSWIFT \ - SECP256K1_TEST_ITERS BENCH SECP256K1_BENCH_ITERS CTIMETESTS\ + SECP256K1_TEST_ITERS BENCH SECP256K1_BENCH_ITERS CTIMETESTS SYMBOL_CHECK \ EXAMPLES \ HOST WRAPPER_CMD \ CC CFLAGS CPPFLAGS AR NM \ @@ -106,6 +106,19 @@ file *tests* || true file bench* || true file .libs/* || true +if [ "$SYMBOL_CHECK" = "yes" ] +then + case "$HOST" in + *mingw*) + ls -l .libs + python3 ./tools/symbol-check.py .libs/libsecp256k1-2.dll + ;; + *) + python3 ./tools/symbol-check.py .libs/libsecp256k1.so + ;; + esac +fi + # This tells `make check` to wrap test invocations. export LOG_COMPILER="$WRAPPER_CMD" diff --git a/ci/linux-debian.Dockerfile b/ci/linux-debian.Dockerfile index 241bfa9719..547b402232 100644 --- a/ci/linux-debian.Dockerfile +++ b/ci/linux-debian.Dockerfile @@ -32,7 +32,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross libc6-dbg:ppc64el \ gcc-mingw-w64-x86-64-win32 wine64 wine \ gcc-mingw-w64-i686-win32 wine32 \ - python3 && \ + python3-full && \ if ! ( dpkg --print-architecture | grep --quiet "arm64" ) ; then \ apt-get install --no-install-recommends -y \ gcc-aarch64-linux-gnu libc6-dev-arm64-cross libc6-dbg:arm64 ;\ @@ -77,3 +77,7 @@ RUN \ apt-get autoremove -y wget && \ apt-get clean && rm -rf /var/lib/apt/lists/* +ENV VIRTUAL_ENV=/root/venv +RUN python3 -m venv $VIRTUAL_ENV +ENV PATH="$VIRTUAL_ENV/bin:$PATH" +RUN pip install lief