aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-03-25 12:32:51 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-03-25 12:32:51 +0000
commitc93acdf81e0b9e257f9880eead9e1561bef870cc (patch)
treee9112ccc69532822871b7fd658743d57d914dcbb
parent9830a9ea0046070d234a79d8b071b5119f86a3f5 (diff)
parent7e6387d1f117d0ffebef0ac9c48eaf21ae751040 (diff)
downloadlibm-android13-mainline-go-documentsui-release.tar.gz
Snap for 8358640 from 7e6387d1f117d0ffebef0ac9c48eaf21ae751040 to mainline-go-documentsui-releaseaml_go_doc_330912000android13-mainline-go-documentsui-release
Change-Id: If3eebdcbcf605bfa7dac42dc110ad1901875b809
-rw-r--r--Android.bp32
-rw-r--r--TEST_MAPPING20
-rw-r--r--patches/test_build_fix.patch31
-rw-r--r--src/math/pow.rs4
4 files changed, 61 insertions, 26 deletions
diff --git a/Android.bp b/Android.bp
index 0dfc4bc..8eacade 100644
--- a/Android.bp
+++ b/Android.bp
@@ -42,6 +42,8 @@ rust_library {
name: "liblibm",
host_supported: true,
crate_name: "libm",
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.2.1",
srcs: ["src/lib.rs"],
edition: "2018",
features: ["default"],
@@ -52,33 +54,19 @@ rust_library {
min_sdk_version: "29",
}
-rust_defaults {
- name: "libm_defaults",
+rust_test {
+ name: "libm_test_src_lib",
+ host_supported: true,
crate_name: "libm",
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.2.1",
srcs: ["src/lib.rs"],
test_suites: ["general-tests"],
auto_gen_config: true,
- edition: "2018",
- features: ["default"],
- proc_macros: ["libno_panic"],
-}
-
-rust_test_host {
- name: "libm_host_test_src_lib",
- defaults: ["libm_defaults"],
test_options: {
unit_test: true,
},
+ edition: "2018",
+ features: ["default"],
+ proc_macros: ["libno_panic"],
}
-
-rust_test {
- name: "libm_device_test_src_lib",
- defaults: ["libm_defaults"],
-}
-
-// dependent_library ["feature_list"]
-// no-panic-0.1.15
-// proc-macro2-1.0.26 "default,proc-macro"
-// quote-1.0.9 "default,proc-macro"
-// syn-1.0.70 "clone-impls,default,derive,full,parsing,printing,proc-macro,quote"
-// unicode-xid-0.2.1 "default"
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 06d8e5a..bfdf123 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -1,8 +1,24 @@
-// Generated by cargo2android.py for tests in Android.bp
+// Generated by update_crate_tests.py for tests that depend on this crate.
{
+ "imports": [
+ {
+ "path": "external/rust/crates/quiche"
+ }
+ ],
"presubmit": [
{
- "name": "libm_device_test_src_lib"
+ "name": "doh_unit_test"
+ },
+ {
+ "name": "libm_test_src_lib"
+ }
+ ],
+ "presubmit-rust": [
+ {
+ "name": "doh_unit_test"
+ },
+ {
+ "name": "libm_test_src_lib"
}
]
}
diff --git a/patches/test_build_fix.patch b/patches/test_build_fix.patch
new file mode 100644
index 0000000..82c3756
--- /dev/null
+++ b/patches/test_build_fix.patch
@@ -0,0 +1,31 @@
+From c18c704856ffa8b3349401300e66796d4cc8d4f5 Mon Sep 17 00:00:00 2001
+From: Jethro Beekman <jethro@fortanix.com>
+Date: Thu, 24 Jun 2021 15:58:36 +0200
+Subject: [PATCH] Fix build failure with latest nightly
+
+---
+ src/math/pow.rs | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/math/pow.rs b/src/math/pow.rs
+index c7fd0df..f79680a 100644
+--- a/src/math/pow.rs
++++ b/src/math/pow.rs
+@@ -604,7 +604,7 @@ mod tests {
+
+ // Factoring -1 out:
+ // (negative anything ^ integer should be (-1 ^ integer) * (positive anything ^ integer))
+- &[POS_ZERO, NEG_ZERO, POS_ONE, NEG_ONE, POS_EVENS, NEG_EVENS]
++ (&[POS_ZERO, NEG_ZERO, POS_ONE, NEG_ONE, POS_EVENS, NEG_EVENS])
+ .iter()
+ .for_each(|int_set| {
+ int_set.iter().for_each(|int| {
+@@ -616,7 +616,7 @@ mod tests {
+
+ // Negative base (imaginary results):
+ // (-anything except 0 and Infinity ^ non-integer should be NAN)
+- &NEG[1..(NEG.len() - 1)].iter().for_each(|set| {
++ (&NEG[1..(NEG.len() - 1)]).iter().for_each(|set| {
+ set.iter().for_each(|val| {
+ test_sets(&ALL[3..7], &|v: f64| pow(*val, v), &|_| NAN);
+ })
diff --git a/src/math/pow.rs b/src/math/pow.rs
index ce8e83e..8b5989c 100644
--- a/src/math/pow.rs
+++ b/src/math/pow.rs
@@ -604,7 +604,7 @@ mod tests {
// Factoring -1 out:
// (negative anything ^ integer should be (-1 ^ integer) * (positive anything ^ integer))
- &[POS_ZERO, NEG_ZERO, POS_ONE, NEG_ONE, POS_EVENS, NEG_EVENS]
+ (&[POS_ZERO, NEG_ZERO, POS_ONE, NEG_ONE, POS_EVENS, NEG_EVENS])
.iter()
.for_each(|int_set| {
int_set.iter().for_each(|int| {
@@ -616,7 +616,7 @@ mod tests {
// Negative base (imaginary results):
// (-anything except 0 and Infinity ^ non-integer should be NAN)
- &NEG[1..(NEG.len() - 1)].iter().for_each(|set| {
+ (&NEG[1..(NEG.len() - 1)]).iter().for_each(|set| {
set.iter().for_each(|val| {
test_sets(&ALL[3..7], &|v: f64| pow(*val, v), &|_| NAN);
})