diff options
author | Zhuoyao Zhang <zhuoyao@google.com> | 2017-11-20 17:36:47 -0800 |
---|---|---|
committer | Zhuoyao Zhang <zhuoyao@google.com> | 2017-12-04 21:34:25 +0000 |
commit | 2aba02af56bee0cb756ee4a47cf77b54d380476f (patch) | |
tree | 1154c67a73646cd70bfdea20494dcfc5283c079d /boot | |
parent | 9272727df8c5e42f3afd1315b1018f2af8ccca90 (diff) | |
download | platform_hardware_interfaces-2aba02af56bee0cb756ee4a47cf77b54d380476f.tar.gz platform_hardware_interfaces-2aba02af56bee0cb756ee4a47cf77b54d380476f.tar.bz2 platform_hardware_interfaces-2aba02af56bee0cb756ee4a47cf77b54d380476f.zip |
Convert boot, memtrack and power hal to use service name aware testing.
Motivation:
1) Support running the test against each hal service instance for the
registered hal.
2) Support testability checker to determine whether we should run the
test on the taget device.
3) Help to determine the process we want to profile for coverage data
if running on coverage build.
Bug: 64203181
Test: make vts
vts-tradefed run vts -m VtsHalBootV1_0Target
vts-tradefed run vts -m VtsHalMemtrackV1_0Target
vts-tradefed run vts -m VtsHalPowerV1_0Target
vts-tradefed run vts -m VtsHalPowerV1_1Target
Change-Id: Ie0bbd9ef9d9fbe11de5aee70fad9028fa0ae897c
Diffstat (limited to 'boot')
-rw-r--r-- | boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp b/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp index f48a95d853..d1d7f73b6e 100644 --- a/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp +++ b/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp @@ -22,6 +22,7 @@ #include <android/hardware/boot/1.0/IBootControl.h> #include <VtsHalHidlTargetTestBase.h> +#include <VtsHalHidlTargetTestEnvBase.h> using ::android::hardware::boot::V1_0::IBootControl; using ::android::hardware::boot::V1_0::CommandResult; @@ -33,12 +34,25 @@ using ::android::sp; using std::string; using std::vector; +// Test environment for Boot HIDL HAL. +class BootHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { + public: + // get the test environment singleton + static BootHidlEnvironment* Instance() { + static BootHidlEnvironment* instance = new BootHidlEnvironment; + return instance; + } + + virtual void registerTestServices() override { registerTestService<IBootControl>(); } +}; + // The main test class for the Boot HIDL HAL. class BootHidlTest : public ::testing::VtsHalHidlTargetTestBase { public: virtual void SetUp() override { - boot = ::testing::VtsHalHidlTargetTestBase::getService<IBootControl>(); - ASSERT_NE(boot, nullptr); + boot = ::testing::VtsHalHidlTargetTestBase::getService<IBootControl>( + BootHidlEnvironment::Instance()->getServiceName<IBootControl>()); + ASSERT_NE(boot, nullptr); } virtual void TearDown() override {} @@ -171,8 +185,10 @@ TEST_F(BootHidlTest, GetSuffix) { } int main(int argc, char **argv) { - ::testing::InitGoogleTest(&argc, argv); - int status = RUN_ALL_TESTS(); - LOG(INFO) << "Test result = " << status; - return status; + ::testing::AddGlobalTestEnvironment(BootHidlEnvironment::Instance()); + ::testing::InitGoogleTest(&argc, argv); + BootHidlEnvironment::Instance()->init(&argc, argv); + int status = RUN_ALL_TESTS(); + LOG(INFO) << "Test result = " << status; + return status; } |