Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1#!/usr/bin/env python32# Copyright (c) The Bitcoin Core developers3# Distributed under the MIT software license, see the accompanying4# file COPYING or https://opensource.org/license/mit/.6import subprocess7import sys8import shlex11def run(cmd, **kwargs):12print("+ " + shlex.join(cmd), flush=True)13kwargs.setdefault("check", True)14try:15return subprocess.run(cmd, **kwargs)16except Exception as e:17sys.exit(str(e))20def main():21print("Running tests on commit ...")22run(["git", "log", "-1"])24num_procs = int(run(["nproc"], stdout=subprocess.PIPE).stdout)25build_dir = "ci_build"27run([28"cmake",29"-B",30build_dir,31"-Werror=dev",32# Use clang++, because it is a bit faster and uses less memory than g++33"-DCMAKE_C_COMPILER=clang",34"-DCMAKE_CXX_COMPILER=clang++",35# Use mold, because it is faster than the default linker36"-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=mold",37# Use Debug build type for more debug checks, but enable optimizations38"-DAPPEND_CXXFLAGS='-O3 -g2'",39"-DAPPEND_CFLAGS='-O3 -g2'",40"-DCMAKE_BUILD_TYPE=Debug",41"-DCMAKE_COMPILE_WARNING_AS_ERROR=ON",42"--preset=dev-mode",43# Tolerate unused (member) functions in intermediate commits in a pull request44"-DCMAKE_CXX_FLAGS=-Wno-error=unused-member-function -Wno-error=unused-function",45])47if run(["cmake", "--build", build_dir, "-j", str(num_procs)], check=False).returncode != 0:48print("Build failure. Verbose build follows.")49run(["cmake", "--build", build_dir, "-j1", "--verbose"])51run([52"ctest",53"--output-on-failure",54"--stop-on-failure",55"--test-dir",56build_dir,57"-j",58str(num_procs),59])60run([61sys.executable,62f"./{build_dir}/test/functional/test_runner.py",63"-j",64str(num_procs * 2),65"--failfast",66"--combinedlogslen=99999999",67])70if __name__ == "__main__":71main()
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.