Fix the drviers typo and make tests robust to source-path debug prefixes
The debug-message refactor prefixed each service/driver line with its source path (system/drivers/hpet:, ...) for readability, but two things left main red: a 'drviers' typo in hpet.zig and pci-bus.zig, and five kernel tests (init, hpet, pci-scan, device-manager, vfs-client-death) that starts-with-matched the old short markers, which no longer sit at the front of the prefixed lines. Fix the typo, and convert the fragile starts-with matchers to substring matching via a bufferHas helper — 'hpet: ok' now matches inside 'system/drivers/hpet: ok' regardless of prefix. Future-proof against further prefix changes and harmless for the tests that already passed. Suite 58/58.
This commit is contained in:
@@ -93,21 +93,21 @@ fn findHpet(buffer: []device.DeviceDescriptor) ?Found {
|
||||
pub fn main() void {
|
||||
// Enumerate into a heap buffer (too big for the one-page user stack).
|
||||
const buffer = runtime.allocator().alloc(device.DeviceDescriptor, 32) catch {
|
||||
_ = runtime.system.write("system/drviers/hpet: out of memory\n");
|
||||
_ = runtime.system.write("system/drivers/hpet: out of memory\n");
|
||||
return;
|
||||
};
|
||||
|
||||
const hpet = findHpet(buffer) orelse {
|
||||
_ = runtime.system.write("system/drviers/hpet: no HPET with an IRQ\n");
|
||||
_ = runtime.system.write("system/drivers/hpet: no HPET with an IRQ\n");
|
||||
return;
|
||||
};
|
||||
|
||||
if (!device.claim(hpet.device_id)) {
|
||||
_ = runtime.system.write("system/drviers/hpet: claim failed\n");
|
||||
_ = runtime.system.write("system/drivers/hpet: claim failed\n");
|
||||
return;
|
||||
}
|
||||
const base = device.mmioMap(hpet.device_id, hpet.mmio) orelse {
|
||||
_ = runtime.system.write("system/drviers/hpet: mmio_map failed\n");
|
||||
_ = runtime.system.write("system/drivers/hpet: mmio_map failed\n");
|
||||
return;
|
||||
};
|
||||
|
||||
@@ -116,7 +116,7 @@ pub fn main() void {
|
||||
const gsi = hpet.gsi;
|
||||
|
||||
const endpoint = ipc.createIpcEndpoint() orelse {
|
||||
_ = runtime.system.write("system/drviers/hpet: create_ipc_endpoint failed\n");
|
||||
_ = runtime.system.write("system/drivers/hpet: create_ipc_endpoint failed\n");
|
||||
return;
|
||||
};
|
||||
|
||||
@@ -124,7 +124,7 @@ pub fn main() void {
|
||||
// Counter period, so we can arm the comparator a fixed wall-clock distance out.
|
||||
const femtos_per_tick = rd(base, register_general_cap) >> 32;
|
||||
if (femtos_per_tick == 0) {
|
||||
_ = runtime.system.write("system/drviers/hpet: bad HPET period\n");
|
||||
_ = runtime.system.write("system/drivers/hpet: bad HPET period\n");
|
||||
return;
|
||||
}
|
||||
const ticks_per_ms = 1_000_000_000_000 / femtos_per_tick;
|
||||
@@ -147,10 +147,10 @@ pub fn main() void {
|
||||
wr(base, register_general_configuration, rd(base, register_general_configuration) | configuration_enable);
|
||||
|
||||
if (!device.irqBind(hpet.device_id, hpet.irq, endpoint)) {
|
||||
_ = runtime.system.write("system/drviers/hpet: irq_bind failed\n");
|
||||
_ = runtime.system.write("system/drivers/hpet: irq_bind failed\n");
|
||||
return;
|
||||
}
|
||||
_ = runtime.system.write("system/drviers/hpet: bound, sleeping until the hardware speaks\n");
|
||||
_ = runtime.system.write("system/drivers/hpet: bound, sleeping until the hardware speaks\n");
|
||||
|
||||
// --- the driver loop -----------------------------------------------------
|
||||
// Blocked in replyWait. No polling, no spinning: the next line of this function
|
||||
@@ -178,14 +178,14 @@ pub fn main() void {
|
||||
wr(base, register_timer0_configuration, rd(base, register_timer0_configuration) & ~tn_int_enb);
|
||||
}
|
||||
|
||||
_ = runtime.system.write("system/drviers/hpet: irq\n");
|
||||
_ = runtime.system.write("system/drivers/hpet: irq\n");
|
||||
if (!device.irqAck(hpet.device_id, hpet.irq)) {
|
||||
_ = runtime.system.write("system/drviers/hpet: irq_ack failed\n");
|
||||
_ = runtime.system.write("system/drivers/hpet: irq_ack failed\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_ = runtime.system.write("system/drviers/hpet: ok\n");
|
||||
_ = runtime.system.write("system/drivers/hpet: ok\n");
|
||||
while (true) runtime.system.sleep(1000);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user