feat: migration breadth, project templates, preset export, IDE/registry polish
VoidBuildSystem CI / 1 · Requirements (push) Successful in 3s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 2m11s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m33s
VoidBuildSystem CI / 2A · Linux build (coverage) (push) Successful in 2m44s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 4m16s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 4m37s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m29s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 24s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 1m52s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 20s
VoidBuildSystem CI / 3A · Linux test (coverage) (push) Failing after 1m57s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Successful in 6m47s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Successful in 7m4s
VoidBuildSystem CI / 4A2 · VBS installers (linux target) (push) Skipped
VoidBuildSystem CI / 4A2 · VBS installers (windows target) (push) Skipped
VoidBuildSystem CI / 5 · Release (push) Skipped
VoidBuildSystem CI / 1 · Requirements (push) Successful in 3s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 2m11s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m33s
VoidBuildSystem CI / 2A · Linux build (coverage) (push) Successful in 2m44s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 4m16s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 4m37s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m29s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 24s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 1m52s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 20s
VoidBuildSystem CI / 3A · Linux test (coverage) (push) Failing after 1m57s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Successful in 6m47s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Successful in 7m4s
VoidBuildSystem CI / 4A2 · VBS installers (linux target) (push) Skipped
VoidBuildSystem CI / 4A2 · VBS installers (windows target) (push) Skipped
VoidBuildSystem CI / 5 · Release (push) Skipped
- vbs migrate --from meson: bounded meson.build importer (project, variable assignments, files()/include_directories(), executable/static_library/ shared_library/library with link_with, include_directories, dependencies, install/install_dir) rendering the same build.cpp scaffold; everything untranslated is reported as a note. - vbs init --template app|library|header-only|shared; every template scaffolds a project whose own test passes. - vbs presets --export FILE: writes VBS profiles as CMake configure presets (round-trips through the CMakePresets importer). - vbs ide generate also writes JetBrains run configurations per target. - VBS_HOST_CXX_FLAGS/VBS_HOST_LDFLAGS instrument the compiled build descriptor (the CI sanitizer lane sets them). - The registry queue counts lease attempts and abandons an action after 5 attempts into a dead-letter list instead of leasing it forever. - CI: coverage lane (lcov report), sanitizer descriptor flags; docs ledger brought up to date (STATE/TASKS/superiority roadmap). Verified: the new FullV1Tests and RegistryTests cases pass and the full CTest suite passes 8/8.
This commit is contained in:
1 parent
9da1387031
commit
fe453bd601
17 files changed
+898
-54
No files matched your search
@@ -38,6 +38,11 @@ check_process(0 "--trace" "" build --help)
|
||||
check_process(0 "Usage: vbs completions " "" completions --help)
|
||||
check_process(2 "" "unsupported --shell" completions --shell tcsh)
|
||||
check_process(0 "Usage: vbs man " "" man --help)
|
||||
check_process(0 "--from" "" migrate --help)
|
||||
check_process(2 "" "invalid value 'bazel' for '--from'" migrate --from bazel)
|
||||
check_process(2 "" "invalid value 'bogus' for '--template'" init --template bogus)
|
||||
check_process(0 "--template" "" init --help)
|
||||
check_process(0 "--export" "" presets --help)
|
||||
check_process(2 "" "invalid --repeat mode" test --repeat bogus)
|
||||
check_process(2 "" "invalid --repeat count" test --repeat until-pass:0)
|
||||
check_process(2 "" "invalid --retry value" test --retry 99)
|
||||
|
||||
@@ -3475,6 +3475,11 @@ VOID_TEST(FullV1Tests, ide_integration_compdb_build_cpp_and_editor_configs_end_t
|
||||
// Check every generated file exists and every JSON file parses strictly.
|
||||
Void::Testing::expect(std::filesystem::exists(proj / ".clangd"));
|
||||
Void::Testing::expect(std::filesystem::exists(proj / ".idea" / "customTargets.xml"));
|
||||
// JetBrains run configurations for the scaffolded targets (shell configs).
|
||||
Void::Testing::expect(std::filesystem::exists(proj / ".idea" / "runConfigurations" /
|
||||
"vbs_build_ide_demo.xml"));
|
||||
Void::Testing::expect(std::filesystem::exists(proj / ".idea" / "runConfigurations" /
|
||||
"vbs_test_ide_demo_tests.xml"));
|
||||
for (const auto &json_file : {proj / ".vscode" / "tasks.json", proj / ".vscode" / "launch.json",
|
||||
proj / ".vscode" / "settings.json", proj / ".zed" / "tasks.json",
|
||||
proj / ".zed" / "debug.json"}) {
|
||||
@@ -4214,3 +4219,131 @@ VOID_TEST(FullV1Tests, completions_and_man_pages_are_generated_from_the_cli) {
|
||||
Void::Testing::require(nested.has_value());
|
||||
Void::Testing::expect(nested->find(".TH vbs\\-compdb\\-use 1") != std::string::npos);
|
||||
}
|
||||
|
||||
// === Migration breadth: meson.build -> build.cpp scaffold ===
|
||||
VOID_TEST(FullV1Tests, meson_build_import_renders_build_cpp_scaffold) {
|
||||
Void::FileSystem::TempDir tmp{"vbs_meson_migrate_"};
|
||||
write_file(tmp / "meson.build", R"meson(
|
||||
project('bench', 'cpp', version : '1.0')
|
||||
|
||||
bench_sources = files('src/f1.cpp', 'src/f2.cpp')
|
||||
|
||||
lib = static_library('bench_lib', bench_sources,
|
||||
include_directories : include_directories('include'))
|
||||
|
||||
app_sources = ['src/main.cpp']
|
||||
executable('bench_app', app_sources,
|
||||
link_with : lib,
|
||||
dependencies : [dependency('zlib')],
|
||||
install : true,
|
||||
install_dir : 'bin')
|
||||
|
||||
# Not translated, must be reported.
|
||||
custom_target('gen', output : 'gen.cpp', command : ['gen.sh'])
|
||||
)meson");
|
||||
|
||||
auto imported = Config::import_meson_build(tmp / "meson.build", tmp.path());
|
||||
Void::Testing::require(imported.has_value());
|
||||
Void::Testing::expect_eq(imported->project_name, std::string{"bench"});
|
||||
Void::Testing::expect_eq(imported->targets.size(), std::size_t{2});
|
||||
|
||||
const auto &library = imported->targets.at(0);
|
||||
Void::Testing::expect_eq(library.name, std::string{"bench_lib"});
|
||||
Void::Testing::expect_eq(library.kind, std::string{"static"});
|
||||
Void::Testing::expect_eq(library.sources.size(), std::size_t{2});
|
||||
Void::Testing::expect_eq(library.sources.at(0), std::string{"src/f1.cpp"});
|
||||
Void::Testing::expect_eq(library.private_includes.at(0), std::string{"include"});
|
||||
|
||||
const auto &app = imported->targets.at(1);
|
||||
Void::Testing::expect_eq(app.name, std::string{"bench_app"});
|
||||
Void::Testing::expect_eq(app.kind, std::string{"executable"});
|
||||
Void::Testing::expect_eq(app.sources.at(0), std::string{"src/main.cpp"});
|
||||
Void::Testing::expect_eq(app.private_links.at(0), std::string{"bench_lib"});
|
||||
Void::Testing::expect(app.installed);
|
||||
Void::Testing::expect_eq(app.install_destination, std::string{"bin"});
|
||||
|
||||
bool saw_dependency_note = false;
|
||||
bool saw_custom_target_note = false;
|
||||
for (const auto ¬e : imported->notes) {
|
||||
if (note.find("zlib") != std::string::npos) {
|
||||
saw_dependency_note = true;
|
||||
}
|
||||
if (note.find("custom_target") != std::string::npos) {
|
||||
saw_custom_target_note = true;
|
||||
}
|
||||
}
|
||||
Void::Testing::expect(saw_dependency_note);
|
||||
Void::Testing::expect(saw_custom_target_note);
|
||||
|
||||
const std::string rendered = Config::render_build_cpp(*imported);
|
||||
Void::Testing::expect(rendered.find("static_library(\"bench_lib\")") != std::string::npos);
|
||||
Void::Testing::expect(rendered.find("executable(\"bench_app\")") != std::string::npos);
|
||||
Void::Testing::expect(rendered.find(".link(t_bench_lib") != std::string::npos);
|
||||
}
|
||||
|
||||
// === Project templates: `vbs init --template` shapes build and test ===
|
||||
VOID_TEST(FullV1Tests, init_templates_scaffold_buildable_projects) {
|
||||
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_init_templates_"};
|
||||
auto run_vbs = [&](std::vector<std::string> args) {
|
||||
Platform::ProcessRequest req;
|
||||
req.executable = vbs_bin;
|
||||
req.arguments = std::move(args);
|
||||
req.timeout = std::chrono::seconds{600};
|
||||
return Platform::run_supervised(req);
|
||||
};
|
||||
for (const char *shape : {"app", "library", "header-only", "shared"}) {
|
||||
const auto dir = tmp / shape;
|
||||
auto initialized = run_vbs({"init", "--dir", dir.string(), "--name", "demo",
|
||||
"--template", shape});
|
||||
Void::Testing::expect(initialized.has_value() && initialized->succeeded());
|
||||
auto built = run_vbs({"test", "--project", dir.string(),
|
||||
"--build-dir", (dir / "build").string(), "--jobs", "2"});
|
||||
Void::Testing::expect(built.has_value() && built->succeeded());
|
||||
if (built && !built->succeeded()) {
|
||||
std::cerr << "template '" << shape << "' failed:\n" << built->stderr_data << '\n';
|
||||
}
|
||||
}
|
||||
auto bad = run_vbs({"init", "--dir", (tmp / "bogus").string(), "--template", "bogus"});
|
||||
Void::Testing::expect(bad.has_value() && bad->exit_code == 2);
|
||||
}
|
||||
|
||||
// === Presets export: VBS profiles -> CMakePresets.json (round-trips through the importer) ===
|
||||
VOID_TEST(FullV1Tests, presets_export_round_trips_through_the_importer) {
|
||||
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_presets_export_"};
|
||||
const auto proj = tmp / "proj";
|
||||
write_file(proj / "build.cpp", R"cpp(#include <Void/Build.hpp>
|
||||
void build(Void::Build::Project &p) {
|
||||
p.executable("app").sources({"src/main.cpp"});
|
||||
}
|
||||
)cpp");
|
||||
write_file(proj / "src" / "main.cpp", "int main() { return 0; }\n");
|
||||
const auto exported = tmp / "CMakePresets.json";
|
||||
Platform::ProcessRequest req;
|
||||
req.executable = vbs_bin;
|
||||
req.arguments = {"presets", "--project", proj.string(), "--export", exported.string()};
|
||||
req.timeout = std::chrono::seconds{300};
|
||||
auto res = Platform::run_supervised(req);
|
||||
Void::Testing::expect(res.has_value() && res->succeeded());
|
||||
auto text = Void::FileSystem::read_file(exported);
|
||||
Void::Testing::require(text.has_value());
|
||||
Void::Testing::expect(text->find("\"configurePresets\"") != std::string::npos);
|
||||
Void::Testing::expect(text->find("\"CMAKE_BUILD_TYPE\"") != std::string::npos);
|
||||
|
||||
// The exported file must be readable by the importer.
|
||||
auto imported = Config::load_cmake_presets(exported, proj);
|
||||
Void::Testing::require(imported.has_value());
|
||||
Void::Testing::expect(!imported->empty());
|
||||
for (const auto &preset : *imported) {
|
||||
Void::Testing::expect(preset.build_dir.has_value());
|
||||
}
|
||||
}
|
||||
@@ -2264,10 +2264,71 @@ VOID_TEST(RegistryTests, worker_action_queue_enqueue_lease_and_complete) {
|
||||
Void::Testing::expect(listing.has_value() && listing->status == 200);
|
||||
if (listing) {
|
||||
Void::Testing::expect(listing->body.find(key_a) != std::string::npos);
|
||||
Void::Testing::expect(listing->body.find("\"attempts\"") != std::string::npos);
|
||||
}
|
||||
(*svc)->stop_http();
|
||||
}
|
||||
|
||||
// Leases are retried, but only up to a budget: a queued action that never reports a
|
||||
// result is abandoned (dead-lettered) instead of being leased forever.
|
||||
VOID_TEST(RegistryTests, worker_queue_abandons_actions_after_repeated_leases) {
|
||||
Void::FileSystem::TempDir tmp{"vbs_queue_attempts_"};
|
||||
RegistryConfig cfg;
|
||||
cfg.data_dir = tmp / "reg_data";
|
||||
cfg.bind_address = "127.0.0.1";
|
||||
cfg.port = 0;
|
||||
cfg.bootstrap_admin_user = "admin";
|
||||
cfg.bootstrap_admin_password = "admin_pw";
|
||||
auto svc = RegistryService::open(cfg);
|
||||
Void::Testing::expect(svc.has_value());
|
||||
if (!svc) {
|
||||
return;
|
||||
}
|
||||
Void::Testing::expect((*svc)->create_user("q_pub", "q_pass", Role::Publisher).has_value());
|
||||
auto tok = (*svc)->create_token("q_pub", "q", {"read", "publish"});
|
||||
Void::Testing::require(tok.has_value());
|
||||
Void::Testing::expect((*svc)->start_http().has_value());
|
||||
const auto port = (*svc)->bound_port();
|
||||
const std::map<std::string, std::string, std::less<>> auth{{"Authorization", "Bearer " + *tok}};
|
||||
|
||||
const std::string key = Util::sha256_hex("poison-action");
|
||||
auto enqueued = send_loopback_http(port, "POST", "/api/v1/queue", auth,
|
||||
"{\"action_keys\":[\"" + key + "\"]}");
|
||||
Void::Testing::expect(enqueued.has_value() && enqueued->status == 200);
|
||||
auto registered = send_loopback_http(port, "POST", "/api/v1/workers", auth, "{}");
|
||||
Void::Testing::require(registered.has_value() && registered->status == 201);
|
||||
const std::string worker_id = extract_json_str(registered->body, "worker_id");
|
||||
|
||||
// Five leases that are never completed (each lease expires after one second).
|
||||
int leases = 0;
|
||||
for (int attempt = 1; attempt <= 5; ++attempt) {
|
||||
auto leased = send_loopback_http(port, "POST", "/api/v1/queue/lease", auth,
|
||||
"{\"worker_id\":\"" + worker_id +
|
||||
"\",\"lease_seconds\":1}");
|
||||
Void::Testing::expect(leased.has_value() && leased->status == 200);
|
||||
if (!leased || leased->status != 200) {
|
||||
break;
|
||||
}
|
||||
++leases;
|
||||
Void::Testing::expect(leased->body.find("\"attempt\":" + std::to_string(attempt)) !=
|
||||
std::string::npos);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds{1100});
|
||||
}
|
||||
Void::Testing::expect_eq(leases, 5);
|
||||
|
||||
// The sixth lease finds nothing: the action was abandoned, not leased again.
|
||||
auto exhausted = send_loopback_http(port, "POST", "/api/v1/queue/lease", auth,
|
||||
"{\"worker_id\":\"" + worker_id +
|
||||
"\",\"lease_seconds\":60}");
|
||||
Void::Testing::expect(exhausted.has_value() && exhausted->status == 404);
|
||||
auto listing = send_loopback_http(port, "GET", "/api/v1/queue", auth);
|
||||
Void::Testing::require(listing.has_value() && listing->status == 200);
|
||||
Void::Testing::expect(listing->body.find(key) != std::string::npos); // in "abandoned"
|
||||
Void::Testing::expect(listing->body.find("\"abandoned\":[\"" + key + "\"]") !=
|
||||
std::string::npos);
|
||||
(*svc)->stop_http();
|
||||
}
|
||||
|
||||
// `vbs test --cdash-output FILE --cdash URL`: writes a CDash Test.xml report and submits it as
|
||||
// multipart/form-data to submit.php (captured by a loopback HTTP server).
|
||||
VOID_TEST(RegistryTests, cdash_test_report_output_and_submission) {
|
||||
|
||||
Reference in new issue
Block a user