aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-09-01 00:01:32 +0200
committerMiquel Sabaté Solà <mssola@mssola.com>2026-09-06 15:47:50 +0200
commit71ab8bb480aec3d80061f0fbdae9e3ea6e45e266 (patch)
tree30992f41b30b20d03f9e0cc4fe3c3f3302529142
parentd85c396b2c4e677f41ed3967244b922feb2fa9dc (diff)
downloadtools.nes-71ab8bb480aec3d80061f0fbdae9e3ea6e45e266.tar.gz
tools.nes-71ab8bb480aec3d80061f0fbdae9e3ea6e45e266.zip
vnf-tests: allow to conditionally run tests
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
-rw-r--r--tests/vnf-tests/src/main.rs23
1 files changed, 19 insertions, 4 deletions
diff --git a/tests/vnf-tests/src/main.rs b/tests/vnf-tests/src/main.rs
index 3ef35b0..a0bf1fa 100644
--- a/tests/vnf-tests/src/main.rs
+++ b/tests/vnf-tests/src/main.rs
@@ -51,6 +51,15 @@ fn parse_arguments() -> Args {
res
}
+// Returns true if the test identified by 'id' should be run.
+fn should_run(id: &str) -> bool {
+ let value = std::env::var("VNF_TEST")
+ .unwrap_or_else(|_| "".to_string())
+ .to_lowercase();
+
+ value.is_empty() || value == id
+}
+
// Returns true if the 'VERBOSE' environment variable is either set to 'true'
// or '1', false otherwise.
fn verbose() -> bool {
@@ -147,10 +156,16 @@ fn main() {
die("you have to provide a path to the tests/ directory".to_string());
}
- if let Err(e) = run_break_mark_test(&args.file) {
- die(e)
+ // And tests!
+
+ if should_run("break_mark") {
+ if let Err(e) = run_break_mark_test(&args.file) {
+ die(e)
+ }
}
- if let Err(e) = run_joypad_test(&args.file) {
- die(e)
+ if should_run("joypad") {
+ if let Err(e) = run_joypad_test(&args.file) {
+ die(e)
+ }
}
}