Enable Tests am: a97fea0c04 am: 88194ffe28
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/zip/+/1863754
Change-Id: I2a4988cfe058db3f93aa10360dfeedba406e13f4
diff --git a/Android.bp b/Android.bp
index 0d50aaa..09732d0 100644
--- a/Android.bp
+++ b/Android.bp
@@ -22,6 +22,8 @@
name: "libzip",
host_supported: true,
crate_name: "zip",
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.5.13",
srcs: ["src/lib.rs"],
edition: "2018",
features: [
@@ -40,18 +42,138 @@
],
}
-// dependent_library ["feature_list"]
-// byteorder-1.4.3 "default,std"
-// cc-1.0.68
-// cfg-if-1.0.0
-// crc32fast-1.2.1 "default,std"
-// flate2-1.0.20 "any_zlib,libz-sys,zlib"
-// libc-0.2.97 "default,std"
-// libz-sys-1.1.3
-// pkg-config-0.3.19
-// proc-macro2-1.0.27 "default,proc-macro"
-// quote-1.0.9 "default,proc-macro"
-// syn-1.0.73 "clone-impls,default,derive,parsing,printing,proc-macro,quote"
-// thiserror-1.0.25
-// thiserror-impl-1.0.25
-// unicode-xid-0.2.2 "default"
+rust_defaults {
+ name: "zip_test_defaults",
+ crate_name: "zip",
+ srcs: ["src/lib.rs"],
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.5.13",
+ test_suites: ["general-tests"],
+ auto_gen_config: true,
+ edition: "2018",
+ features: [
+ "deflate-zlib",
+ "flate2",
+ ],
+ rustlibs: [
+ "libbencher",
+ "libbyteorder",
+ "libcrc32fast",
+ "libflate2",
+ "librand",
+ "libthiserror",
+ "libwalkdir",
+ ],
+}
+
+rust_test_host {
+ name: "zip_host_test_src_lib",
+ defaults: ["zip_test_defaults"],
+ test_options: {
+ unit_test: true,
+ },
+}
+
+rust_test {
+ name: "zip_device_test_src_lib",
+ defaults: ["zip_test_defaults"],
+}
+
+rust_defaults {
+ name: "zip_test_defaults_zip",
+ crate_name: "zip",
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.5.13",
+ test_suites: ["general-tests"],
+ auto_gen_config: true,
+ edition: "2018",
+ features: [
+ "deflate-zlib",
+ "flate2",
+ ],
+ rustlibs: [
+ "libbencher",
+ "libbyteorder",
+ "libcrc32fast",
+ "libflate2",
+ "librand",
+ "libthiserror",
+ "libwalkdir",
+ "libzip",
+ ],
+}
+
+rust_test_host {
+ name: "zip_host_test_tests_end_to_end",
+ defaults: ["zip_test_defaults_zip"],
+ srcs: ["tests/end_to_end.rs"],
+ test_options: {
+ unit_test: true,
+ },
+}
+
+rust_test {
+ name: "zip_device_test_tests_end_to_end",
+ defaults: ["zip_test_defaults_zip"],
+ srcs: ["tests/end_to_end.rs"],
+}
+
+rust_test_host {
+ name: "zip_host_test_tests_invalid_date",
+ defaults: ["zip_test_defaults_zip"],
+ srcs: ["tests/invalid_date.rs"],
+ test_options: {
+ unit_test: true,
+ },
+}
+
+rust_test {
+ name: "zip_device_test_tests_invalid_date",
+ defaults: ["zip_test_defaults_zip"],
+ srcs: ["tests/invalid_date.rs"],
+}
+
+rust_test_host {
+ name: "zip_host_test_tests_zip64_large",
+ defaults: ["zip_test_defaults_zip"],
+ srcs: ["tests/zip64_large.rs"],
+ test_options: {
+ unit_test: true,
+ },
+}
+
+rust_test {
+ name: "zip_device_test_tests_zip64_large",
+ defaults: ["zip_test_defaults_zip"],
+ srcs: ["tests/zip64_large.rs"],
+}
+
+rust_test_host {
+ name: "zip_host_test_tests_zip_comment_garbage",
+ defaults: ["zip_test_defaults_zip"],
+ srcs: ["tests/zip_comment_garbage.rs"],
+ test_options: {
+ unit_test: true,
+ },
+}
+
+rust_test {
+ name: "zip_device_test_tests_zip_comment_garbage",
+ defaults: ["zip_test_defaults_zip"],
+ srcs: ["tests/zip_comment_garbage.rs"],
+}
+
+rust_test_host {
+ name: "zip_host_test_tests_zip_crypto",
+ defaults: ["zip_test_defaults_zip"],
+ srcs: ["tests/zip_crypto.rs"],
+ test_options: {
+ unit_test: true,
+ },
+}
+
+rust_test {
+ name: "zip_device_test_tests_zip_crypto",
+ defaults: ["zip_test_defaults_zip"],
+ srcs: ["tests/zip_crypto.rs"],
+}
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 82662b1..6a9480e 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -2,19 +2,28 @@
{
"presubmit": [
{
- "name": "ZipFuseTest"
- },
- {
"name": "libapkverify.integration_test"
},
{
"name": "libapkverify.test"
},
{
- "name": "microdroid_manager_test"
+ "name": "zip_device_test_src_lib"
},
{
- "name": "virtualizationservice_device_test"
+ "name": "zip_device_test_tests_end_to_end"
+ },
+ {
+ "name": "zip_device_test_tests_invalid_date"
+ },
+ {
+ "name": "zip_device_test_tests_zip64_large"
+ },
+ {
+ "name": "zip_device_test_tests_zip_comment_garbage"
+ },
+ {
+ "name": "zip_device_test_tests_zip_crypto"
}
]
}
diff --git a/cargo2android.json b/cargo2android.json
index 425cfef..164b488 100644
--- a/cargo2android.json
+++ b/cargo2android.json
@@ -6,5 +6,6 @@
"dependencies": true,
"device": true,
"features": "deflate-zlib",
- "run": true
+ "run": true,
+ "tests": true
}