feat: complete Track A zero-CMake self-hosting, full VOID_TEST migration, and bit-identical Stage 2/3 bootstrap
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 2s

This commit is contained in:
faumaray committed 2026-11-27 06:51:43 +03:00
1 parent fe0d1a6483
commit 5e1916dc5c
23 files changed
+945 -141

No files matched your search

+102 -15
View File
@@ -83,10 +83,25 @@ void write_raw_tar(const std::filesystem::path &tar_path,
out.write(end.data(), 1024);
}
std::filesystem::path locate_vbs_binary() {
std::error_code ec;
if (const auto self = std::filesystem::read_symlink("/proc/self/exe", ec);
!ec && !self.empty()) {
const auto sibling = self.parent_path() / "vbs";
if (std::filesystem::exists(sibling, ec)) {
return sibling;
}
}
if (!Bootstrap::binary_dir.empty()) {
return std::filesystem::path{Bootstrap::binary_dir} / "bin" / "vbs";
}
return {};
}
} // namespace
// === Plan 09: CompDB projection, selection ticket races, user-file preservation, recovery ===
Void::Testing::Test compdb_projection_ticket_races_and_user_file_preservation() {
VOID_TEST(FullV1Tests, compdb_projection_ticket_races_and_user_file_preservation) {
Void::FileSystem::TempDir tmp{"vbs_compdb_"};
const auto proj = tmp / "proj";
const auto build_dir = tmp / "build";
@@ -193,7 +208,7 @@ Void::Testing::Test compdb_projection_ticket_races_and_user_file_preservation()
}
// === Plan 10: Inotify watcher + strict MetadataOnly watch boundary ===
Void::Testing::Test watcher_inotify_and_metadata_only_forbids_foreign_configure() {
VOID_TEST(FullV1Tests, watcher_inotify_and_metadata_only_forbids_foreign_configure) {
Void::FileSystem::TempDir tmp{"vbs_watch_"};
const auto proj = tmp / "proj";
const auto build_dir = tmp / "build";
@@ -246,7 +261,7 @@ void build(Void::Build::Project &p) {
}
// === Plan 11: TOML 1.0, PubGrub solver (with exhaustive oracle), atomic CAS lockfile ===
Void::Testing::Test toml_solver_oracle_and_atomic_cas_lockfile() {
VOID_TEST(FullV1Tests, toml_solver_oracle_and_atomic_cas_lockfile) {
Void::FileSystem::TempDir tmp{"vbs_pkg_"};
const auto toml_file = tmp / "vbs.deps.toml";
write_file(toml_file, R"toml(
@@ -385,7 +400,7 @@ features = ["header-only"]
}
// === Plan 12: Deterministic tar, malicious archive security, binary ABI matching, redaction ===
Void::Testing::Test archive_security_determinism_binary_abi_and_redaction() {
VOID_TEST(FullV1Tests, archive_security_determinism_binary_abi_and_redaction) {
Void::FileSystem::TempDir tmp{"vbs_arc_"};
const auto proj = tmp / "pkg_src";
write_file(proj / "build.cpp", "void build(Void::Build::Project&) {}\n");
@@ -443,7 +458,7 @@ Void::Testing::Test archive_security_determinism_binary_abi_and_redaction() {
// === Plan 13, 14, 15: Real CMake provider, Meson provider, VbsDeps.cmake bridge, Install/Relocate
// ===
Void::Testing::Test foreign_cmake_meson_providers_bridge_and_relocatable_install() {
VOID_TEST(FullV1Tests, foreign_cmake_meson_providers_bridge_and_relocatable_install) {
Void::FileSystem::TempDir tmp{"vbs_foreign_"};
auto ctx = default_profiles().resolve("debug", CompilerFamily::Gcc, Toolchain::host_os_name(),
Toolchain::host_architecture_name());
@@ -615,10 +630,11 @@ static_library('m_helper', 'src/helper.cpp', include_directories: inc)
Void::Testing::expect(!std::filesystem::exists(prefix_b / "lib" / "libwrap.a"));
// 5. Real CMake Bridge (VbsDeps.cmake) consumer test!
const auto vbs_bin = std::filesystem::path{Bootstrap::binary_dir} / "bin" / "vbs";
const auto vbs_bin = locate_vbs_binary();
const auto bridge_module =
std::filesystem::path{Bootstrap::source_dir} / "cmake" / "bridge" / "VbsDeps.cmake";
if (std::filesystem::exists(vbs_bin) && Platform::resolve_executable("cmake").has_value()) {
if (!vbs_bin.empty() && std::filesystem::exists(vbs_bin) &&
Platform::resolve_executable("cmake").has_value()) {
const auto br_proj = tmp / "bridge_consumer";
write_file(br_proj / "CMakeLists.txt",
"cmake_minimum_required(VERSION 4.0)\n"
@@ -691,7 +707,7 @@ void build(Void::Build::Project &p) {
// === Plan 08: Modern C++ (GCC16 P1689 named modules + partitions, cycle/dup checks, unity, PCH)
// ===
Void::Testing::Test modern_cpp_modules_scan_collation_cycles_and_unity_exclusion() {
VOID_TEST(FullV1Tests, modern_cpp_modules_scan_collation_cycles_and_unity_exclusion) {
Void::FileSystem::TempDir tmp{"vbs_mod_"};
auto ctx = default_profiles().resolve("debug", CompilerFamily::Gcc, Toolchain::host_os_name(),
Toolchain::host_architecture_name());
@@ -797,7 +813,7 @@ Void::Testing::Test modern_cpp_modules_scan_collation_cycles_and_unity_exclusion
}
// === Plan 04/08/19 Matrix: Clang 23 target toolchain probe, build, and P1689 module scan ===
Void::Testing::Test clang23_target_toolchain_and_p1689_module_scan() {
VOID_TEST(FullV1Tests, clang23_target_toolchain_and_p1689_module_scan) {
if (!Platform::resolve_executable("clang++").has_value()) {
return; // Only skip if Clang is genuinely absent from PATH.
}
@@ -899,7 +915,7 @@ Void::Testing::Test clang23_target_toolchain_and_p1689_module_scan() {
}
// === Plan 08 Full Graph Integration: Modules+Partitions, Unity+PerFile, HeaderUnit, Sanitizers ===
Void::Testing::Test graph_lowering_modules_partitions_unity_header_units_and_sanitizers() {
VOID_TEST(FullV1Tests, graph_lowering_modules_partitions_unity_header_units_and_sanitizers) {
Void::FileSystem::TempDir tmp{"vbs_plan08_"};
auto ctx = default_profiles().resolve("debug", CompilerFamily::Gcc, Toolchain::host_os_name(),
Toolchain::host_architecture_name());
@@ -1057,7 +1073,7 @@ Void::Testing::Test graph_lowering_modules_partitions_unity_header_units_and_san
// === Plan 20 Slice 1: Bounded native CMake graph translation, equivalence, mutations & fallback
// ===
Void::Testing::Test plan20_bounded_cmake_translation_equivalence_mutations_and_fallback() {
VOID_TEST(FullV1Tests, plan20_bounded_cmake_translation_equivalence_mutations_and_fallback) {
Void::FileSystem::TempDir tmp{"vbs_plan20_"};
auto ctx = default_profiles().resolve("debug", CompilerFamily::Gcc, Toolchain::host_os_name(),
Toolchain::host_architecture_name());
@@ -1217,7 +1233,7 @@ target_include_directories(p20_genlib PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
// === Plan 20 Slice 2A: Bounded native Meson graph translation + unsupported custom_target fallback
// ===
Void::Testing::Test plan20_bounded_meson_translation_equivalence_and_fallback() {
VOID_TEST(FullV1Tests, plan20_bounded_meson_translation_equivalence_and_fallback) {
if (!Platform::resolve_executable("meson").has_value()) {
return;
}
@@ -1332,9 +1348,9 @@ static_library('mgenlib', ['src/gen.cpp', gen])
}
// === Wave 8 DX CLI: vbs init -> vbs test -> vbs graph -> vbs doctor -> vbs clean ===
Void::Testing::Test cli_init_graph_clean_doctor_end_to_end() {
const auto vbs_bin = std::filesystem::path{Bootstrap::binary_dir} / "bin" / "vbs";
if (!std::filesystem::exists(vbs_bin)) {
VOID_TEST(FullV1Tests, cli_init_graph_clean_doctor_end_to_end) {
const auto vbs_bin = locate_vbs_binary();
if (vbs_bin.empty() || !std::filesystem::exists(vbs_bin)) {
return;
}
Void::FileSystem::TempDir tmp{"vbs_dx_"};
@@ -1399,3 +1415,74 @@ Void::Testing::Test cli_init_graph_clean_doctor_end_to_end() {
Void::Testing::expect(r_clean_all.has_value() && r_clean_all->succeeded());
Void::Testing::expect(!std::filesystem::exists(bdir));
}
// === Track A1: Native VBS subproject dependency (builder == "native", zero CMake!) ===
VOID_TEST(FullV1Tests, native_vbs_subproject_dependency_builds_without_cmake) {
const auto vbs_bin = locate_vbs_binary();
Void::Testing::expect(!vbs_bin.empty() && std::filesystem::exists(vbs_bin));
if (vbs_bin.empty() || !std::filesystem::exists(vbs_bin)) {
return;
}
Void::FileSystem::TempDir tmp{"vbs_native_subproj_"};
const auto trap_bin = tmp / "trap_bin";
write_file(trap_bin / "cmake",
"#!/bin/sh\necho 'FORBIDDEN CMAKE INVOCATION IN NATIVE DEP BUILD' >&2\nexit 99\n");
std::filesystem::permissions(trap_bin / "cmake", std::filesystem::perms::owner_exec |
std::filesystem::perms::owner_read |
std::filesystem::perms::owner_write |
std::filesystem::perms::group_exec |
std::filesystem::perms::others_exec);
std::string trapped_path = trap_bin.string();
if (const char *old_path = std::getenv("PATH")) {
trapped_path += ":";
trapped_path += old_path;
}
// Pure `build.cpp` library dependency (NO CMakeLists.txt!).
const auto dep_dir = tmp / "sub_math_dep";
write_file(dep_dir / "build.cpp", R"cpp(#include <Void/Build.hpp>
void build(Void::Build::Project &p) {
auto lib = p.static_library("sub_math");
lib.cxx_standard(Void::Build::CxxStandard::Cxx26)
.sources({"src/math.cpp"})
.include_directory("include", Void::Build::Visibility::Public);
}
)cpp");
write_file(dep_dir / "include" / "sub_math.hpp", "#pragma once\nint sub_math_answer();\n");
write_file(dep_dir / "src" / "math.cpp",
"#include \"sub_math.hpp\"\nint sub_math_answer() { return 42; }\n");
const auto cons_dir = tmp / "consumer";
const auto cons_build = tmp / "consumer_build";
write_file(cons_dir / "build.cpp",
"#include <Void/Build.hpp>\n"
"void build(Void::Build::Project &p) {\n"
" auto dep = p.dependency(\"math\").path(\"" +
dep_dir.string() +
"\").native_builder();\n"
" p.test(\"consumer_test\")\n"
" .cxx_standard(Void::Build::CxxStandard::Cxx26)\n"
" .sources({\"tests/main.cpp\"})\n"
" .link(dep.target(\"sub_math\"));\n"
"}\n");
write_file(
cons_dir / "tests" / "main.cpp",
"#include \"sub_math.hpp\"\nint main() { return sub_math_answer() == 42 ? 0 : 1; }\n");
Platform::ProcessRequest req;
req.executable = vbs_bin;
req.arguments = {"test", "--project", cons_dir.string(), "--build-dir", cons_build.string()};
req.environment.set_vars["PATH"] = trapped_path;
req.timeout = std::chrono::seconds{120};
auto res = Platform::run_supervised(req);
Void::Testing::expect_eq(
res ? (res->succeeded() ? std::string{} : (res->stdout_data + res->stderr_data))
: res.error().message(),
std::string{});
Void::Testing::expect(res.has_value() && res->succeeded());
if (res) {
Void::Testing::expect(res->stdout_data.find("PASSED 'consumer_test'") != std::string::npos);
}
}