feat: add Plan 20 Slice 1 CMake native translation, self-test smoke target, VL-009 VOID_TEST check, and warm-cache hardening
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 5s

This commit is contained in:
faumaray committed 2026-11-27 05:38:18 +03:00
1 parent 363fb8200e
commit d3d2666965
19 files changed
+1466 -65

No files matched your search

+95
View File
@@ -339,3 +339,98 @@ void build(Void::Build::Project &p) {
std::string::npos);
}
}
// VL-009: Verify VoidLibrary's upstream self-registering `VOID_TEST(suite, name)` macro works
// purely with `g++` (zero CMake AND zero external scanner) including equal-basename files!
Void::Testing::Test native_void_test_macro_zero_cmake_and_basename_collisions() {
const std::filesystem::path void_src{VBS_VOID_SOURCE_PATH};
Void::Testing::expect(std::filesystem::is_directory(void_src));
Void::FileSystem::TempDir tmp{"vbs_vl009_"};
const auto build_dir = tmp / "build";
const auto src_dir = tmp / "tests";
// Two distinct subdirectories containing files with the exact same basename `Unit.cpp`!
write_file(src_dir / "alpha" / "Unit.cpp", R"cpp(
#include <Void/Testing/Assert.hpp>
#include <Void/Testing/Test.hpp>
VOID_TEST(AlphaSuite, addition_works) {
Void::Testing::expect_eq(2 + 2, 4);
}
)cpp");
write_file(src_dir / "beta" / "Unit.cpp", R"cpp(
#include <Void/Testing/Assert.hpp>
#include <Void/Testing/Test.hpp>
VOID_TEST(BetaSuite, multiplication_works) {
Void::Testing::expect_eq(6 * 7, 42);
}
)cpp");
auto ctx = default_profiles().resolve("debug", CompilerFamily::Gcc, Toolchain::host_os_name(),
Toolchain::host_architecture_name());
auto tc = Toolchain::discover_and_probe(ctx, build_dir / ".vbs" / "probes");
Void::Testing::expect(tc.has_value());
if (!tc)
return;
Project proj{ctx};
auto void_libs = Recipes::add_void_library_native(proj, void_src, {"Testing"});
// Zero CMake AND zero `vbs gen-tests` scanner — just compile the two Unit.cpp files directly!
auto exe = proj.executable("vl009_native_tests");
exe.cxx_standard(CxxStandard::Cxx26)
.sources(SourceSet::file((src_dir / "alpha" / "Unit.cpp").string()))
.sources(SourceSet::file((src_dir / "beta" / "Unit.cpp").string()))
.compile_option("-freflection")
.link(void_libs.modules.at("Testing"));
auto desc = Graph::ProjectDescription::from_json(proj.to_json());
Void::Testing::expect(desc.has_value());
if (!desc)
return;
auto graph =
Graph::lower_project_graph(*desc, *tc, {tmp.path(), build_dir, nullptr, {}, 32768});
Void::Testing::expect(graph.has_value());
auto state = State::StateStore::open(build_dir / ".vbs");
Void::Testing::expect(state.has_value());
if (!graph || !state)
return;
auto exec =
Execution::execute_graph(*graph, *state, {4, true, true, {"vl009_native_tests"}, {}, {}});
Void::Testing::expect(exec.has_value() && exec->succeeded);
if (!exec || !exec->succeeded)
return;
const auto bin = build_dir / "profiles" / "debug" / "out" / "bin" / "vl009_native_tests";
Platform::ProcessRequest list_req;
list_req.executable = bin;
list_req.arguments = {"--list", "--no-color"};
auto listed = Platform::run_supervised(list_req);
Void::Testing::expect(listed.has_value() && listed->succeeded());
if (listed) {
Void::Testing::expect(listed->stdout_data.find("addition_works") != std::string::npos);
Void::Testing::expect(listed->stdout_data.find("multiplication_works") !=
std::string::npos);
}
Platform::ProcessRequest filter_req;
filter_req.executable = bin;
filter_req.arguments = {"--no-color", "--filter", "multiplication_works"};
auto filtered = Platform::run_supervised(filter_req);
Void::Testing::expect(filtered.has_value() && filtered->succeeded());
if (filtered) {
Void::Testing::expect(filtered->stdout_data.find("1 tests:") != std::string::npos);
}
Platform::ProcessRequest all_req;
all_req.executable = bin;
all_req.arguments = {"--no-color"};
auto ran = Platform::run_supervised(all_req);
Void::Testing::expect(ran.has_value() && ran->succeeded());
if (ran) {
Void::Testing::expect(ran->stdout_data.find("2 tests:") != std::string::npos);
}
}