srctree

Johan parent b58a738a 15c9774d 2817e893
Merge pull request #373 from johnor/improve-romtest

Improve romtest
romtest/BUILD.bazel added: 21, removed: 10, total 11
@@ -3,8 +3,18 @@ cc_binary(
srcs = ["src/main.cpp"],
deps = [
"//core",
"//disassembler",
"//nes",
"@fmtlib",
],
)
 
py_binary(
name = "test_rom",
srcs = ["test_rom.py"],
args = [
"--romtest-bin",
"$(rootpath :romtest)",
],
data = [":romtest"],
main = "test_rom.py",
)
 
romtest/src/main.cpp added: 21, removed: 10, total 11
@@ -8,7 +8,6 @@
#include "nes/core/imos6502.h"
#include "nes/core/ippu.h"
#include "nes/core/opcode.h"
#include "nes/disassembler.h"
#include "nes/nes.h"
 
namespace {
 
romtest/test_rom.py added: 21, removed: 10, total 11
@@ -174,8 +174,10 @@ TESTS = [
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--rom-repo-path", type=pathlib.Path, default="nes-test-roms")
parser.add_argument("--romtest-bin", type=pathlib.Path)
parser.add_argument("--test", help="If set, only run this test")
parser.add_argument("--romtest-bin", type=pathlib.Path, required=True)
parser.add_argument(
"--filter", help="If set, only run tests matching this argument"
)
parser.add_argument(
"--verbose", "-v", action="store_true", help="Print more debug data if set"
)
@@ -218,11 +220,11 @@ def main():
args = parse_args()
success = True
 
if args.test:
print(f"Running only tests matching: {args.test}")
if args.filter:
print(f"Running only tests matching: {args.filter}")
 
for test in TESTS:
if args.test and args.test not in test.rom:
if args.filter and args.filter not in test.rom:
continue
grid = run_test(
romtest_bin=args.romtest_bin, rom_repo_path=args.rom_repo_path, test=test