switch off rdroidtest

rdroidtest doesn't work correctly with on-device tests because they use
`panic = "abort"` and rdroidtest doesn't support `-Zpanic-abort-tests`
yet. The result is that all test failure look like a "native crash" and
the test infra cannot correctly track them via bugs or display them in
the UI.

The only `rdroidtest` specific feature we used was `ignore_if`. It is a
bit of a loss to have ignored tests reported as passing, but it is a
lesser evil in this case.

Bug: 291169704
Bug: 384438979
Test: atest libdm_rust.test
Change-Id: I23af380c79a87d246a1f50e163415021d7f5fa84
diff --git a/guest/apkdmverity/Android.bp b/guest/apkdmverity/Android.bp
index 3f45bb4..6e928f6 100644
--- a/guest/apkdmverity/Android.bp
+++ b/guest/apkdmverity/Android.bp
@@ -41,7 +41,6 @@
     name: "apkdmverity.test",
     defaults: [
         "apkdmverity.defaults",
-        "rdroidtest.defaults",
     ],
     test_suites: ["general-tests"],
     compile_multilib: "first",
diff --git a/guest/apkdmverity/src/main.rs b/guest/apkdmverity/src/main.rs
index 2fc964b..167f5d4 100644
--- a/guest/apkdmverity/src/main.rs
+++ b/guest/apkdmverity/src/main.rs
@@ -160,12 +160,8 @@
 }
 
 #[cfg(test)]
-rdroidtest::test_main!();
-
-#[cfg(test)]
 mod tests {
     use crate::*;
-    use rdroidtest::{ignore_if, rdroidtest};
     use std::fs::{File, OpenOptions};
     use std::io::Write;
     use std::ops::Deref;
@@ -236,9 +232,11 @@
         });
     }
 
-    #[rdroidtest]
-    #[ignore_if(should_skip())]
+    #[test]
     fn correct_inputs() {
+        if should_skip() {
+            return;
+        }
         let apk = include_bytes!("../testdata/test.apk");
         let idsig = include_bytes!("../testdata/test.apk.idsig");
         run_test(apk.as_ref(), idsig.as_ref(), "correct", |ctx| {
@@ -250,9 +248,11 @@
     }
 
     // A single byte change in the APK file causes an IO error
-    #[rdroidtest]
-    #[ignore_if(should_skip())]
+    #[test]
     fn incorrect_apk() {
+        if should_skip() {
+            return;
+        }
         let apk = include_bytes!("../testdata/test.apk");
         let idsig = include_bytes!("../testdata/test.apk.idsig");
 
@@ -268,9 +268,11 @@
     }
 
     // A single byte change in the merkle tree also causes an IO error
-    #[rdroidtest]
-    #[ignore_if(should_skip())]
+    #[test]
     fn incorrect_merkle_tree() {
+        if should_skip() {
+            return;
+        }
         let apk = include_bytes!("../testdata/test.apk");
         let idsig = include_bytes!("../testdata/test.apk.idsig");
 
@@ -293,9 +295,11 @@
     // APK is not altered when the verity device is created, but later modified. IO error should
     // occur when trying to read the data around the modified location. This is the main scenario
     // that we'd like to protect.
-    #[rdroidtest]
-    #[ignore_if(should_skip())]
+    #[test]
     fn tampered_apk() {
+        if should_skip() {
+            return;
+        }
         let apk = include_bytes!("../testdata/test.apk");
         let idsig = include_bytes!("../testdata/test.apk.idsig");
 
@@ -315,9 +319,11 @@
 
     // idsig file is not alread when the verity device is created, but later modified. Unlike to
     // the APK case, this doesn't occur IO error because the merkle tree is already cached.
-    #[rdroidtest]
-    #[ignore_if(should_skip())]
+    #[test]
     fn tampered_idsig() {
+        if should_skip() {
+            return;
+        }
         let apk = include_bytes!("../testdata/test.apk");
         let idsig = include_bytes!("../testdata/test.apk.idsig");
         run_test(apk.as_ref(), idsig.as_ref(), "tampered_idsig", |ctx| {
@@ -333,9 +339,11 @@
     }
 
     // test if both files are already block devices
-    #[rdroidtest]
-    #[ignore_if(should_skip())]
+    #[test]
     fn inputs_are_block_devices() {
+        if should_skip() {
+            return;
+        }
         let apk = include_bytes!("../testdata/test.apk");
         let idsig = include_bytes!("../testdata/test.apk.idsig");
 
@@ -383,9 +391,11 @@
     }
 
     // test with custom roothash
-    #[rdroidtest]
-    #[ignore_if(should_skip())]
+    #[test]
     fn correct_custom_roothash() {
+        if should_skip() {
+            return;
+        }
         let apk = include_bytes!("../testdata/test.apk");
         let idsig = include_bytes!("../testdata/test.apk.idsig");
         let roothash = V4Signature::from_idsig_path("testdata/test.apk.idsig")
@@ -406,7 +416,7 @@
         );
     }
 
-    #[rdroidtest]
+    #[test]
     fn verify_command() {
         // Check that the command parsing has been configured in a valid way.
         clap_command().debug_assert();
diff --git a/libs/devicemapper/Android.bp b/libs/devicemapper/Android.bp
index 6b7f680..8dc6c8d 100644
--- a/libs/devicemapper/Android.bp
+++ b/libs/devicemapper/Android.bp
@@ -29,7 +29,6 @@
     name: "libdm_rust.test",
     defaults: [
         "libdm_rust.defaults",
-        "rdroidtest.defaults",
     ],
     test_suites: ["general-tests"],
     rustlibs: [
diff --git a/libs/devicemapper/src/lib.rs b/libs/devicemapper/src/lib.rs
index a8c2833..bc8a762 100644
--- a/libs/devicemapper/src/lib.rs
+++ b/libs/devicemapper/src/lib.rs
@@ -230,14 +230,10 @@
 }
 
 #[cfg(test)]
-rdroidtest::test_main!();
-
-#[cfg(test)]
 mod tests {
     use super::*;
     use crate::loopdevice::LoopConfigOptions;
     use crypt::{CipherType, DmCryptTargetBuilder};
-    use rdroidtest::{ignore_if, rdroidtest};
     use rustutils::system_properties;
     use std::fs::{read, File, OpenOptions};
     use std::io::Write;
@@ -294,25 +290,29 @@
         }
     }
 
-    #[rdroidtest]
+    #[test]
     fn mapping_again_keeps_data_xts() {
         mapping_again_keeps_data(&KEY_SET_XTS, "name1");
     }
 
-    #[rdroidtest]
-    #[ignore_if(!is_hctr2_supported())]
+    #[test]
     fn mapping_again_keeps_data_hctr2() {
+        if !is_hctr2_supported() {
+            return;
+        }
         mapping_again_keeps_data(&KEY_SET_HCTR2, "name2");
     }
 
-    #[rdroidtest]
+    #[test]
     fn data_inaccessible_with_diff_key_xts() {
         data_inaccessible_with_diff_key(&KEY_SET_XTS, "name3");
     }
 
-    #[rdroidtest]
-    #[ignore_if(!is_hctr2_supported())]
+    #[test]
     fn data_inaccessible_with_diff_key_hctr2() {
+        if !is_hctr2_supported() {
+            return;
+        }
         data_inaccessible_with_diff_key(&KEY_SET_HCTR2, "name4");
     }
 
diff --git a/libs/devicemapper/src/loopdevice.rs b/libs/devicemapper/src/loopdevice.rs
index 30ab6f6..e41b90c 100644
--- a/libs/devicemapper/src/loopdevice.rs
+++ b/libs/devicemapper/src/loopdevice.rs
@@ -179,7 +179,6 @@
 #[cfg(test)]
 mod tests {
     use super::*;
-    use rdroidtest::rdroidtest;
     use std::fs;
     use std::path::Path;
 
@@ -205,7 +204,7 @@
         "1" == fs::read_to_string(autoclear).unwrap().trim()
     }
 
-    #[rdroidtest]
+    #[test]
     fn attach_loop_device_with_dio() {
         let a_dir = tempfile::TempDir::new().unwrap();
         let a_file = a_dir.path().join("test");
@@ -221,7 +220,7 @@
         assert!(is_direct_io(&dev));
     }
 
-    #[rdroidtest]
+    #[test]
     fn attach_loop_device_without_dio() {
         let a_dir = tempfile::TempDir::new().unwrap();
         let a_file = a_dir.path().join("test");
@@ -234,7 +233,7 @@
         assert!(!is_direct_io(&dev));
     }
 
-    #[rdroidtest]
+    #[test]
     fn attach_loop_device_with_dio_writable() {
         let a_dir = tempfile::TempDir::new().unwrap();
         let a_file = a_dir.path().join("test");
@@ -255,7 +254,7 @@
         assert!(is_direct_io_writable(&dev));
     }
 
-    #[rdroidtest]
+    #[test]
     fn attach_loop_device_autoclear() {
         let a_dir = tempfile::TempDir::new().unwrap();
         let a_file = a_dir.path().join("test");
diff --git a/tests/vm_accessor/test/Android.bp b/tests/vm_accessor/test/Android.bp
index 71746c7..16e9b1e 100644
--- a/tests/vm_accessor/test/Android.bp
+++ b/tests/vm_accessor/test/Android.bp
@@ -22,9 +22,6 @@
 rust_test {
     name: "vm_accessor_test",
     srcs: ["src/test.rs"],
-    defaults: [
-        "rdroidtest.defaults",
-    ],
     test_suites: [
         "general-tests",
     ],
diff --git a/tests/vm_accessor/test/src/test.rs b/tests/vm_accessor/test/src/test.rs
index d521acf..4d25fcd 100644
--- a/tests/vm_accessor/test/src/test.rs
+++ b/tests/vm_accessor/test/src/test.rs
@@ -18,7 +18,6 @@
 
 use com_android_virt_accessor_demo_vm_service::aidl::com::android::virt::accessor_demo::vm_service::IAccessorVmService::IAccessorVmService;
 use binder::{Strong, ProcessState};
-use rdroidtest::rdroidtest;
 
 const VM_SERVICE: &str = "com.android.virt.accessor_demo.vm_service.IAccessorVmService/default";
 
@@ -39,7 +38,7 @@
     binder::check_interface(VM_SERVICE).unwrap()
 }
 
-#[rdroidtest]
+#[test]
 fn test_wait_for_interface() {
     init();
 
@@ -49,7 +48,7 @@
     assert_eq!(sum, 23);
 }
 
-#[rdroidtest]
+#[test]
 fn test_wait_for_interface_twice() {
     init();
 
@@ -60,7 +59,7 @@
     assert_eq!(service2.add(11, 12).unwrap(), 23);
 }
 
-#[rdroidtest]
+#[test]
 fn test_wait_and_get_interface() {
     init();
 
@@ -71,7 +70,7 @@
     assert_eq!(service2.add(11, 12).unwrap(), 23);
 }
 
-#[rdroidtest]
+#[test]
 fn test_wait_and_check_interface() {
     init();
 
@@ -81,5 +80,3 @@
     assert_eq!(service1.add(11, 12).unwrap(), 23);
     assert_eq!(service2.add(11, 12).unwrap(), 23);
 }
-
-rdroidtest::test_main!();