mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 15:19:07 +01:00
As a first step, implement the equivalent of what was implemented in the now deprecated libbitcoinconsensus header. Also add a test binary to exercise the header and library. Unlike the deprecated libbitcoinconsensus the kernel library can now use the hardware-accelerated sha256 implementations thanks for its statically-initialzed context. The functions kept around for backwards-compatibility in the libbitcoinconsensus header are not ported over. As a new header, it should not be burdened by previous implementations. Also add a new error code for handling invalid flag combinations, which would otherwise cause a crash. The macros used in the new C header were adapted from the libsecp256k1 header. To make use of the C header from C++ code, a C++ header is also introduced for wrapping the C header. This makes it safer and easier to use from C++ code. Co-authored-by: stickies-v <stickies-v@protonmail.com>
70 lines
1.8 KiB
Python
Executable File
70 lines
1.8 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) The Bitcoin Core developers
|
|
# Distributed under the MIT software license, see the accompanying
|
|
# file COPYING or https://opensource.org/license/mit/.
|
|
|
|
import subprocess
|
|
import sys
|
|
import shlex
|
|
|
|
|
|
def run(cmd, **kwargs):
|
|
print("+ " + shlex.join(cmd), flush=True)
|
|
try:
|
|
return subprocess.run(cmd, check=True, **kwargs)
|
|
except Exception as e:
|
|
sys.exit(e)
|
|
|
|
|
|
def main():
|
|
print("Running tests on commit ...")
|
|
run(["git", "log", "-1"])
|
|
|
|
num_procs = int(run(["nproc"], stdout=subprocess.PIPE).stdout)
|
|
|
|
run([
|
|
"cmake",
|
|
"-B",
|
|
"build",
|
|
"-Werror=dev",
|
|
# Use clang++, because it is a bit faster and uses less memory than g++
|
|
"-DCMAKE_C_COMPILER=clang",
|
|
"-DCMAKE_CXX_COMPILER=clang++",
|
|
# Use mold, because it is faster than the default linker
|
|
"-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=mold",
|
|
# Use Debug build type for more debug checks, but enable optimizations
|
|
"-DAPPEND_CXXFLAGS='-O3 -g2'",
|
|
"-DAPPEND_CFLAGS='-O3 -g2'",
|
|
"-DCMAKE_BUILD_TYPE=Debug",
|
|
"-DWERROR=ON",
|
|
"-DWITH_ZMQ=ON",
|
|
"-DBUILD_GUI=ON",
|
|
"-DBUILD_BENCH=ON",
|
|
"-DBUILD_FUZZ_BINARY=ON",
|
|
"-DWITH_USDT=ON",
|
|
"-DBUILD_KERNEL_LIB=ON",
|
|
"-DBUILD_KERNEL_TEST=ON",
|
|
"-DCMAKE_CXX_FLAGS=-Wno-error=unused-member-function",
|
|
])
|
|
run(["cmake", "--build", "build", "-j", str(num_procs)])
|
|
run([
|
|
"ctest",
|
|
"--output-on-failure",
|
|
"--stop-on-failure",
|
|
"--test-dir",
|
|
"build",
|
|
"-j",
|
|
str(num_procs),
|
|
])
|
|
run([
|
|
sys.executable,
|
|
"./build/test/functional/test_runner.py",
|
|
"-j",
|
|
str(num_procs * 2),
|
|
"--combinedlogslen=99999999",
|
|
])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|