From 6befa6b5e26782297f4038ba0238b8c0440449dd Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Sat, 5 Dec 2026 12:52:50 +0300 Subject: [PATCH] feat(test): support CTest-style fixtures in the test runner --- docs/agent-workflow/STATE.md | 2 + docs/agent-workflow/TASKS.md | 1 + docs/agent-workflow/VERIFICATION.md | 12 +++ docs/roadmap/22-superiority-and-gaps.md | 4 +- include/Void/Build.hpp | 10 +- include/Void/Build/Graph/Graph.hpp | 3 + sdk/Build.cpp | 21 ++++ src/Graph/Graph.cpp | 6 ++ src/Main.cpp | 124 ++++++++++++++++++++---- tests/FullV1Tests.cpp | 107 ++++++++++++++++++++ 10 files changed, 268 insertions(+), 22 deletions(-) diff --git a/docs/agent-workflow/STATE.md b/docs/agent-workflow/STATE.md index dcbadb5..f335d1a 100644 --- a/docs/agent-workflow/STATE.md +++ b/docs/agent-workflow/STATE.md @@ -358,6 +358,8 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B - **Wave 132 (Test Labels, Resource Locks & Parallel Tests)**: the SDK gained `.label("name")` and `.resource("name")` on targets (round-tripped through the descriptor JSON), and `vbs test` now runs test targets in parallel up to `--jobs` while serializing tests that share a resource, and filters with `--label`. `FullV1Tests.test_labels_filter_and_resource_locks_serialize` covers label filtering and asserts that shared-resource start/end intervals never overlap under 4 jobs. +- **Wave 133 (CTest-Style Fixtures)**: added `.fixture_setup()`, `.fixture_required()` and `.fixture_cleanup()` on targets (round-tripped through the descriptor JSON). The parallel test runner now pulls fixture setup/cleanup tests in automatically, orders them with prerequisites (setup before users, cleanup after every user), and skips dependents when a setup fails. `FullV1Tests.test_fixtures_setup_required_cleanup_ordering` verifies the order (setup first, cleanup last) and the skip-on-failed-setup path. + ## Remaining future scope - **Superiority plan ([22-superiority-and-gaps.md](../roadmap/22-superiority-and-gaps.md), 2026-12-05)**: revised platform strategy - **macOS deferred**, **Windows via MinGW-w64 cross-compilation + Wine execution** (`dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc`, `dev cpp-gcc -p wine64`), native MSVC deferred; plus packaging parity (ZIP/DEB/RPM), IDE ecosystem, migration tooling, test-runner parity, benchmarks, CI runners, and remote execution in prioritized order. diff --git a/docs/agent-workflow/TASKS.md b/docs/agent-workflow/TASKS.md index e1c21af..8762376 100644 --- a/docs/agent-workflow/TASKS.md +++ b/docs/agent-workflow/TASKS.md @@ -133,4 +133,5 @@ Base HEAD: `fe0d1a6` | Wave 128 (Lease renewal + idle timeout) | `actions//renew`, `renew_action_lease`, `worker --idle-timeout/--once` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; worker E2E passes, full CTest 8/8) | `registry/service/RegistryService.cpp`, `src/Package/RegistryClient.cpp`, `src/Main.cpp`, `tests/RegistryTests.cpp`, docs | | Wave 131 (warm-build latency + plugin tests) | Stat-fingerprint memo for descriptor identity/header hashes; generated VS Code test harness | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; vbs warm 92 ms vs 209 ms baseline, generated harness passes under Node, full CTest 8/8) | `src/Config/Frontend.cpp`, `src/Editor/CompDb.cpp`, `tests/FullV1Tests.cpp`, `benchmarks/compare.sh`, docs | | Wave 132 (Test labels, resource locks, parallel tests) | `.label()`/`.resource()` SDK, `--label` filter, parallel test runner with exclusive resources | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; E2E passes, full CTest 8/8) | `include/Void/Build.hpp`, `sdk/Build.cpp`, `src/Main.cpp`, `src/Graph/Graph.cpp`, `tests/FullV1Tests.cpp`, docs | +| Wave 133 (CTest-style fixtures) | `.fixture_setup/required/cleanup` SDK; runner pulls in helpers, orders setup->users->cleanup, skips dependents on failed setup | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; E2E passes, full CTest 8/8) | `include/Void/Build.hpp`, `sdk/Build.cpp`, `src/Main.cpp`, `src/Graph/Graph.cpp`, `tests/FullV1Tests.cpp`, docs | | Future (Plan 20 Slice 3 / Tracks C, E3 editor extensions) |"}] Live `conan` CLI verification; macOS/Windows/cross-compile; binary-variant signing and key distribution; daemon-side dependency materialization and editor plugins; `Void::Net`/`Void::Sqlite` alignment | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) | diff --git a/docs/agent-workflow/VERIFICATION.md b/docs/agent-workflow/VERIFICATION.md index 436f385..fd8c3f3 100644 --- a/docs/agent-workflow/VERIFICATION.md +++ b/docs/agent-workflow/VERIFICATION.md @@ -1752,6 +1752,18 @@ VOID_INCLUDE_DIR=/tmp/opencode/vl-pin/include dev cpp -c bash fuzz/run.sh 30 `order.log` never overlap (a manual run shows `a-start a-end b-start b-end`). - Full CTest: **8 / 8 passed** in 295.18 s. +## CTest-Style Fixtures (GCC 16.2, pin `0002e74`) + +- SDK: `.fixture_setup("db")`, `.fixture_required("db")`, `.fixture_cleanup("db")`; serialized by + the descriptor and parsed back into `TargetRecord`/`ResolvedTargetSummary`. +- Runner: requiring tests pull in the fixture's setup/cleanup automatically; the parallel + scheduler enforces setup -> users -> cleanup ordering via prerequisites, and a failed setup + marks dependents as skipped (`SKIPPED '...' (fixture setup failed)`) while the run fails. +- `FullV1Tests.test_fixtures_setup_required_cleanup_ordering` **passed** (4.01 s): with + `--label uses`, `order.log` is exactly `setup, use_*, use_*, cleanup`; with `--label baduse` + the run fails and `bad_use` never passes. +- Full CTest: **8 / 8 passed** in 302.00 s. + ## Limits and Unrun Checks 1. **HTTPS git fetch**: the host shell is proxy-restricted, but the Docker container could clone `https://git.faumaray.com/Void/VoidLibrary.git`; the pinned commit `3e254055e081a104f08df68dde39711bc7813518` was fetched directly for the verification above. A separate configure against the local `/home/faumaray/Projects/Library` checkout via `VBS_VOID_SOURCE_DIR` also succeeded (development-only override, checkout unmodified). diff --git a/docs/roadmap/22-superiority-and-gaps.md b/docs/roadmap/22-superiority-and-gaps.md index 82d6312..45b4c5a 100644 --- a/docs/roadmap/22-superiority-and-gaps.md +++ b/docs/roadmap/22-superiority-and-gaps.md @@ -15,7 +15,7 @@ build2 documentation was **not** available through Context7; build2 statements b | Remote / distributed execution workers | Deferred | `20`, R-015 | | VoidLibrary's own `build.cpp` | Open | `recipes/VoidLibrary/` builds it inside VBS, but VoidLibrary is not yet migrated | | Installer generators | Partial | deterministic tar + self-extracting `sh` + SBOM + Ed25519; DEB/RPM/MSI/DMG-style generators missing | -| Test-runner parity | Partial | `VOID_TEST` runner; labels/resource locks/timeouts/JUnit done; fixtures and CDash missing | +| Test-runner parity | Partial | `VOID_TEST` runner; fixtures/labels/resource locks/timeouts/JUnit done; CDash missing | | IDE ecosystem | Partial | `vbs ide` + CompDB + daemon protocol; no File API shim, presets import, or plugins | | CI on real runners, sanitizers, fuzzing | Unverified | the GitHub Actions workflow is a template that has never run | @@ -54,7 +54,7 @@ Concrete work this implies: | Package/registry | External (vcpkg, Conan, FetchContent) | wrapdb, subprojects | cppget.org / brep | **Built-in registry + solver + lock + binary variants + signatures + SBOM** | federation, mirrors, key distribution | | Install/package | `install()`, `install(EXPORT)`, CPack (TGZ/ZIP/DEB/RPM/WIX/DMG/NuGet/APK…) | `install_data`, `install_headers`, dist scripts | install module | prefix staging, components, relocatable CMake + native exports, tar, self-extracting `sh`, **stored ZIP**, **DEB (dpkg-validated)**, SBOM, **Ed25519-signed archives with checksums** | **RPM (rpm 6.1-validated)**, **WiX source for MSI** (candle/light on Windows), DMG-style | | IDE integration | File API, presets, every IDE | `meson-info` introspection | limited | `vbs ide generate/query`, CompDB, daemon protocol | File API shim, `CMakePresets.json` import, plugins | -| Test runner | CTest: fixtures, labels, resource locks, timeouts, JUnit/CDash | `meson test`: suites, timeouts, JUnit | test module | `VOID_TEST` runner; `vbs test --junit --test-timeout --label`; parallel tests with resource locks | fixtures, CDash | +| Test runner | CTest: fixtures, labels, resource locks, timeouts, JUnit/CDash | `meson test`: suites, timeouts, JUnit | test module | `VOID_TEST` runner; `vbs test --junit --test-timeout --label`; parallel tests with resource locks and fixtures | CDash | | Incremental / cache | compiler depfiles, ccache external | depfiles, ccache | internal caching model | **content-addressed state, immutable snapshots, remote action cache** | scale benchmarks | | Modules / PCH / unity / LTO / sanitizers | yes (with generator quirks) | yes | yes | **native with capability probing** | more compilers | | Reproducibility | opt-in | opt-in | partial | **default deterministic** (epoch, prefix maps, canonical mtimes) | cross-platform determinism | diff --git a/include/Void/Build.hpp b/include/Void/Build.hpp index 4a26bc4..6768fc6 100644 --- a/include/Void/Build.hpp +++ b/include/Void/Build.hpp @@ -201,8 +201,11 @@ struct TargetRecord { std::vector action_outputs; std::string working_directory; std::map> environment; - std::vector labels; // Test labels for filtering (`vbs test --label`). - std::vector resources; // Exclusive resources held while the test runs. + std::vector labels; // Test labels for filtering (`vbs test --label`). + std::vector resources; // Exclusive resources held while the test runs. + std::vector fixture_setup; // Fixtures this test sets up. + std::vector fixture_required; // Fixtures this test requires. + std::vector fixture_cleanup; // Fixtures this test tears down. bool nondeterministic{false}; bool enabled{true}; bool use_conventional_sources{false}; @@ -288,6 +291,9 @@ class Target { Target &env(std::string key, std::string value); Target &label(std::string label); Target &resource(std::string name); + Target &fixture_setup(std::string name); + Target &fixture_required(std::string name); + Target &fixture_cleanup(std::string name); Target &nondeterministic(bool enabled = true); Target &enabled(bool flag); Target &install(std::string destination = {}, std::string component = "default"); diff --git a/include/Void/Build/Graph/Graph.hpp b/include/Void/Build/Graph/Graph.hpp index ce4ef53..88ad64f 100644 --- a/include/Void/Build/Graph/Graph.hpp +++ b/include/Void/Build/Graph/Graph.hpp @@ -100,6 +100,9 @@ struct ResolvedTargetSummary { bool enabled{true}; std::vector labels; std::vector resources; + std::vector fixture_setup; + std::vector fixture_required; + std::vector fixture_cleanup; std::vector expanded_sources; std::vector primary_outputs; std::vector runtime_shared_libraries; diff --git a/sdk/Build.cpp b/sdk/Build.cpp index 88602cd..07e8d06 100644 --- a/sdk/Build.cpp +++ b/sdk/Build.cpp @@ -866,6 +866,24 @@ Target &Target::resource(std::string name) { return *this; } +Target &Target::fixture_setup(std::string name) { + require_text(name, "fixture name"); + owner(owner_)->targets.at(index_).fixture_setup.push_back(std::move(name)); + return *this; +} + +Target &Target::fixture_required(std::string name) { + require_text(name, "fixture name"); + owner(owner_)->targets.at(index_).fixture_required.push_back(std::move(name)); + return *this; +} + +Target &Target::fixture_cleanup(std::string name) { + require_text(name, "fixture name"); + owner(owner_)->targets.at(index_).fixture_cleanup.push_back(std::move(name)); + return *this; +} + Target &Target::enabled(bool flag) { owner(owner_)->targets.at(index_).enabled = flag; return *this; @@ -1236,6 +1254,9 @@ std::string Project::to_json() const { ",\"environment\":" + env_json(target.environment) + ",\"labels\":" + json_array(target.labels, json_quote) + ",\"resources\":" + json_array(target.resources, json_quote) + + ",\"fixture_setup\":" + json_array(target.fixture_setup, json_quote) + + ",\"fixture_required\":" + json_array(target.fixture_required, json_quote) + + ",\"fixture_cleanup\":" + json_array(target.fixture_cleanup, json_quote) + ",\"nondeterministic\":" + std::string{target.nondeterministic ? "true" : "false"} + ",\"enabled\":" + std::string{target.enabled ? "true" : "false"} + ",\"use_conventional_sources\":" + diff --git a/src/Graph/Graph.cpp b/src/Graph/Graph.cpp index 384b073..5f580df 100644 --- a/src/Graph/Graph.cpp +++ b/src/Graph/Graph.cpp @@ -333,6 +333,9 @@ ProjectDescription::from_json(std::string_view json_text) { t.nondeterministic = get_bool(*to, "nondeterministic", false); t.labels = get_str_array(*to, "labels"); t.resources = get_str_array(*to, "resources"); + t.fixture_setup = get_str_array(*to, "fixture_setup"); + t.fixture_required = get_str_array(*to, "fixture_required"); + t.fixture_cleanup = get_str_array(*to, "fixture_cleanup"); t.enabled = get_bool(*to, "enabled", true); t.use_conventional_sources = get_bool(*to, "use_conventional_sources", false); if (const auto *irv = find_key(*to, "install_rule")) { @@ -745,6 +748,9 @@ lower_project_graph(const ProjectDescription &description, summary.enabled = t.enabled; summary.labels = t.labels; summary.resources = t.resources; + summary.fixture_setup = t.fixture_setup; + summary.fixture_required = t.fixture_required; + summary.fixture_cleanup = t.fixture_cleanup; // 1. Collect prerequisite action IDs (explicit depends_on + linked target producers). std::vector target_prereq_actions; diff --git a/src/Main.cpp b/src/Main.cpp index cf977d5..c57b80a 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -848,44 +849,119 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) { std::string name; std::filesystem::path executable; std::vector resources; + std::vector prerequisites; }; std::vector test_jobs; - for (const auto &t : graph->targets) { + std::map job_by_target; // graph target index -> job index + + // Candidate test targets passing the target filter (labels never exclude fixture + // helpers - they are pulled in by the tests that require them). + std::vector candidates; + for (std::size_t i = 0; i < graph->targets.size(); ++i) { + const auto &t = graph->targets[i]; if (t.kind != TargetKind::Test || t.primary_outputs.empty()) { continue; } if (!opts.targets.empty() && !std::ranges::contains(opts.targets, t.name)) { continue; } + candidates.push_back(i); + } + std::map, std::less<>> setups_by_fixture; + std::map, std::less<>> cleanups_by_fixture; + for (const auto i : candidates) { + for (const auto &fixture : graph->targets[i].fixture_setup) { + setups_by_fixture[fixture].push_back(i); + } + for (const auto &fixture : graph->targets[i].fixture_cleanup) { + cleanups_by_fixture[fixture].push_back(i); + } + } + std::map, std::less<>> fixture_users; + std::set adding; // recursion guard for fixture cycles + const auto add_prerequisite = [](TestJob &job, std::size_t prerequisite) { + if (!std::ranges::contains(job.prerequisites, prerequisite)) { + job.prerequisites.push_back(prerequisite); + } + }; + std::function add_job = + [&](std::size_t target_index) -> std::size_t { + if (const auto it = job_by_target.find(target_index); it != job_by_target.end()) { + return it->second; + } + const auto &t = graph->targets[target_index]; + const std::size_t job_index = test_jobs.size(); + test_jobs.push_back(TestJob{t.name, t.primary_outputs.front(), t.resources, {}}); + job_by_target[target_index] = job_index; + if (!adding.insert(target_index).second) { + return job_index; // Fixture cycle: stop recursing. + } + for (const auto &fixture : t.fixture_required) { + const auto setup_it = setups_by_fixture.find(fixture); + if (setup_it != setups_by_fixture.end() && !setup_it->second.empty()) { + add_prerequisite(test_jobs[job_index], add_job(setup_it->second.front())); + } + fixture_users[fixture].push_back(job_index); + } + adding.erase(target_index); + return job_index; + }; + for (const auto i : candidates) { + const auto &t = graph->targets[i]; if (!opts.labels.empty() && !std::ranges::any_of(opts.labels, [&](const std::string &label) { return std::ranges::contains(t.labels, label); })) { continue; } - test_jobs.push_back(TestJob{t.name, t.primary_outputs.front(), t.resources}); + add_job(i); + } + // A fixture's cleanup runs after every test that used it (and after its setup). + for (const auto &[fixture, users] : fixture_users) { + const auto cleanup_it = cleanups_by_fixture.find(fixture); + if (cleanup_it == cleanups_by_fixture.end()) { + continue; + } + for (const auto cleanup_target : cleanup_it->second) { + const auto cleanup_job = add_job(cleanup_target); + for (const auto user : users) { + add_prerequisite(test_jobs[cleanup_job], user); + } + const auto setup_it = setups_by_fixture.find(fixture); + if (setup_it != setups_by_fixture.end() && !setup_it->second.empty()) { + add_prerequisite(test_jobs[cleanup_job], + job_by_target.at(setup_it->second.front())); + } + } } // Tests run in parallel up to --jobs, except that tests sharing a resource are - // serialized (a resource is held exclusively while its test runs). + // serialized (a resource is held exclusively while its test runs) and fixture + // prerequisites run first. std::vector> records(test_jobs.size()); std::mutex test_mutex; std::condition_variable test_cv; std::set held_resources; std::vector claimed(test_jobs.size(), false); + std::vector completed(test_jobs.size(), false); + std::vector failed(test_jobs.size(), false); std::size_t remaining = test_jobs.size(); const std::size_t worker_count = std::max( 1, std::min( jobs == 0 ? std::max(1u, std::thread::hardware_concurrency()) : jobs, std::max(1, test_jobs.size()))); + const auto prerequisites_done = [&](std::size_t i) { + return std::ranges::all_of(test_jobs[i].prerequisites, + [&](std::size_t p) { return completed[p]; }); + }; + const auto resources_free = [&](std::size_t i) { + return std::ranges::none_of(test_jobs[i].resources, [&](const std::string &r) { + return held_resources.contains(r); + }); + }; const auto any_runnable = [&] { for (std::size_t i = 0; i < test_jobs.size(); ++i) { - if (claimed[i]) { - continue; - } - if (std::ranges::none_of(test_jobs[i].resources, [&](const std::string &r) { - return held_resources.contains(r); - })) { + if (!claimed[i] && prerequisites_done(i) && resources_free(i)) { return true; } } @@ -901,19 +977,29 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) { return; } for (; index < test_jobs.size(); ++index) { - if (claimed[index]) { - continue; - } - if (std::ranges::none_of(test_jobs[index].resources, - [&](const std::string &r) { - return held_resources.contains(r); - })) { + if (!claimed[index] && prerequisites_done(index) && + resources_free(index)) { break; } } claimed[index] = true; - for (const auto &r : test_jobs[index].resources) { - held_resources.insert(r); + // A failed fixture setup skips its dependents. + const bool blocked = + std::ranges::any_of(test_jobs[index].prerequisites, + [&](std::size_t p) { return failed[p]; }); + if (blocked) { + Void::Log::warn("Test", "[{}] SKIPPED '{}' (fixture setup failed)", + prof_name, test_jobs[index].name); + completed[index] = true; + --remaining; + } else { + for (const auto &r : test_jobs[index].resources) { + held_resources.insert(r); + } + } + if (blocked) { + test_cv.notify_all(); + continue; } } const auto &job = test_jobs[index]; @@ -955,6 +1041,8 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) { held_resources.erase(r); } records[index] = std::move(record); + completed[index] = true; + failed[index] = !passed; --remaining; } test_cv.notify_all(); diff --git a/tests/FullV1Tests.cpp b/tests/FullV1Tests.cpp index 87dabe5..9dfa0fa 100644 --- a/tests/FullV1Tests.cpp +++ b/tests/FullV1Tests.cpp @@ -2213,6 +2213,113 @@ void build(Void::Build::Project &p) { Void::Testing::expect(!overlapped); } +// === Test-runner parity: CTest-style fixtures (setup/required/cleanup) === +VOID_TEST(FullV1Tests, test_fixtures_setup_required_cleanup_ordering) { + 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_fixtures_"}; + const auto proj = tmp / "proj"; + const auto bdir = tmp / "build"; + + write_file(proj / "build.cpp", R"cpp(#include +void build(Void::Build::Project &p) { + p.test("db_setup") + .cxx_standard(Void::Build::CxxStandard::Cxx26) + .sources({"tests/setup.cpp"}) + .fixture_setup("db"); + p.test("db_use_a") + .cxx_standard(Void::Build::CxxStandard::Cxx26) + .sources({"tests/use_a.cpp"}) + .fixture_required("db") + .label("uses"); + p.test("db_use_b") + .cxx_standard(Void::Build::CxxStandard::Cxx26) + .sources({"tests/use_b.cpp"}) + .fixture_required("db") + .label("uses"); + p.test("db_cleanup") + .cxx_standard(Void::Build::CxxStandard::Cxx26) + .sources({"tests/cleanup.cpp"}) + .fixture_cleanup("db"); + p.test("bad_setup") + .cxx_standard(Void::Build::CxxStandard::Cxx26) + .sources({"tests/bad_setup.cpp"}) + .fixture_setup("bad"); + p.test("bad_use") + .cxx_standard(Void::Build::CxxStandard::Cxx26) + .sources({"tests/bad_use.cpp"}) + .fixture_required("bad") + .label("baduse"); +} +)cpp"); + const std::pair sources[] = {{"setup.cpp", "setup"}, + {"use_a.cpp", "use_a"}, + {"use_b.cpp", "use_b"}, + {"cleanup.cpp", "cleanup"}, + {"bad_use.cpp", "bad_use"}}; + for (const auto &[file, name] : sources) { + write_file(proj / "tests" / file, + "#include \n" + "int main() {\n" + " { std::ofstream out{\"order.log\", std::ios::app}; out << \"" + + std::string{name} + + "\\n\"; }\n" + " return 0;\n" + "}\n"); + } + write_file(proj / "tests" / "bad_setup.cpp", + "#include \n" + "int main() {\n" + " { std::ofstream out{\"order.log\", std::ios::app}; out << \"bad_setup\\n\"; }\n" + " return 1;\n" + "}\n"); + + auto run_vbs = [&](std::vector args) { + Platform::ProcessRequest req; + req.executable = vbs_bin; + req.arguments = std::move(args); + req.timeout = std::chrono::seconds{300}; + return Platform::run_supervised(req); + }; + + // Only labeled users are selected; setup/cleanup are pulled in automatically and ordered. + auto fixtures = run_vbs({"test", "--project", proj.string(), "--build-dir", bdir.string(), + "--label", "uses", "--jobs", "4"}); + Void::Testing::expect(fixtures.has_value() && fixtures->succeeded()); + if (fixtures) { + Void::Testing::expect(fixtures->stdout_data.find("PASSED 'db_setup'") != std::string::npos); + Void::Testing::expect(fixtures->stdout_data.find("PASSED 'db_use_a'") != std::string::npos); + Void::Testing::expect(fixtures->stdout_data.find("PASSED 'db_use_b'") != std::string::npos); + Void::Testing::expect(fixtures->stdout_data.find("PASSED 'db_cleanup'") != + std::string::npos); + } + auto order_text = Void::FileSystem::read_file(proj / "order.log"); + Void::Testing::require(order_text.has_value()); + std::vector order; + for (std::size_t pos = 0; pos < order_text->size();) { + const auto eol = order_text->find('\n', pos); + order.push_back(order_text->substr(pos, eol - pos)); + pos = eol == std::string::npos ? order_text->size() : eol + 1; + } + Void::Testing::require(order.size() == 4); + Void::Testing::expect_eq(order.front(), std::string{"setup"}); + Void::Testing::expect_eq(order.back(), std::string{"cleanup"}); + + // A failing fixture setup skips its dependents (and the run fails). + std::filesystem::remove(proj / "order.log"); + auto broken = run_vbs({"test", "--project", proj.string(), "--build-dir", bdir.string(), + "--label", "baduse", "--jobs", "4"}); + Void::Testing::expect(broken.has_value()); + if (broken) { + Void::Testing::expect(!broken->succeeded()); + Void::Testing::expect(broken->stdout_data.find("PASSED 'bad_use'") == std::string::npos); + Void::Testing::expect(broken->stderr_data.find("SKIPPED 'bad_use'") != std::string::npos); + } +} + // === 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();