From 8aa9aa05c55aed301f8ff23fb63d6f99fb414167 Mon Sep 17 00:00:00 2001 From: will Date: Fri, 20 Jun 2025 09:58:09 +0100 Subject: [PATCH 1/3] build: decouple secp256 tests from BUILD_TESTS These tests add a minimum of a few minutes to the unit test runtime, and at worst see runtime double. Decouple them from ${BUILD_TESTS} so that they can be more selectively enabled/disabled. --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 96a6790e612c..e565b64503b6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -33,8 +33,8 @@ set(SECP256K1_ENABLE_MODULE_ECDH OFF CACHE BOOL "" FORCE) set(SECP256K1_ENABLE_MODULE_RECOVERY ON CACHE BOOL "" FORCE) set(SECP256K1_ENABLE_MODULE_MUSIG OFF CACHE BOOL "" FORCE) set(SECP256K1_BUILD_BENCHMARK OFF CACHE BOOL "" FORCE) -set(SECP256K1_BUILD_TESTS ${BUILD_TESTS} CACHE BOOL "" FORCE) -set(SECP256K1_BUILD_EXHAUSTIVE_TESTS ${BUILD_TESTS} CACHE BOOL "" FORCE) +set(SECP256K1_BUILD_TESTS OFF CACHE BOOL "") +set(SECP256K1_BUILD_EXHAUSTIVE_TESTS OFF CACHE BOOL "") if(NOT BUILD_TESTS) # Always skip the ctime tests, if we are building no other tests. # Otherwise, they are built if Valgrind is available. See SECP256K1_VALGRIND. From 7c1fb9ef7199b0920d1e7e7bd7bac9ec0969a8f8 Mon Sep 17 00:00:00 2001 From: will Date: Fri, 20 Jun 2025 11:21:23 +0100 Subject: [PATCH 2/3] ci: Remove secp tests from window cross job --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 69c119d73719..3783e1c7f4e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -374,9 +374,6 @@ jobs: # Can't use ctest here like other jobs as we don't have a CMake build tree. run: | ./bin/test_bitcoin.exe -l test_suite - ./src/secp256k1/bin/exhaustive_tests.exe - ./src/secp256k1/bin/noverify_tests.exe - ./src/secp256k1/bin/tests.exe ./src/univalue/object.exe ./src/univalue/unitester.exe From 5ad028f15321df7cb5a8d54577a90bde4b4dfe30 Mon Sep 17 00:00:00 2001 From: will Date: Fri, 20 Jun 2025 09:58:16 +0100 Subject: [PATCH 3/3] ci: add secp256 unit test workflow This workflow job detects whether the secp256k1 subtree was updated, and if it was will build and run the secp256k1 unit tests. These are disabled by default (in other CI jobs), as they double the runtime needed, and rarely change. --- .github/workflows/secp256.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/secp256.yml diff --git a/.github/workflows/secp256.yml b/.github/workflows/secp256.yml new file mode 100644 index 000000000000..85b78fb25733 --- /dev/null +++ b/.github/workflows/secp256.yml @@ -0,0 +1,37 @@ +# Copyright (c) 2025-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit. + +name: secp256k1 tests +on: + pull_request: + paths: + - 'src/secp256k1/**' + push: + paths: + - 'src/secp256k1/**' + +env: + MAKEJOBS: '-j10' + +jobs: + secp256k1-tests: + name: 'secp256k1 tests' + runs-on: ubuntu-24.04 + if: github.event_name == 'pull_request' + timeout-minutes: 120 + steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y build-essential cmake pkgconf python3 libevent-dev libboost-dev libsqlite3-dev + - name: Build with secp256k1 tests enabled + run: | + cmake -B build \ + -DSECP256K1_BUILD_TESTS=ON \ + -DSECP256K1_BUILD_EXHAUSTIVE_TESTS=ON + cmake --build build -j $(nproc) + - name: Run secp256k1 tests + run: | + # Run only the secp256k1 tests + ctest --test-dir build --output-on-failure -R "secp256k1" -j $(nproc)