partition.Volume gains a FilesystemKind signature (today .fat for every probed volume; S4 adds a real VBR recognizer for exFAT) — the seam filesystems.csv keys on to choose a service binary. New filesystem-map.zig parses `/system/configuration/filesystems.csv` (signature, binary) into rules and match()es a signature to its binary, mirroring the device registry: a signature no row matches goes unserved, never guessed; slices point into the source buffer. Three host tests (fat->binary, the binary is data-driven not hardcoded, malformed rows counted); the test rule buffer is a named fixture size so the bounds gate stays quiet. The VM's build gains the csv dependency and wires the filesystem-map test into its package test step. Not yet consumed by the binary — that lands when the VM loads the tables (step 4).
44 lines
1.8 KiB
Zig
44 lines
1.8 KiB
Zig
//! The volume-manager service as a binary package (docs/build-packages-plan.md):
|
|
//! this file names the binary and EXACTLY the modules its source imports —
|
|
//! build-support resolves each name from the domains this zon declares.
|
|
|
|
const std = @import("std");
|
|
const build_support = @import("build-support");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const exe = build_support.userBinary(b, .{
|
|
.name = "volume-manager",
|
|
.root_source_file = b.path("volume-manager.zig"),
|
|
.imports = &.{
|
|
"block", "channel", "device-manager-protocol", "driver",
|
|
"envelope", "ipc", "logging", "memory",
|
|
"process", "service", "time", "volume-manager-protocol",
|
|
},
|
|
});
|
|
b.installArtifact(exe);
|
|
|
|
// Standalone `zig build test` for the parser + mount-map modules; the root
|
|
// build keeps its aggregate test step.
|
|
const csv = b.dependency("csv", .{});
|
|
const test_step = b.step("test", "Run the partition parser + mount-map unit tests");
|
|
|
|
const partition_tests = b.addTest(.{
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("partition.zig"),
|
|
.target = b.resolveTargetQuery(.{}),
|
|
}),
|
|
});
|
|
test_step.dependOn(&b.addRunArtifact(partition_tests).step);
|
|
|
|
// filesystem-map imports csv (and, by path, partition.zig), so its test
|
|
// module needs csv wired.
|
|
const filesystem_map_tests = b.addTest(.{
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("filesystem-map.zig"),
|
|
.target = b.resolveTargetQuery(.{}),
|
|
.imports = &.{.{ .name = "csv", .module = csv.module("csv") }},
|
|
}),
|
|
});
|
|
test_step.dependOn(&b.addRunArtifact(filesystem_map_tests).step);
|
|
}
|