Use linkme rather than collecting tests manually.
Bug: 260692911
Test: atest apkdmverity.test libdm_rust.test
Change-Id: I9355dc13e31c4487109be31e2d7a7a50b16fb889
diff --git a/libs/ignorabletest/src/runner.rs b/libs/ignorabletest/src/runner.rs
index e1b14e0..4ec3d79 100644
--- a/libs/ignorabletest/src/runner.rs
+++ b/libs/ignorabletest/src/runner.rs
@@ -2,14 +2,21 @@
use core::ops::{Deref, FnOnce};
use libtest_mimic::{Arguments, Failed, Trial};
+use linkme::distributed_slice;
use std::env;
/// Command-line arguments to ignore, because they are not supported by libtest-mimic.
const IGNORED_ARGS: [&str; 2] = ["-Zunstable-options", "--report-time"];
+/// The collection of all tests to run.
+#[doc(hidden)]
+#[distributed_slice]
+pub static IGNORABLETEST_TESTS: [fn() -> Trial] = [..];
+
/// Runs all tests.
-pub fn main(tests: Vec<Trial>) {
+pub fn main() {
let args = Arguments::from_iter(env::args().filter(|arg| !IGNORED_ARGS.contains(&arg.deref())));
+ let tests = IGNORABLETEST_TESTS.iter().map(|test| test()).collect();
libtest_mimic::run(&args, tests).exit();
}