From d85c396b2c4e677f41ed3967244b922feb2fa9dc Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Mon, 31 Aug 2026 23:53:26 +0200 Subject: vnf-tests: add support for verbosity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- tests/vnf-tests/src/main.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/vnf-tests/src') diff --git a/tests/vnf-tests/src/main.rs b/tests/vnf-tests/src/main.rs index 7ebf9dd..3ef35b0 100644 --- a/tests/vnf-tests/src/main.rs +++ b/tests/vnf-tests/src/main.rs @@ -51,9 +51,20 @@ fn parse_arguments() -> Args { res } +// Returns true if the 'VERBOSE' environment variable is either set to 'true' +// or '1', false otherwise. +fn verbose() -> bool { + let value = std::env::var("VNF_TESTS_VERBOSE") + .unwrap_or_else(|_| "0".to_string()) + .to_lowercase(); + + value == "true" || value == "1" +} + fn run_break_mark_test(path: &String) -> Result<(), String> { let rom = PathBuf::from(path).join("out/stack.nes"); let mut machine = Machine::from(&rom, 0x8000, MemoryPolicy::default())?; + machine.verbose = verbose(); // Get out of let _ = machine.next_iteration(); @@ -116,6 +127,7 @@ fn run_joypad_test(path: &String) -> Result<(), String> { ], ); machine.run_function_mode = true; + machine.verbose = verbose(); machine.until_address(0xFFFF)?; assert_eq!(machine.ram[0x00].value, 2); -- cgit v1.2.3