summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhuoyao Zhang2017-11-20 19:36:47 -0600
committerZhuoyao Zhang2017-12-04 15:34:25 -0600
commit2aba02af56bee0cb756ee4a47cf77b54d380476f (patch)
tree1154c67a73646cd70bfdea20494dcfc5283c079d /boot/1.0/vts
parent9272727df8c5e42f3afd1315b1018f2af8ccca90 (diff)
downloadplatform-hardware-interfaces-2aba02af56bee0cb756ee4a47cf77b54d380476f.tar.gz
platform-hardware-interfaces-2aba02af56bee0cb756ee4a47cf77b54d380476f.tar.xz
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/1.0/vts')
-rw-r--r--boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp28
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 f48a95d8..d1d7f73b 100644
--- a/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp
+++ b/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp
@@ -22,6 +22,7 @@
22#include <android/hardware/boot/1.0/IBootControl.h> 22#include <android/hardware/boot/1.0/IBootControl.h>
23 23
24#include <VtsHalHidlTargetTestBase.h> 24#include <VtsHalHidlTargetTestBase.h>
25#include <VtsHalHidlTargetTestEnvBase.h>
25 26
26using ::android::hardware::boot::V1_0::IBootControl; 27using ::android::hardware::boot::V1_0::IBootControl;
27using ::android::hardware::boot::V1_0::CommandResult; 28using ::android::hardware::boot::V1_0::CommandResult;
@@ -33,12 +34,25 @@ using ::android::sp;
33using std::string; 34using std::string;
34using std::vector; 35using std::vector;
35 36
37// Test environment for Boot HIDL HAL.
38class BootHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
39 public:
40 // get the test environment singleton
41 static BootHidlEnvironment* Instance() {
42 static BootHidlEnvironment* instance = new BootHidlEnvironment;
43 return instance;
44 }
45
46 virtual void registerTestServices() override { registerTestService<IBootControl>(); }
47};
48
36// The main test class for the Boot HIDL HAL. 49// The main test class for the Boot HIDL HAL.
37class BootHidlTest : public ::testing::VtsHalHidlTargetTestBase { 50class BootHidlTest : public ::testing::VtsHalHidlTargetTestBase {
38 public: 51 public:
39 virtual void SetUp() override { 52 virtual void SetUp() override {
40 boot = ::testing::VtsHalHidlTargetTestBase::getService<IBootControl>(); 53 boot = ::testing::VtsHalHidlTargetTestBase::getService<IBootControl>(
41 ASSERT_NE(boot, nullptr); 54 BootHidlEnvironment::Instance()->getServiceName<IBootControl>());
55 ASSERT_NE(boot, nullptr);
42 } 56 }
43 57
44 virtual void TearDown() override {} 58 virtual void TearDown() override {}
@@ -171,8 +185,10 @@ TEST_F(BootHidlTest, GetSuffix) {
171} 185}
172 186
173int main(int argc, char **argv) { 187int main(int argc, char **argv) {
174 ::testing::InitGoogleTest(&argc, argv); 188 ::testing::AddGlobalTestEnvironment(BootHidlEnvironment::Instance());
175 int status = RUN_ALL_TESTS(); 189 ::testing::InitGoogleTest(&argc, argv);
176 LOG(INFO) << "Test result = " << status; 190 BootHidlEnvironment::Instance()->init(&argc, argv);
177 return status; 191 int status = RUN_ALL_TESTS();
192 LOG(INFO) << "Test result = " << status;
193 return status;
178} 194}