Windows cross-build: unit test `system_tests/run_command` fails and functional tests cannot start `bitcoind` #34150

issue DevPatel-11 opened this issue on December 25, 2025
  1. DevPatel-11 commented at 5:10 PM on December 25, 2025: none

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    Following doc/build-windows.md using WSL + MinGW on Windows, build + install succeed and the GUI runs, but tests fail:

    1. The unit test system_tests/run_command in test_bitcoin.exe fails with an assertion on the expected error message.
    2. Functional tests (wallet_basic.py and --coverage) fail to start bitcoind with Assertion failed: base.is_absolute(), file ./util/fs.cpp, line 36.

    So, building and running the GUI works, but the documented unit and functional tests do not pass on this configuration.

    Expected behaviour

    After a successful cross-build using doc/build-windows.md, the enabled unit tests (test_bitcoin) and basic functional tests (like wallet_basic.py and --coverage) should run and pass on this supported WSL + MinGW configuration, in line with src/test/README.md and test/functional/README.md.

    Steps to reproduce

    All commands are run inside WSL (Ubuntu). The source tree is not under /mnt/c, but under the WSL filesystem.

    1. Clone and enter the repo:
    git clone https://github.com/bitcoin/bitcoin.git
    cd bitcoin
    
    1. Build depends (per doc/build-windows.md):
    gmake -C depends HOST=x86_64-w64-mingw32
    
    1. Configure and build (per doc/build-windows.md):
    cmake -B build --toolchain depends/x86_64-w64-mingw32/toolchain.cmake
    cmake --build build
    
    1. Install to Windows (bitcoind/bitcoin-qt work fine from here):
    cmake --install build --prefix /mnt/c/workspace/bitcoin
    
    1. Build unit tests:
    cmake --build build --target test_bitcoin
    
    1. Run the specific unit test:
    cd ~/bitcoin/build/bin
    ./test_bitcoin.exe --run_test=system_tests/run_command --log_level=test_suite
    
    1. Run a functional test and coverage (from repo root):
    cd ~/bitcoin
    build/test/functional/test_runner.py wallet_basic.py
    build/test/functional/test_runner.py --coverage
    

    Relevant log output

    Unit test failure:

    cd ~/bitcoin/build/bin
    ./test_bitcoin.exe --run_test=system_tests/run_command --log_level=test_suite
    

    Output (trimmed):

    Entering test module "Bitcoin Core Test Suite"
    ./wallet/test/walletload_tests.cpp(14): Test suite "walletload_tests" is skipped because disabled
    ... (many test suites skipped because disabled) ...
    ./test/testnet4_miner_tests.cpp(30): Test suite "testnet4_miner_tests" is skipped because disabled
    ./test/system_tests.cpp(17): Entering test suite "system_tests"
    ./test/system_tests.cpp(21): Entering test case "run_command"
    ./test/system_tests.cpp(56): error: in "system_tests/run_command": check what.find(tfm::format("RunCommandParseJSON error: process(%s) returned 1: \n", command)) != std::string::npos has failed
    ./test/system_tests.cpp(21): Leaving test case "run_command"; testing time: 196716us
    ./test/system_tests.cpp(17): Leaving test suite "system_tests"; testing time: 199262us
    ./test/system_ram_tests.cpp(13): Test suite "system_ram_tests" is skipped because disabled
    ... (more suites skipped) ...
    Leaving test module "Bitcoin Core Test Suite"; testing time: 433839us
    
    *** 1 failure is detected in the test module "Bitcoin Core Test Suite"
    

    Functional test failure (wallet_basic.py):

    cd ~/bitcoin
    build/test/functional/test_runner.py wallet_basic.py
    

    Output:

    Temporary test directory at /tmp/test_runner_₿_🏃_20251225_162435
    Remaining jobs: [wallet_basic.py]
    1/1 - wallet_basic.py failed, Duration: 57 s
    
    stdout:
    2025-12-25T16:24:35.518658Z TestFramework (INFO): PRNG seed is: 6050933089769083783
    2025-12-25T16:24:35.520147Z TestFramework (INFO): Initializing test directory /tmp/test_runner_₿_🏃_20251225_162435/wallet_basic_0
    2025-12-25T16:25:32.647545Z TestFramework (ERROR): Unexpected exception
    Traceback (most recent call last):
      File "/home/kelos/bitcoin/test/functional/test_framework/test_framework.py", line 138, in main
        self.setup()
      File "/home/kelos/bitcoin/test/functional/test_framework/test_framework.py", line 269, in setup
        self.setup_network()
      File "/home/kelos/bitcoin/build/test/functional/wallet_basic.py", line 44, in setup_network
        self.setup_nodes()
      File "/home/kelos/bitcoin/test/functional/test_framework/test_framework.py", line 382, in setup_nodes
        self.start_nodes()
      File "/home/kelos/bitcoin/test/functional/test_framework/test_framework.py", line 528, in start_nodes
        node.wait_for_rpc_connection()
      File "/home/kelos/bitcoin/test/functional/test_framework/test_node.py", line 316, in wait_for_rpc_connection
        raise FailedToStartError(self._node_msg(
    test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status 3 during initialization. Assertion failed: base.is_absolute(), file ./util/fs.cpp, line 36
    ************************
    
    2025-12-25T16:25:32.699370Z TestFramework (INFO): Not stopping nodes as test failed. The dangling processes will be cleaned up later.
    2025-12-25T16:25:32.699638Z TestFramework (WARNING): Not cleaning up dir /tmp/test_runner_₿_🏃_20251225_162435/wallet_basic_0
    2025-12-25T16:25:32.699739Z TestFramework (ERROR): Test failed. Test logging available at /tmp/test_runner_₿_🏃_20251225_162435/wallet_basic_0/test_framework.log
    2025-12-25T16:25:32.699905Z TestFramework (ERROR):
    2025-12-25T16:25:32.700105Z TestFramework (ERROR): Hint: Call /home/kelos/bitcoin/test/functional/combine_logs.py '/tmp/test_runner_₿_🏃_20251225_162435/wallet_basic_0' to consolidate all logs
    2025-12-25T16:25:32.700184Z TestFramework (ERROR):
    2025-12-25T16:25:32.700424Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
    2025-12-25T16:25:32.700571Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
    2025-12-25T16:25:32.700677Z TestFramework (ERROR):
    
    stderr:
    [node 3] Cleaning up leftover process
    [node 2] Cleaning up leftover process
    [node 1] Cleaning up leftover process
    [node 0] Cleaning up leftover process
    
    TEST            | STATUS    | DURATION
    wallet_basic.py | ✖ Failed  | 57 s
    
    ALL             | ✖ Failed  | 57 s (accumulated)
    Runtime: 57 s
    

    Functional test failure with --coverage:

    cd ~/bitcoin
    build/test/functional/test_runner.py --coverage
    

    Output:

    Temporary test directory at /tmp/test_runner_₿_🏃_20251225_162532
    Initializing coverage directory at /tmp/coveragemf6gv9tr
    [node 0] Cleaning up leftover process
    2025-12-25T16:25:32.916746Z TestFramework (INFO): PRNG seed is: 332623413216244638
    2025-12-25T16:25:32.917531Z TestFramework (INFO): Initializing test directory /tmp/test_runner_₿_🏃_20251225_162532/cache
    2025-12-25T16:25:35.676350Z TestFramework (ERROR): Unexpected exception
    Traceback (most recent call last):
      File "/home/kelos/bitcoin/test/functional/test_framework/test_framework.py", line 138, in main
        self.setup()
      File "/home/kelos/bitcoin/test/functional/test_framework/test_framework.py", line 268, in setup
        self.setup_chain()
      File "/home/kelos/bitcoin/test/functional/test_framework/test_framework.py", line 356, in setup_chain
        self._initialize_chain()
      File "/home/kelos/bitcoin/test/functional/test_framework/test_framework.py", line 814, in _initialize_chain
        self.start_node(CACHE_NODE_ID)
      File "/home/kelos/bitcoin/test/functional/test_framework/test_framework.py", line 514, in start_node
        node.wait_for_rpc_connection()
      File "/home/kelos/bitcoin/test/functional/test_node.py", line 316, in wait_for_rpc_connection
        raise FailedToStartError(self._node_msg(
    test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status 3 during initialization. Assertion failed: base.is_absolute(), file ./util/fs.cpp, line 36
    ************************
    
    2025-12-25T16:25:35.729866Z TestFramework (INFO): Not stopping nodes as test failed. The dangling processes will be cleaned up later.
    2025-12-25T16:25:35.730219Z TestFramework (WARNING): Not cleaning up dir /tmp/test_runner_₿_🏃_20251225_162532/cache
    2025-12-25T16:25:35.730333Z TestFramework (ERROR): Test failed. Test logging available at /tmp/test_runner_₿_🏃_20251225_162532/cache/test_framework.log
    2025-12-25T16:25:35.730631Z TestFramework (ERROR):
    2025-12-25T16:25:35.730888Z TestFramework (ERROR): Hint: Call /home/kelos/bitcoin/test/functional/combine_logs.py '/tmp/test_runner_₿_🏃_20251225_162532/cache' to consolidate all logs
    2025-12-25T16:25:35.731025Z TestFramework (ERROR):
    2025-12-25T16:25:35.731110Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
    2025-12-25T16:25:35.731245Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
    2025-12-25T16:25:35.731393Z TestFramework (ERROR):
    
    Traceback (most recent call last):
      File "/home/kelos/bitcoin/build/test/functional/test_runner.py", line 931, in <module>
        main()
      File "/home/kelos/bitcoin/build/test/functional/test_runner.py", line 542, in main
        run_tests(
      File "/home/kelos/bitcoin/build/test/functional/test_runner.py", line 595, in run_tests
        subprocess.check_output([sys.executable, tests_dir + 'create_cache.py'] + flags + ["--tmpdir=%s/cache" % tmpdir])
      File "/usr/lib/python3.12/subprocess.py", line 466, in check_output
        return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
      File "/usr/lib/python3.12/subprocess.py", line 571, in run
        raise CalledProcessError(retcode, process.args,
    subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/kelos/bitcoin/build/test/functional/create_cache.py', '--cachedir=/home/kelos/bitcoin/build/test/cache', '--configfile=/home/kelos/bitcoin/build/test/functional/../config.ini', '--coveragedir=/tmp/coveragemf6gv9tr', '--tmpdir=/tmp/test_runner_₿_🏃_20251225_162532/cache']' returned non-zero exit status 1.
    

    How did you obtain Bitcoin Core

    Compiled from source

    What version of Bitcoin Core are you using?

    master@d861c3820528fad2e17a455949bec70b6ba434dcc

    Operating system and version

    Windows 10.0.26200.7462 (host), WSL2 with Ubuntu; wsl.exe --version: - WSL version: 2.6.2.0 - Kernel version: 6.6.87.2-1 - WSLg version: 1.0.71 - MSRDC version: 1.2.6353 - Direct3D version: 1.611.1-81528511 - DXCore version: 10.0.26100.1-240331-1435.ge-release

    Machine specifications

    CPU:

    • 12th Gen Intel Core i5-12500H (x86_64)
    • 8 cores / 16 threads (lscpu)
    • L3 cache: 18 MiB

    Memory:

    • 16 GiB RAM total
    • ~11 GiB free, 4 GiB swap (free -h)

    Disk:

    • Host C: drive 454 GiB total, 219 GiB free (df -h, /mnt/c)
    • WSL root filesystem on /dev/sdd: 1.0 TiB total, 946 GiB free

    Distro inside WSL:

    • Ubuntu 24.04.3 LTS (noble) (lsb_release -a)
  2. maflcko commented at 7:08 AM on December 26, 2025: member

    Not sure what your goal is, but I think you are trying to run a Windows executable inside the WSL env (possibly through Wine?). Is this really what you are doing and what you want to be doing? I think it makes more sense to either:

    • Natively compile for Linux inside WSL, and run natively for Linux inside WSL
    • Cross-compile for Windows inside WSL, and run natively outside of WSL in Windows
    • Compile natively on and for Windows, and run natively on Windows
  3. DevPatel-11 commented at 7:28 AM on December 26, 2025: none

    Thanks for the quick reply!

    Just to clarify what I tested:

    • Cross-compile for Windows in WSL using doc/build-windows.md (depends + CMake).
    • Installed to C:\workspace\bitcoin and successfully ran bitcoin-qt.exe on Windows.
    • For tests, I stayed in WSL and ran build/bin/test_bitcoin.exe and build/test/functional/test_runner.py, which then start the cross-built bitcoind.exe.

    If running the Windows test binaries from WSL is considered unsupported, I’m happy to switch to:

    • building natively for Linux in WSL and running tests there, or
    • running tests only with Linux binaries for this environment.

    In that case, this issue can be closed as “unsupported configuration”; I mainly wanted to check whether this cross-build + WSL test combination is expected to work or not.

  4. maflcko commented at 7:43 AM on December 26, 2025: member

    For tests, I stayed in WSL and ran build/bin/test_bitcoin.exe and build/test/functional/test_runner.py, which then start the cross-built bitcoind.exe.

    So you did that via Wine? For reference, Wine was dropped from the CI config, due to issues: #31284 (comment).

    If running the Windows test binaries from WSL is considered unsupported, I’m happy to switch to:

    * building natively for Linux in WSL and running tests there, or
    
    * running tests only with Linux binaries for this environment.

    In that case, this issue can be closed as “unsupported configuration”; I mainly wanted to check whether this cross-build + WSL test combination is expected to work or not.

    Well, if there is an obvious bug and an obvious fix for an issue, I am happy to review it. However, I don't think the config will ever be added back to the CI matrix, because I don't see a real use-case behind it.

  5. DevPatel-11 commented at 7:52 AM on December 26, 2025: none

    Thanks for the clarification!

    To answer your question: I did not use Wine anywhere. All commands were run directly in WSL:

    • Cross-compile for Windows in WSL using doc/build-windows.md.
    • Run the resulting .exe binaries from WSL by invoking ./build/bin/test_bitcoin.exe and the functional tests, which then start the cross-built bitcoind.exe.

    Given your comment that this configuration (running Windows binaries under WSL, similar to what CI used to do with Wine) is not really supported and won’t be in the CI matrix, I’m fine treating this as an unsupported setup.

    My goal with this issue was mainly to confirm whether this combination is expected to work or not, and share the exact failures I saw in case they point to an obvious bug / simple fix.

    If you think this should be closed, I’m happy for you to close it !

  6. maflcko commented at 9:16 AM on December 26, 2025: member

    For reference, i pushed commit https://github.com/maflcko/bitcoin-core-with-ci/commit/c1387e48e12db0ee3efbdf80b91d5267d81c3301 : and it passed: https://github.com/maflcko/bitcoin-core-with-ci/actions/runs/20518628300/job/58950286007#step:7:4867

    diff --git a/ci/test/00_setup_env_win64_msvcrt.sh b/ci/test/00_setup_env_win64_msvcrt.sh
    index 86e0ea9c80..9c72b6fddd 100755
    --- a/ci/test/00_setup_env_win64_msvcrt.sh
    +++ b/ci/test/00_setup_env_win64_msvcrt.sh
    @@ -9,8 +9,9 @@ export LC_ALL=C.UTF-8
     export CONTAINER_NAME=ci_win64_msvcrt
     export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"  # Check that https://packages.ubuntu.com/noble/g++-mingw-w64-x86-64-posix (version 13.x, similar to guix) can cross-compile
     export HOST=x86_64-w64-mingw32
    -export PACKAGES="g++-mingw-w64-x86-64-posix nsis"
    -export RUN_UNIT_TESTS=false
    +export DPKG_ADD_ARCH="i386"
    +export PACKAGES="nsis g++-mingw-w64-x86-64-posix wine-binfmt wine64 wine32 file"
    +export RUN_UNIT_TESTS=true
     export RUN_FUNCTIONAL_TESTS=false
     export GOAL="deploy"
     export BITCOIN_CONFIG="\
    diff --git a/ci/test/03_test_script.sh b/ci/test/03_test_script.sh
    index d29de80c3e..0b39f205c9 100755
    --- a/ci/test/03_test_script.sh
    +++ b/ci/test/03_test_script.sh
    @@ -157,6 +157,10 @@ if [ -n "${CI_LIMIT_STACK_SIZE}" ]; then
       ulimit -s 512
     fi
     
    +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
    new file mode 100755
    index 0000000000..a0d32a93a3
    --- /dev/null
    +++ b/ci/test/wrap-wine.sh
    @@ -0,0 +1,20 @@
    +#!/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
    
  7. maflcko commented at 9:17 AM on December 26, 2025: member

    My goal with this issue was mainly to confirm whether this combination is expected to work or not, and share the exact failures I saw in case they point to an obvious bug / simple fix.

    If you think this should be closed, I’m happy for you to close it !

    This is up to you. I can't reproduce the bug and I don't think anyone will work on this issue, so you'll have to create and submit a fix yourself. If not, then maybe this can indeed be closed.

    You may also try #33929, if it improves your situation.

  8. DevPatel-11 commented at 9:36 AM on December 26, 2025: none

    Thanks for the feedback. I will try #33929 and see if it helps. I'll close this issue now. Thanks for understanding!

  9. DevPatel-11 closed this on Dec 26, 2025

  10. hebasto added the label Windows on Dec 27, 2025
  11. hebasto commented at 10:29 PM on December 27, 2025: member
    • Cross-compile for Windows in WSL using doc/build-windows.md.

    • Run the resulting .exe binaries from WSL by invoking ./build/bin/test_bitcoin.exe and the functional tests, which then start the cross-built bitcoind.exe.

    FWIW, when working on Windows, it is worth considering building natively using clang-cl.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 03:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me