"""Test the actual kernel probe body with mock CI; run in an x64 VS dev shell.""" from pathlib import Path import re import subprocess import tempfile tests = Path(__file__).resolve().parent header = (tests.parent / "include/Domito.MinCrypt.h").read_text(encoding="utf-8-sig") names = ["MINCRYPT_MAX_HASH_LENGTH", "DOMITO_CI_VALIDATE_FLAG_BROADEN_ROOT_ACCEPTANCE"] constants = "\n".join( re.search(r"^#define\s+" + name + r"\s+[^\r\n]+", header, re.M)[0] for name in names ) with tempfile.TemporaryDirectory(prefix="domito-ci-probe-") as temp: build = Path(temp) (build / "ci-probe-constants.inc").write_text(constants + "\n", encoding="utf-8") exe = build / "ci-probe-tests.exe" subprocess.run( [ "cl", "/nologo", "/EHsc", "/W4", "/WX", "/std:c++17", "/I" + str(build), str(tests / "ci-file-object-probe-tests.cpp"), "/Fe" + str(exe), "/Fo" + str(build / "ci-probe-tests.obj"), ], cwd=build, check=True, ) subprocess.run([str(exe)], cwd=build, check=True)