aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Vander Stoep <jeffv@google.com>2021-10-28 18:00:02 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-10-28 18:00:02 +0000
commit97c8629abea31b344a62d6ef0010cd8689c2d1bd (patch)
treedf8ef4d92706c20519fec3691a0bb1a052321ebb
parent3e979770f5730222f2db596b0588736bc0bc4196 (diff)
parentfec7289fe17086343237a2eb42ebad8e908b8204 (diff)
downloadquickcheck-97c8629abea31b344a62d6ef0010cd8689c2d1bd.tar.gz
Build crate and enable tests am: 2fb672c10c am: 0a3b3b8030 am: 5902b0375f am: fec7289fe1
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/quickcheck/+/1871434 Change-Id: Ic5c18381c623ca2e794898316d3731bdcd11319c
-rw-r--r--Android.bp64
-rw-r--r--TEST_MAPPING8
-rw-r--r--cargo2android.json6
-rw-r--r--patches/tests.rs.patch20
-rw-r--r--src/tests.rs2
5 files changed, 100 insertions, 0 deletions
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 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!()