From 06c961955b4eb0ae56a2a1959477998f7bde668a Mon Sep 17 00:00:00 2001 From: Ken Chen Date: Fri, 24 Nov 2023 00:30:52 +0800 Subject: 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 --- tests/resolv_test_utils.cpp | 4 ++++ tests/resolv_test_utils.h | 7 ++++--- 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 { \ -- cgit v1.2.3