aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Chen <cken@google.com>2023-11-24 00:30:52 +0800
committerKen Chen <cken@google.com>2023-11-24 01:06:49 +0800
commit06c961955b4eb0ae56a2a1959477998f7bde668a (patch)
treedd1f8b9a3c10bc3001fad62e808ac3764febd76f
parent34671298f0b239a28e8698925ad0425881d5e973 (diff)
downloadDnsResolver-06c961955b4eb0ae56a2a1959477998f7bde668a.tar.gz
Find out whether the system is 32-bit or 64-bit by reading "ro.product.cpu.abi".
The original android::bpf::isUserspace64bit() cannot be used in test because MTS will run 32-bit tests on 64-bit platforms. The android::bpf::isUserspace64bit() checks whether the caller (test) itself is compiled to 32 or 64 bit, not the platform. It end up with that the 32 bit test checking the wrong path of libcom.android.tethering.dns_helper.so on a 64 bit platform. Bug: 310105002 Bug: 309369011 Bug: 309739930 Test: atest Test: m mts && mts-tradefed run mts -m resolv_integration_test Change-Id: I4b243fbb8b197abe44a4890252ed8f9adfcc5afb
-rw-r--r--tests/resolv_test_utils.cpp4
-rw-r--r--tests/resolv_test_utils.h7
2 files changed, 8 insertions, 3 deletions
diff --git a/tests/resolv_test_utils.cpp b/tests/resolv_test_utils.cpp
index 17c6c1db..4b09b213 100644
--- a/tests/resolv_test_utils.cpp
+++ b/tests/resolv_test_utils.cpp
@@ -229,3 +229,7 @@ void RemoveMdnsRoute() {
};
EXPECT_EQ(0, ForkAndRun(args_v6));
}
+
+bool is64bitAbi() {
+ return android::base::GetProperty("ro.product.cpu.abi", "").find("64") != std::string::npos;
+}
diff --git a/tests/resolv_test_utils.h b/tests/resolv_test_utils.h
index e7f3a026..e3f744ce 100644
--- a/tests/resolv_test_utils.h
+++ b/tests/resolv_test_utils.h
@@ -439,10 +439,11 @@ void RemoveMdnsRoute();
} \
} while (0)
+bool is64bitAbi();
+
static const std::string DNS_HELPER =
- android::bpf::isUserspace64bit()
- ? "/apex/com.android.tethering/lib64/libcom.android.tethering.dns_helper.so"
- : "/apex/com.android.tethering/lib/libcom.android.tethering.dns_helper.so";
+ is64bitAbi() ? "/apex/com.android.tethering/lib64/libcom.android.tethering.dns_helper.so"
+ : "/apex/com.android.tethering/lib/libcom.android.tethering.dns_helper.so";
#define SKIP_IF_DEPENDENT_LIB_DOES_NOT_EXIST(libPath) \
do { \