You don’t need the _entry
in test_main.zig
.
Keep only one _start
(in main.zig
, or somewhere that both main.zig
and test_main.zig
load) as:
// root is: root_source_file (main.zig) for normal run,
// or test_runner (test_main.zig) for test run.
const root = @import("root");
export fn _start() noreturn {
// do essential init work
arch.platform.setup();
if (builtin.is_test) {
root.tmain();
} else {
root.kmain();
}
unreachable;
}