aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Vander Stoep <jeffv@google.com>2021-02-10 14:04:33 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-02-10 14:04:33 +0000
commit6665563ccd76aeb429ae3f6edc1d3402c02e2c31 (patch)
tree87f56fc296b4c0b2a29e9c88d16a838973de083d
parent9989ca0d7482a3998b6e78e50eb318ce6cfd10e2 (diff)
parent7e055754d677c3692c26fe48935483b03fc0a10f (diff)
downloadlazy_static-6665563ccd76aeb429ae3f6edc1d3402c02e2c31.tar.gz
Enable tests am: fd3e50c996 am: f8a10189b3 am: 7e055754d6
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/lazy_static/+/1581724 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I3518e28fe4d34b05424cfb9eaae2524c65e8b38f
-rw-r--r--Android.bp73
-rw-r--r--TEST_MAPPING21
-rw-r--r--patches/Android.bp.diff35
-rw-r--r--patches/lib.rs.diff24
-rw-r--r--src/lib.rs13
5 files changed, 140 insertions, 26 deletions
diff --git a/Android.bp b/Android.bp
index 7c28208..ead8044 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,7 +1,76 @@
-// This file is generated by cargo2android.py --run --device --dependencies --patch=patches/Android.bp.diff.
+// This file is generated by cargo2android.py --run --device --dependencies --tests --patch=patches/Android.bp.diff.
+
+rust_defaults {
+ name: "lazy_static_defaults",
+ crate_name: "lazy_static",
+ // has rustc warnings
+ srcs: ["src/lib.rs"],
+ test_suites: ["general-tests"],
+ auto_gen_config: true,
+ edition: "2015",
+}
+
+rust_test_host {
+ name: "lazy_static_host_test_src_lib",
+ defaults: ["lazy_static_defaults"],
+ test_options: {
+ unit_test: true,
+ },
+}
+
+rust_test {
+ name: "lazy_static_device_test_src_lib",
+ defaults: ["lazy_static_defaults"],
+}
+
+rust_defaults {
+ name: "lazy_static_defaults_lazy_static",
+ crate_name: "lazy_static",
+ test_suites: ["general-tests"],
+ auto_gen_config: true,
+ edition: "2015",
+ rustlibs: [
+ "liblazy_static",
+ ],
+}
+
+rust_test_host {
+ name: "lazy_static_host_test_tests_no_std",
+ defaults: ["lazy_static_defaults_lazy_static"],
+ // has rustc warnings
+ srcs: ["tests/no_std.rs"],
+ test_options: {
+ unit_test: true,
+ },
+}
+
+rust_test {
+ name: "lazy_static_device_test_tests_no_std",
+ defaults: ["lazy_static_defaults_lazy_static"],
+ // has rustc warnings
+ srcs: ["tests/no_std.rs"],
+}
+
+rust_test_host {
+ name: "lazy_static_host_test_tests_test",
+ defaults: ["lazy_static_defaults_lazy_static"],
+ // has rustc warnings
+ srcs: ["tests/test.rs"],
+ test_options: {
+ unit_test: true,
+ },
+}
+
+rust_test {
+ name: "lazy_static_device_test_tests_test",
+ defaults: ["lazy_static_defaults_lazy_static"],
+ // has rustc warnings
+ srcs: ["tests/test.rs"],
+}
rust_library {
name: "liblazy_static",
+ // has rustc warnings
host_supported: true,
crate_name: "lazy_static",
srcs: ["src/lib.rs"],
@@ -12,3 +81,5 @@ rust_library {
],
min_sdk_version: "29",
}
+
+// dependent_library ["feature_list"]
diff --git a/TEST_MAPPING b/TEST_MAPPING
index fad2d90..1842f5d 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -1,23 +1,26 @@
-// Generated by cargo2android.py for tests in Android.bp
+// Generated by update_crate_tests.py for tests that depend on this crate.
{
"presubmit": [
{
- "host": true,
- "name": "thread_local_host_test_src_lib"
+ "name": "quiche_device_test_src_lib"
},
{
- "name": "android_logger_device_test_src_lib"
+ "name": "lazy_static_device_test_tests_test"
},
{
- "host": true,
- "name": "tokio-macros_host_test_src_lib"
+ "name": "libsqlite3-sys_device_test_src_lib"
},
{
- "host": true,
- "name": "libsqlite3-sys_host_test_src_lib"
+ "name": "lazy_static_device_test_tests_no_std"
},
{
- "name": "libsqlite3-sys_device_test_src_lib"
+ "name": "android_logger_device_test_src_lib"
+ },
+ {
+ "name": "authfs_device_test_src_lib"
+ },
+ {
+ "name": "lazy_static_device_test_src_lib"
}
]
}
diff --git a/patches/Android.bp.diff b/patches/Android.bp.diff
index 3c1b4cb..3406a8e 100644
--- a/patches/Android.bp.diff
+++ b/patches/Android.bp.diff
@@ -1,11 +1,26 @@
---- Android.bp 2020-12-14 18:47:48.373508351 +0900
-+++ Android.bp.new 2020-12-14 18:47:04.753908034 +0900
-@@ -2,8 +2,17 @@
+diff --git a/Android.bp b/Android.bp
+index 937918e..ead8044 100644
+--- a/Android.bp
++++ b/Android.bp
+@@ -8,9 +8,6 @@ rust_defaults {
+ test_suites: ["general-tests"],
+ auto_gen_config: true,
+ edition: "2015",
+- rustlibs: [
+- "libdoc_comment",
+- ],
+ }
- rust_library {
- name: "liblazy_static",
-+ // has rustc warnings
- host_supported: true,
+ rust_test_host {
+@@ -33,7 +30,6 @@ rust_defaults {
+ auto_gen_config: true,
+ edition: "2015",
+ rustlibs: [
+- "libdoc_comment",
+ "liblazy_static",
+ ],
+ }
+@@ -79,7 +75,11 @@ rust_library {
crate_name: "lazy_static",
srcs: ["src/lib.rs"],
edition: "2015",
@@ -15,6 +30,6 @@
+ ],
+ min_sdk_version: "29",
}
-+
-+// dependent_library ["feature_list"]
-+// doc-comment-0.3.3
+
+ // dependent_library ["feature_list"]
+-// doc-comment-0.3.3
diff --git a/patches/lib.rs.diff b/patches/lib.rs.diff
new file mode 100644
index 0000000..cb9510f
--- /dev/null
+++ b/patches/lib.rs.diff
@@ -0,0 +1,24 @@
+diff --git a/src/lib.rs b/src/lib.rs
+index cada0dc..0d9d46e 100644
+--- a/src/lib.rs
++++ b/src/lib.rs
+@@ -104,12 +104,13 @@ This crate provides one cargo feature:
+ #[doc(hidden)]
+ pub mod lazy;
+
+-#[cfg(test)]
+-#[macro_use]
+-extern crate doc_comment;
+-
+-#[cfg(test)]
+-doctest!("../README.md");
++// ANDROID: disable tests that require doc_comment crate.
++//#[cfg(test)]
++//#[macro_use]
++//extern crate doc_comment;
++//
++//#[cfg(test)]
++//`doctest!("../README.md");
+
+ #[cfg(feature = "spin_no_std")]
+ #[path="core_lazy.rs"]
diff --git a/src/lib.rs b/src/lib.rs
index cada0dc..0d9d46e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -104,12 +104,13 @@ This crate provides one cargo feature:
#[doc(hidden)]
pub mod lazy;
-#[cfg(test)]
-#[macro_use]
-extern crate doc_comment;
-
-#[cfg(test)]
-doctest!("../README.md");
+// ANDROID: disable tests that require doc_comment crate.
+//#[cfg(test)]
+//#[macro_use]
+//extern crate doc_comment;
+//
+//#[cfg(test)]
+//`doctest!("../README.md");
#[cfg(feature = "spin_no_std")]
#[path="core_lazy.rs"]