diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2019-03-08 03:18:13 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-03-08 03:18:13 +0000 |
commit | ace1da7c5bbc97102651e04f658d920f042d3255 (patch) | |
tree | e784e42cc49df42dc34a9a57489a1234e5a32df8 /health | |
parent | b6990823f92d4a94606144938e6d4c42486c9338 (diff) | |
parent | e6807ddec17da45161b5f20396776a0ba38b3680 (diff) | |
download | android_hardware_interfaces-ace1da7c5bbc97102651e04f658d920f042d3255.tar.gz android_hardware_interfaces-ace1da7c5bbc97102651e04f658d920f042d3255.tar.bz2 android_hardware_interfaces-ace1da7c5bbc97102651e04f658d920f042d3255.zip |
Merge "health: skip VTS on healthd if vendor HAL is present."
Diffstat (limited to 'health')
-rw-r--r-- | health/2.0/vts/functional/Android.bp | 1 | ||||
-rw-r--r-- | health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/health/2.0/vts/functional/Android.bp b/health/2.0/vts/functional/Android.bp index 3544e5f0c..b0905487e 100644 --- a/health/2.0/vts/functional/Android.bp +++ b/health/2.0/vts/functional/Android.bp @@ -19,6 +19,7 @@ cc_test { defaults: ["VtsHalTargetTestDefaults"], srcs: ["VtsHalHealthV2_0TargetTest.cpp"], static_libs: [ + "libgflags", "android.hardware.health@1.0", "android.hardware.health@2.0", ], diff --git a/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp b/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp index f895aecfd..4af8a5df3 100644 --- a/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp +++ b/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp @@ -22,6 +22,7 @@ #include <android-base/logging.h> #include <android/hardware/health/2.0/IHealth.h> #include <android/hardware/health/2.0/types.h> +#include <gflags/gflags.h> using ::testing::AssertionFailure; using ::testing::AssertionResult; @@ -29,6 +30,8 @@ using ::testing::AssertionSuccess; using ::testing::VtsHalHidlTargetTestBase; using ::testing::VtsHalHidlTargetTestEnvBase; +DEFINE_bool(force, false, "Force test healthd even when the default instance is present."); + namespace android { namespace hardware { namespace health { @@ -57,6 +60,14 @@ class HealthHidlTest : public ::testing::VtsHalHidlTargetTestBase { public: virtual void SetUp() override { 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; ASSERT_FALSE(serviceName.empty()); mHealth = ::testing::VtsHalHidlTargetTestBase::getService<IHealth>(serviceName); @@ -314,6 +325,7 @@ int main(int argc, char** argv) { ::testing::AddGlobalTestEnvironment(HealthHidlEnvironment::Instance()); ::testing::InitGoogleTest(&argc, argv); HealthHidlEnvironment::Instance()->init(&argc, argv); + gflags::ParseCommandLineFlags(&argc, &argv, true /* remove flags */); int status = RUN_ALL_TESTS(); LOG(INFO) << "Test result = " << status; return status; |