Loading health/2.0/vts/functional/Android.bp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,7 @@ cc_test { defaults: ["VtsHalTargetTestDefaults"], defaults: ["VtsHalTargetTestDefaults"], srcs: ["VtsHalHealthV2_0TargetTest.cpp"], srcs: ["VtsHalHealthV2_0TargetTest.cpp"], static_libs: [ static_libs: [ "libgflags", "android.hardware.health@1.0", "android.hardware.health@1.0", "android.hardware.health@2.0", "android.hardware.health@2.0", ], ], Loading health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp +12 −0 Original line number Original line Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <android-base/logging.h> #include <android-base/logging.h> #include <android/hardware/health/2.0/IHealth.h> #include <android/hardware/health/2.0/IHealth.h> #include <android/hardware/health/2.0/types.h> #include <android/hardware/health/2.0/types.h> #include <gflags/gflags.h> using ::testing::AssertionFailure; using ::testing::AssertionFailure; using ::testing::AssertionResult; using ::testing::AssertionResult; Loading @@ -29,6 +30,8 @@ using ::testing::AssertionSuccess; using ::testing::VtsHalHidlTargetTestBase; using ::testing::VtsHalHidlTargetTestBase; using ::testing::VtsHalHidlTargetTestEnvBase; using ::testing::VtsHalHidlTargetTestEnvBase; DEFINE_bool(force, false, "Force test healthd even when the default instance is present."); namespace android { namespace android { namespace hardware { namespace hardware { namespace health { namespace health { Loading Loading @@ -57,6 +60,14 @@ class HealthHidlTest : public ::testing::VtsHalHidlTargetTestBase { public: public: virtual void SetUp() override { virtual void SetUp() override { std::string serviceName = HealthHidlEnvironment::Instance()->getServiceName<IHealth>(); std::string serviceName = HealthHidlEnvironment::Instance()->getServiceName<IHealth>(); if (serviceName == "backup" && !FLAGS_force && ::testing::VtsHalHidlTargetTestBase::getService<IHealth>() != nullptr) { LOG(INFO) << "Skipping tests on healthd because the default instance is present. " << "Use --force if you really want to test healthd."; GTEST_SKIP(); } LOG(INFO) << "get service with name:" << serviceName; LOG(INFO) << "get service with name:" << serviceName; ASSERT_FALSE(serviceName.empty()); ASSERT_FALSE(serviceName.empty()); mHealth = ::testing::VtsHalHidlTargetTestBase::getService<IHealth>(serviceName); mHealth = ::testing::VtsHalHidlTargetTestBase::getService<IHealth>(serviceName); Loading Loading @@ -314,6 +325,7 @@ int main(int argc, char** argv) { ::testing::AddGlobalTestEnvironment(HealthHidlEnvironment::Instance()); ::testing::AddGlobalTestEnvironment(HealthHidlEnvironment::Instance()); ::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv); HealthHidlEnvironment::Instance()->init(&argc, argv); HealthHidlEnvironment::Instance()->init(&argc, argv); gflags::ParseCommandLineFlags(&argc, &argv, true /* remove flags */); int status = RUN_ALL_TESTS(); int status = RUN_ALL_TESTS(); LOG(INFO) << "Test result = " << status; LOG(INFO) << "Test result = " << status; return status; return status; Loading Loading
health/2.0/vts/functional/Android.bp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,7 @@ cc_test { defaults: ["VtsHalTargetTestDefaults"], defaults: ["VtsHalTargetTestDefaults"], srcs: ["VtsHalHealthV2_0TargetTest.cpp"], srcs: ["VtsHalHealthV2_0TargetTest.cpp"], static_libs: [ static_libs: [ "libgflags", "android.hardware.health@1.0", "android.hardware.health@1.0", "android.hardware.health@2.0", "android.hardware.health@2.0", ], ], Loading
health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp +12 −0 Original line number Original line Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <android-base/logging.h> #include <android-base/logging.h> #include <android/hardware/health/2.0/IHealth.h> #include <android/hardware/health/2.0/IHealth.h> #include <android/hardware/health/2.0/types.h> #include <android/hardware/health/2.0/types.h> #include <gflags/gflags.h> using ::testing::AssertionFailure; using ::testing::AssertionFailure; using ::testing::AssertionResult; using ::testing::AssertionResult; Loading @@ -29,6 +30,8 @@ using ::testing::AssertionSuccess; using ::testing::VtsHalHidlTargetTestBase; using ::testing::VtsHalHidlTargetTestBase; using ::testing::VtsHalHidlTargetTestEnvBase; using ::testing::VtsHalHidlTargetTestEnvBase; DEFINE_bool(force, false, "Force test healthd even when the default instance is present."); namespace android { namespace android { namespace hardware { namespace hardware { namespace health { namespace health { Loading Loading @@ -57,6 +60,14 @@ class HealthHidlTest : public ::testing::VtsHalHidlTargetTestBase { public: public: virtual void SetUp() override { virtual void SetUp() override { std::string serviceName = HealthHidlEnvironment::Instance()->getServiceName<IHealth>(); std::string serviceName = HealthHidlEnvironment::Instance()->getServiceName<IHealth>(); if (serviceName == "backup" && !FLAGS_force && ::testing::VtsHalHidlTargetTestBase::getService<IHealth>() != nullptr) { LOG(INFO) << "Skipping tests on healthd because the default instance is present. " << "Use --force if you really want to test healthd."; GTEST_SKIP(); } LOG(INFO) << "get service with name:" << serviceName; LOG(INFO) << "get service with name:" << serviceName; ASSERT_FALSE(serviceName.empty()); ASSERT_FALSE(serviceName.empty()); mHealth = ::testing::VtsHalHidlTargetTestBase::getService<IHealth>(serviceName); mHealth = ::testing::VtsHalHidlTargetTestBase::getService<IHealth>(serviceName); Loading Loading @@ -314,6 +325,7 @@ int main(int argc, char** argv) { ::testing::AddGlobalTestEnvironment(HealthHidlEnvironment::Instance()); ::testing::AddGlobalTestEnvironment(HealthHidlEnvironment::Instance()); ::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv); HealthHidlEnvironment::Instance()->init(&argc, argv); HealthHidlEnvironment::Instance()->init(&argc, argv); gflags::ParseCommandLineFlags(&argc, &argv, true /* remove flags */); int status = RUN_ALL_TESTS(); int status = RUN_ALL_TESTS(); LOG(INFO) << "Test result = " << status; LOG(INFO) << "Test result = " << status; return status; return status; Loading