feat(daemon): scope describe to one workspace member; reuse executable path helper in tests
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 2s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 7s

This commit is contained in:
faumaray committed 2026-12-04 04:28:00 +03:00
1 parent 9f4477b8d4
commit 2b18a0331a
10 files changed
+66 -16

No files matched your search

+25
View File
@@ -1788,6 +1788,11 @@ void build(Void::Build::Project &project) {
Void::Testing::expect(describe_raw->find("\"name\":\"lib\"") != std::string::npos);
Void::Testing::expect(describe_raw->find("\"name\":\"app\"") != std::string::npos);
auto member_raw = Void::Build::Daemon::request(
socket, R"({"op":"describe","member":"app"})", std::chrono::seconds{120});
auto unknown_member = request_object(socket, R"({"op":"describe","member":"nope"})",
std::chrono::seconds{120});
auto workspace_build =
Void::Build::Daemon::request(socket, R"({"op":"build"})", std::chrono::seconds{120});
Void::Testing::require(workspace_build.has_value());
@@ -1830,5 +1835,25 @@ void build(Void::Build::Project &project) {
Void::Testing::require(ide_generate.has_value());
Void::Testing::expect(ide_generate->find("\"ok\":true") != std::string::npos);
Void::Testing::expect(std::filesystem::exists(ws / "packages" / "app" / ".clangd"));
Void::Testing::require(member_raw.has_value());
const auto member_parsed = parse_json(*member_raw);
Void::Testing::require(member_parsed.has_value());
const auto *member_object = as_object(*member_parsed);
Void::Testing::require(member_object != nullptr);
Void::Testing::expect(bool_field(*member_object, "workspace"));
const auto *members_value = field(*member_object, "members");
Void::Testing::require(members_value != nullptr);
const auto *members_array = std::get_if<JsonValue::Array>(&members_value->value);
Void::Testing::require(members_array != nullptr);
Void::Testing::expect_eq(members_array->size(), std::size_t{1});
if (members_array->size() == 1) {
const auto *only = std::get_if<JsonObject>(&members_array->front().value);
Void::Testing::require(only != nullptr);
Void::Testing::expect_eq(str_field(*only, "name"), std::string{"app"});
}
Void::Testing::require(unknown_member.has_value());
Void::Testing::expect(!bool_field(*unknown_member, "ok", true));
Void::Testing::expect(!std::filesystem::exists(socket));
}
+2 -3
View File
@@ -89,9 +89,8 @@ void write_raw_tar(const std::filesystem::path &tar_path,
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 (const auto self_exe = Platform::current_executable_path(); self_exe) {
const auto sibling = self_exe->parent_path() / "vbs";
if (std::filesystem::exists(sibling, ec)) {
return sibling;
}
+2 -3
View File
@@ -52,9 +52,8 @@ std::string extract_json_str(std::string_view json, const std::string &key) {
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 (const auto self_exe = Platform::current_executable_path(); self_exe) {
const auto sibling = self_exe->parent_path() / "vbs";
if (std::filesystem::exists(sibling, ec)) {
return sibling;
}
+2 -3
View File
@@ -43,9 +43,8 @@ std::filesystem::path locate_void_source_dir() {
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 (const auto self_exe = Platform::current_executable_path(); self_exe) {
const auto sibling = self_exe->parent_path() / "vbs";
if (std::filesystem::exists(sibling, ec)) {
return sibling;
}