Build crate and enable tests am: 2fb672c10c am: 0a3b3b8030

Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/quickcheck/+/1871434

Change-Id: Ie098eed076328006e1d26b09a42b10fa4b5f3fff
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..bb49dd5
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,64 @@
+// This file is generated by cargo2android.py --config cargo2android.json.
+// Do not modify this file as changes will be overridden on upgrade.
+
+
+
+rust_library {
+    name: "libquickcheck",
+    // has rustc warnings
+    host_supported: true,
+    crate_name: "quickcheck",
+    cargo_env_compat: true,
+    cargo_pkg_version: "1.0.3",
+    srcs: ["src/lib.rs"],
+    edition: "2018",
+    features: [
+        "default",
+        "env_logger",
+        "log",
+        "regex",
+        "use_logging",
+    ],
+    rustlibs: [
+        "libenv_logger",
+        "liblog_rust",
+        "librand",
+    ],
+}
+
+rust_defaults {
+    name: "quickcheck_test_defaults",
+    crate_name: "quickcheck",
+    // has rustc warnings
+    srcs: ["src/lib.rs"],
+    cargo_env_compat: true,
+    cargo_pkg_version: "1.0.3",
+    test_suites: ["general-tests"],
+    auto_gen_config: true,
+    edition: "2018",
+    features: [
+        "default",
+        "env_logger",
+        "log",
+        "regex",
+        "use_logging",
+    ],
+    rustlibs: [
+        "libenv_logger",
+        "liblog_rust",
+        "librand",
+    ],
+}
+
+rust_test_host {
+    name: "quickcheck_host_test_src_lib",
+    defaults: ["quickcheck_test_defaults"],
+    test_options: {
+        unit_test: true,
+    },
+}
+
+rust_test {
+    name: "quickcheck_device_test_src_lib",
+    defaults: ["quickcheck_test_defaults"],
+}
diff --git a/TEST_MAPPING b/TEST_MAPPING
new file mode 100644
index 0000000..ddd590f
--- /dev/null
+++ b/TEST_MAPPING
@@ -0,0 +1,8 @@
+// Generated by update_crate_tests.py for tests that depend on this crate.
+{
+  "presubmit": [
+    {
+      "name": "quickcheck_device_test_src_lib"
+    }
+  ]
+}
diff --git a/cargo2android.json b/cargo2android.json
new file mode 100644
index 0000000..3ebdf72
--- /dev/null
+++ b/cargo2android.json
@@ -0,0 +1,6 @@
+{
+  "dependencies": true,
+  "device": true,
+  "run": true,
+  "tests": true
+}
diff --git a/patches/tests.rs.patch b/patches/tests.rs.patch
new file mode 100644
index 0000000..938a68c
--- /dev/null
+++ b/patches/tests.rs.patch
@@ -0,0 +1,20 @@
+diff --git a/src/tests.rs b/src/tests.rs
+index 465ef15..6700f46 100644
+--- a/src/tests.rs
++++ b/src/tests.rs
+@@ -8,6 +8,7 @@ use std::path::PathBuf;
+ use super::{quickcheck, Gen, QuickCheck, TestResult};
+ 
+ #[test]
++#[cfg(not(target_os = "android"))]
+ fn prop_oob() {
+     fn prop() -> bool {
+         let zero: Vec<bool> = vec![];
+@@ -168,6 +169,7 @@ fn testable_unit() {
+ }
+ 
+ #[test]
++#[cfg(not(target_os = "android"))]
+ fn testable_unit_panic() {
+     fn panic() {
+         panic!()
diff --git a/src/tests.rs b/src/tests.rs
index 465ef15..6700f46 100644
--- a/src/tests.rs
+++ b/src/tests.rs
@@ -8,6 +8,7 @@
 use super::{quickcheck, Gen, QuickCheck, TestResult};
 
 #[test]
+#[cfg(not(target_os = "android"))]
 fn prop_oob() {
     fn prop() -> bool {
         let zero: Vec<bool> = vec![];
@@ -168,6 +169,7 @@
 }
 
 #[test]
+#[cfg(not(target_os = "android"))]
 fn testable_unit_panic() {
     fn panic() {
         panic!()