feat: tree, fmt, lint and install-binary (G1 continued)
VoidBuildSystem CI / 1 · Requirements (push) Successful in 4s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m6s
VoidBuildSystem CI / 2A · Linux build (coverage) (push) Successful in 2m19s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 3m19s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 1m51s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 4m18s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m40s
VoidBuildSystem CI / 3A · Linux test (coverage) (push) Failing after 35s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 19s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 17s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 52s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Failing after 5m50s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Failing after 6m55s
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 4s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m6s
VoidBuildSystem CI / 2A · Linux build (coverage) (push) Successful in 2m19s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 3m19s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 1m51s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 4m18s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m40s
VoidBuildSystem CI / 3A · Linux test (coverage) (push) Failing after 35s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 19s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 17s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 52s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Failing after 5m50s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Failing after 6m55s
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 tree prints the resolved lock contexts (source kind, version, features, build-only) and reports packages resolved to multiple versions with --duplicates. - vbs fmt formats or checks owned C/C++ sources with clang-format, supports explicit paths (resolved against --project), --changed-only via git, and skips build/VCS/vendor directories. - vbs lint runs clang-tidy against the build's compile_commands.json with --fix and --warnings-as-errors, --changed-only included. - vbs install-binary picks the newest release with Void::Semver ordering, selects the host os/arch variant by default, verifies signatures when trusted keys are configured, SHA-256-verifies the download and installs into <prefix>/bin. Verified: tree_prints_lock_entries_and_reports_duplicates, fmt_check_detects_unformatted_files_and_fixes_them and the CLI contract suite pass; clang-format clean.
This commit is contained in:
1 parent
76f1e2a48c
commit
55f93d5c1c
6 files changed
+591
-3
No files matched your search
@@ -4576,3 +4576,82 @@ VOID_TEST(FullV1Tests, native_cache_wrapper_is_lowered_into_compile_commands) {
|
||||
Void::Testing::expect(std::ranges::find(cached->arguments, std::string{"-std=c++26"}) !=
|
||||
cached->arguments.end());
|
||||
}
|
||||
|
||||
// === Dependency tree from the lockfile ===
|
||||
VOID_TEST(FullV1Tests, tree_prints_lock_entries_and_reports_duplicates) {
|
||||
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_tree_"};
|
||||
const auto dep = tmp / "dep";
|
||||
const auto app = tmp / "app";
|
||||
write_file(dep / "build.cpp", R"cpp(#include <Void/Build.hpp>
|
||||
void build(Void::Build::Project &p) { p.static_library("deplib").sources({"src/dep.cpp"}); }
|
||||
)cpp");
|
||||
write_file(dep / "src" / "dep.cpp", "int depfn() { return 1; }\n");
|
||||
write_file(app / "build.cpp", R"cpp(#include <Void/Build.hpp>
|
||||
void build(Void::Build::Project &p) {
|
||||
p.dependencies_file("vbs.deps.toml");
|
||||
p.executable("app").sources({"src/main.cpp"});
|
||||
}
|
||||
)cpp");
|
||||
write_file(app / "src" / "main.cpp", "int main() { return 0; }\n");
|
||||
write_file(app / "vbs.deps.toml", "[dependencies.dep]\npath = \"../dep\"\n");
|
||||
|
||||
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);
|
||||
};
|
||||
auto resolved = run_vbs({"deps", "resolve", "--project", app.string()});
|
||||
Void::Testing::expect(resolved.has_value() && resolved->succeeded());
|
||||
auto tree = run_vbs({"tree", "--project", app.string(), "--duplicates"});
|
||||
Void::Testing::expect(tree.has_value() && tree->succeeded());
|
||||
if (tree) {
|
||||
Void::Testing::expect(tree->stdout_data.find("dep source=path") != std::string::npos);
|
||||
Void::Testing::expect(tree->stdout_data.find("target (1 entry)") != std::string::npos);
|
||||
Void::Testing::expect(tree->stdout_data.find("no duplicate package versions") !=
|
||||
std::string::npos);
|
||||
}
|
||||
auto missing = run_vbs({"tree", "--project", (tmp / "none").string()});
|
||||
Void::Testing::expect(missing.has_value() && missing->exit_code == 1);
|
||||
}
|
||||
|
||||
// === Formatting: clang-format orchestration (skipped when the tool is absent) ===
|
||||
VOID_TEST(FullV1Tests, fmt_check_detects_unformatted_files_and_fixes_them) {
|
||||
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;
|
||||
}
|
||||
const auto clang_format = Platform::resolve_executable("clang-format");
|
||||
if (!clang_format) {
|
||||
return; // clang-format is not installed; the CI image ships it.
|
||||
}
|
||||
Void::FileSystem::TempDir tmp{"vbs_fmt_"};
|
||||
const auto proj = tmp / "proj";
|
||||
write_file(proj / "src" / "ugly.cpp", "int main(){return 0;}\n");
|
||||
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");
|
||||
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{300};
|
||||
return Platform::run_supervised(req);
|
||||
};
|
||||
auto check = run_vbs({"fmt", "--check", "--project", proj.string(), "src/ugly.cpp"});
|
||||
Void::Testing::expect(check.has_value() && check->exit_code == 1);
|
||||
auto fix = run_vbs({"fmt", "--project", proj.string(), "src/ugly.cpp"});
|
||||
Void::Testing::expect(fix.has_value() && fix->succeeded());
|
||||
auto fixed = Void::FileSystem::read_file(proj / "src" / "ugly.cpp");
|
||||
Void::Testing::require(fixed.has_value());
|
||||
Void::Testing::expect(fixed->find("int main() {") != std::string::npos);
|
||||
auto recheck = run_vbs({"fmt", "--check", "--project", proj.string(), "src/ugly.cpp"});
|
||||
Void::Testing::expect(recheck.has_value() && recheck->succeeded());
|
||||
}
|
||||
Reference in new issue
Block a user