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/lib.rs b/libs/ignorabletest/src/lib.rs
index 746c0dd..c7243e6 100644
--- a/libs/ignorabletest/src/lib.rs
+++ b/libs/ignorabletest/src/lib.rs
@@ -5,42 +5,17 @@
 #[doc(hidden)]
 pub use libtest_mimic as _libtest_mimic;
 #[doc(hidden)]
+pub use linkme as _linkme;
+#[doc(hidden)]
 pub use paste as _paste;
 
 /// Macro to generate the main function for the test harness.
 #[macro_export]
 macro_rules! test_main {
-    ($tests:expr) => {
+    () => {
         #[cfg(test)]
         fn main() {
-            ignorabletest::runner::main($tests)
-        }
-    };
-}
-
-/// Macro to generate a function which returns a list of tests to be run.
-///
-/// # Usage
-/// ```
-/// list_tests!{all_tests: [test_this, test_that]};
-///
-/// test!(test_this);
-/// fn test_this() {
-///   // ...
-/// }
-///
-/// test!(test_that);
-/// fn test_that() {
-///   // ...
-/// }
-/// ```
-#[macro_export]
-macro_rules! list_tests {
-    {$function_name:ident: [$( $test_name:ident ),* $(,)? ]} => {
-        pub fn $function_name() -> ::std::vec::Vec<$crate::_libtest_mimic::Trial> {
-            vec![
-                $( $crate::_paste::paste!([<__test_ $test_name>]()) ),*
-            ]
+            ignorabletest::runner::main()
         }
     };
 }
@@ -59,6 +34,7 @@
 macro_rules! test {
     ($test_name:ident) => {
         $crate::_paste::paste!(
+            #[$crate::_linkme::distributed_slice($crate::runner::IGNORABLETEST_TESTS)]
             fn [< __test_ $test_name >]() -> $crate::_libtest_mimic::Trial {
                 $crate::_libtest_mimic::Trial::test(
                     ::std::stringify!($test_name),
@@ -69,6 +45,7 @@
     };
     ($test_name:ident, ignore_if: $ignore_expr:expr) => {
         $crate::_paste::paste!(
+            #[$crate::_linkme::distributed_slice($crate::runner::IGNORABLETEST_TESTS)]
             fn [< __test_ $test_name >]() -> $crate::_libtest_mimic::Trial {
                 $crate::_libtest_mimic::Trial::test(
                     ::std::stringify!($test_name),