ci: Add run_tests step to ci-windows.py

This is mostly a refactor, except for using the runner workspace (cwd) for:
* fuzz qa-assets
* functional temp prefix

This makes it easier to run the ci-windows.py locally.
This commit is contained in:
MarcoFalke
2026-02-06 10:16:22 +01:00
parent fa561682ce
commit 1111079a16
2 changed files with 65 additions and 28 deletions

63
.github/ci-windows.py vendored
View File

@@ -73,7 +73,7 @@ def prepare_tests(ci_type):
if ci_type == "standard":
run([sys.executable, "-m", "pip", "install", "pyzmq"])
elif ci_type == "fuzz":
repo_dir = os.path.join(os.environ["RUNNER_TEMP"], "qa-assets")
repo_dir = os.path.join(os.getcwd(), "qa-assets")
clone_cmd = [
"git",
"clone",
@@ -86,6 +86,64 @@ def prepare_tests(ci_type):
run(["git", "-C", repo_dir, "log", "-1"])
def run_tests(ci_type):
build_dir = "build"
num_procs = str(os.process_cpu_count())
release_bin = os.path.join(os.getcwd(), build_dir, "bin", "Release")
if ci_type == "standard":
test_envs = {
"BITCOIN_BIN": "bitcoin.exe",
"BITCOIND": "bitcoind.exe",
"BITCOINCLI": "bitcoin-cli.exe",
"BITCOIN_BENCH": "bench_bitcoin.exe",
"BITCOINTX": "bitcoin-tx.exe",
"BITCOINUTIL": "bitcoin-util.exe",
"BITCOINWALLET": "bitcoin-wallet.exe",
"BITCOINCHAINSTATE": "bitcoin-chainstate.exe",
}
for var, exe in test_envs.items():
os.environ[var] = os.path.join(release_bin, exe)
ctest_cmd = [
"ctest",
"--test-dir",
build_dir,
"--output-on-failure",
"--stop-on-failure",
"-j",
num_procs,
"--build-config",
"Release",
]
run(ctest_cmd)
test_cmd = [
sys.executable,
os.path.join(build_dir, "test", "functional", "test_runner.py"),
"--jobs",
num_procs,
"--quiet",
f"--tmpdirprefix={os.getcwd()}",
"--combinedlogslen=99999999",
*shlex.split(os.environ.get("TEST_RUNNER_EXTRA", "").strip()),
]
run(test_cmd)
elif ci_type == "fuzz":
os.environ["BITCOINFUZZ"] = os.path.join(release_bin, "fuzz.exe")
fuzz_cmd = [
sys.executable,
os.path.join(build_dir, "test", "fuzz", "test_runner.py"),
"--par",
num_procs,
"--loglevel",
"DEBUG",
os.path.join(os.getcwd(), "qa-assets", "fuzz_corpora"),
]
run(fuzz_cmd)
def main():
parser = argparse.ArgumentParser(description="Utility to run Windows CI steps.")
parser.add_argument("ci_type", choices=GENERATE_OPTIONS, help="CI type to run.")
@@ -93,6 +151,7 @@ def main():
"generate",
"build",
"prepare_tests",
"run_tests",
]
parser.add_argument("step", choices=steps, help="CI step to perform.")
args = parser.parse_args()
@@ -103,6 +162,8 @@ def main():
build()
elif args.step == "prepare_tests":
prepare_tests(args.ci_type)
elif args.step == "run_tests":
run_tests(args.ci_type)
if __name__ == "__main__":