add nes conformance test suite and CLI runner benchmark tool
This commit is contained in:
@@ -10,33 +10,91 @@ pub fn build(b: *std.Build) void {
|
||||
.root_source_file = b.path("src/cpu/root.zig"),
|
||||
});
|
||||
|
||||
const lib = b.addLibrary(.{
|
||||
.name = "cpu",
|
||||
.root_module = cpu_mod,
|
||||
.linkage = .static,
|
||||
});
|
||||
|
||||
b.installArtifact(lib);
|
||||
|
||||
const contract_mod = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/contract/root.zig"),
|
||||
});
|
||||
|
||||
const system_mod = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/system/root.zig"),
|
||||
});
|
||||
system_mod.addImport("contract", contract_mod);
|
||||
system_mod.addImport("cpu", cpu_mod);
|
||||
|
||||
const platform_mod = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/platform/root.zig"),
|
||||
});
|
||||
platform_mod.addImport("contract", contract_mod);
|
||||
|
||||
const frontend_mod = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/frontend/root.zig"),
|
||||
});
|
||||
frontend_mod.addImport("contract", contract_mod);
|
||||
|
||||
const exe_mod = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/main.zig"),
|
||||
});
|
||||
exe_mod.addImport("contract", contract_mod);
|
||||
exe_mod.addImport("system", system_mod);
|
||||
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "6soz",
|
||||
.root_module = exe_mod,
|
||||
});
|
||||
|
||||
b.installArtifact(exe);
|
||||
|
||||
// Test Step Configuration
|
||||
const test_step = b.step("test", "Run 6soz tests");
|
||||
|
||||
inline for (&.{ cpu_mod, system_mod, platform_mod, frontend_mod, exe_mod }) |mod| {
|
||||
const test_options = b.addOptions();
|
||||
if (b.lazyDependency("nes_test_roms", .{})) |roms_dep| {
|
||||
test_options.addOption(?[]const u8, "nes_test_roms_dir", roms_dep.path("").getPath(b));
|
||||
} else {
|
||||
test_options.addOption(?[]const u8, "nes_test_roms_dir", null);
|
||||
}
|
||||
if (b.lazyDependency("m6502_functional_tests", .{})) |func_dep| {
|
||||
test_options.addOption(?[]const u8, "m6502_functional_tests_dir", func_dep.path("").getPath(b));
|
||||
} else {
|
||||
test_options.addOption(?[]const u8, "m6502_functional_tests_dir", null);
|
||||
}
|
||||
|
||||
const options_mod = test_options.createModule();
|
||||
|
||||
const cpu_test_mod = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/cpu/root.zig"),
|
||||
});
|
||||
cpu_test_mod.addImport("build_options", options_mod);
|
||||
|
||||
const system_test_mod = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/system/root.zig"),
|
||||
});
|
||||
system_test_mod.addImport("contract", contract_mod);
|
||||
system_test_mod.addImport("cpu", cpu_test_mod);
|
||||
system_test_mod.addImport("build_options", options_mod);
|
||||
|
||||
inline for (&.{ cpu_test_mod, contract_mod, system_test_mod, platform_mod, frontend_mod, exe_mod }) |mod| {
|
||||
const mod_test = b.addTest(.{ .root_module = mod });
|
||||
const mod_cmd = b.addRunArtifact(mod_test);
|
||||
test_step.dependOn(&mod_cmd.step);
|
||||
|
||||
Reference in New Issue
Block a user