From a5521b0d9f53412454448f07c5bfaeb83a8bae84 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Thu, 28 Mar 2024 21:05:13 +0000 Subject: [PATCH] init_kill_services_test: don't always try to kill hwservicemanager When HIDL is not supported, hwservicemanager will not be running and may not even be installed on the device. Ignore-AOSP-First: Disabling HIDL internally first. Will cherry-pick these test CLs after. Test: init_kill_services_test Bug: 218588089 Change-Id: Iae41e35e4669dd62c99ab9f138fc419be2f5fa29 --- init/test_kill_services/Android.bp | 5 ++++- init/test_kill_services/init_kill_services_test.cpp | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/init/test_kill_services/Android.bp b/init/test_kill_services/Android.bp index 37361a813..ada87d804 100644 --- a/init/test_kill_services/Android.bp +++ b/init/test_kill_services/Android.bp @@ -10,7 +10,10 @@ package { cc_test { name: "init_kill_services_test", srcs: ["init_kill_services_test.cpp"], - shared_libs: ["libbase"], + shared_libs: [ + "libbase", + "libhidlbase", + ], test_suites: ["general-tests"], // TODO(b/153565474): switch back to auto-generation diff --git a/init/test_kill_services/init_kill_services_test.cpp b/init/test_kill_services/init_kill_services_test.cpp index 510ad8aee..3af92bb55 100644 --- a/init/test_kill_services/init_kill_services_test.cpp +++ b/init/test_kill_services/init_kill_services_test.cpp @@ -18,15 +18,20 @@ #include #include +#include #include using ::android::base::GetProperty; using ::android::base::SetProperty; using ::android::base::WaitForProperty; +using ::android::hardware::isHidlSupported; using std::literals::chrono_literals::operator""s; void ExpectKillingServiceRecovers(const std::string& service_name) { + if (!isHidlSupported() && service_name == "hwservicemanager") { + GTEST_SKIP() << "No HIDL support on device so hwservicemanager will not be running"; + } LOG(INFO) << "before we say hi to " << service_name << ", I can't have apexd around!"; // b/280514080 - servicemanager will restart apexd, and apexd will restart the