From 8331141038ed5950c69764ddefb51cc96a321cfd Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Mon, 2 Dec 2024 16:15:42 +0000 Subject: [PATCH] ci: Test cross-built Windows executables on Windows natively --- .github/workflows/ci.yml | 62 ++++++++++++++++++++++++++++++++++- ci/test/00_setup_env_win64.sh | 7 ++-- ci/test/03_test_script.sh | 4 --- ci/test/wrap-wine.sh | 20 ----------- 4 files changed, 63 insertions(+), 30 deletions(-) delete mode 100755 ci/test/wrap-wine.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90dac75badfcb..9b79f63f9d737 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -260,7 +260,7 @@ jobs: py -3 test\fuzz\test_runner.py --par %NUMBER_OF_PROCESSORS% --loglevel DEBUG %RUNNER_TEMP%\qa-assets\fuzz_corpora windows-cross: - name: 'Windows cross, unit tests, no gui tests, no functional tests' + name: 'Windows cross, no tests' runs-on: ubuntu-latest if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }} @@ -303,6 +303,66 @@ jobs: path: ${{ env.CCACHE_DIR }} key: ${{ github.job }}-ccache-${{ github.run_id }} + - name: Upload built executables + uses: actions/upload-artifact@v4 + with: + name: x86_64-w64-mingw32-executables-${{ github.run_id }} + path: | + ${{ env.BASE_BUILD_DIR }}/src/**/*.exe + ${{ env.BASE_BUILD_DIR }}/test/config.ini + + windows-native-test: + name: 'Test on Windows' + runs-on: windows-2022 + needs: windows-cross + + env: + PYTHONUTF8: 1 + TEST_RUNNER_TIMEOUT_FACTOR: 40 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download built executables + uses: actions/download-artifact@v4 + with: + name: x86_64-w64-mingw32-executables-${{ github.run_id }} + + - name: Run bitcoind.exe + run: .\src\bitcoind.exe -version + + - name: Run unit tests + run: | + .\src\test\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 + + - name: Run benchmarks + run: .\src\bench\bench_bitcoin.exe -sanity-check -priority-level=high + + - name: Adjust paths in test\config.ini + run: | + (Get-Content "test\config.ini") -replace '(?<=^SRCDIR=).*', '${{ github.workspace }}' -replace '(?<=^BUILDDIR=).*', '${{ github.workspace }}' -replace '(?<=^RPCAUTH=).*', '${{ github.workspace }}\share\rpcauth\rpcauth.py' | Set-Content "test\config.ini" + Get-Content "test\config.ini" + + - name: Run util tests + run: py -3 test\util\test_runner.py + + - name: Run rpcauth test + run: py -3 test\util\rpcauth-test.py + + - name: Run functional tests + env: + # TODO: Fix the excluded tests and re-enable them. + EXCLUDE: '--exclude wallet_migration.py,wallet_multiwallet.py' + TEST_RUNNER_EXTRA: ${{ github.event_name != 'pull_request' && '--extended' || '' }} + shell: cmd + run: py -3 test\functional\test_runner.py --jobs %NUMBER_OF_PROCESSORS% --ci --quiet --tmpdirprefix=%RUNNER_TEMP% --combinedlogslen=99999999 --timeout-factor=%TEST_RUNNER_TIMEOUT_FACTOR% %EXCLUDE% %TEST_RUNNER_EXTRA% + asan-lsan-ubsan-integer-no-depends-usdt: name: 'ASan + LSan + UBSan + integer, no depends, USDT' runs-on: ubuntu-24.04 # has to match container in ci/test/00_setup_env_native_asan.sh for tracing tools diff --git a/ci/test/00_setup_env_win64.sh b/ci/test/00_setup_env_win64.sh index 25da64c524d41..413f49e4d4ceb 100755 --- a/ci/test/00_setup_env_win64.sh +++ b/ci/test/00_setup_env_win64.sh @@ -9,11 +9,8 @@ export LC_ALL=C.UTF-8 export CONTAINER_NAME=ci_win64 export CI_IMAGE_NAME_TAG="docker.io/amd64/debian:bookworm" # Check that https://packages.debian.org/bookworm/g++-mingw-w64-x86-64-posix (version 12.2, similar to guix) can cross-compile export HOST=x86_64-w64-mingw32 -export DPKG_ADD_ARCH="i386" -export PACKAGES="nsis g++-mingw-w64-x86-64-posix wine-binfmt wine64 wine32 file" -# Install wine, but do not run unit tests, as they surface frequent -# false-positives. -export RUN_UNIT_TESTS=${RUN_UNIT_TESTS:-false} +export PACKAGES="g++-mingw-w64-x86-64-posix nsis" +export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false export GOAL="deploy" # Prior to 11.0.0, the mingw-w64 headers were missing noreturn attributes, causing warnings when diff --git a/ci/test/03_test_script.sh b/ci/test/03_test_script.sh index 6e77a8927c222..7ae6419ee7afc 100755 --- a/ci/test/03_test_script.sh +++ b/ci/test/03_test_script.sh @@ -134,10 +134,6 @@ bash -c "${PRINT_CCACHE_STATISTICS}" du -sh "${DEPENDS_DIR}"/*/ du -sh "${PREVIOUS_RELEASES_DIR}" -if [[ $HOST = *-mingw32 ]]; then - "${BASE_ROOT_DIR}/ci/test/wrap-wine.sh" -fi - if [ -n "$USE_VALGRIND" ]; then "${BASE_ROOT_DIR}/ci/test/wrap-valgrind.sh" fi diff --git a/ci/test/wrap-wine.sh b/ci/test/wrap-wine.sh deleted file mode 100755 index a0d32a93a3f9c..0000000000000 --- a/ci/test/wrap-wine.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (c) 2020-2022 The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -export LC_ALL=C.UTF-8 - -for b_name in {"${BASE_OUTDIR}/bin"/*,src/univalue/{test_json,unitester,object}}.exe; do - # shellcheck disable=SC2044 - for b in $(find "${BASE_ROOT_DIR}" -executable -type f -name "$(basename "$b_name")"); do - if (file "$b" | grep "Windows"); then - echo "Wrap $b ..." - mv "$b" "${b}_orig" - echo '#!/usr/bin/env bash' > "$b" - echo "( wine \"${b}_orig\" \"\$@\" ) || ( sleep 1 && wine \"${b}_orig\" \"\$@\" )" >> "$b" - chmod +x "$b" - fi - done -done