diff --git a/configstore/1.0/vts/functional/Android.bp b/configstore/1.0/vts/functional/Android.bp index 008b59d00a..31d4b1c9d9 100644 --- a/configstore/1.0/vts/functional/Android.bp +++ b/configstore/1.0/vts/functional/Android.bp @@ -19,6 +19,6 @@ cc_test { defaults: ["VtsHalTargetTestDefaults"], srcs: ["VtsHalConfigstoreV1_0TargetTest.cpp"], static_libs: ["android.hardware.configstore@1.0"], - test_suites: ["general-tests"], + test_suites: ["general-tests", "vts-core"], } diff --git a/configstore/1.0/vts/functional/VtsHalConfigstoreV1_0TargetTest.cpp b/configstore/1.0/vts/functional/VtsHalConfigstoreV1_0TargetTest.cpp index 70b5830c77..8a1a313bd6 100644 --- a/configstore/1.0/vts/functional/VtsHalConfigstoreV1_0TargetTest.cpp +++ b/configstore/1.0/vts/functional/VtsHalConfigstoreV1_0TargetTest.cpp @@ -16,11 +16,12 @@ #define LOG_TAG "ConfigstoreHidlHalTest" -#include -#include #include #include #include +#include +#include +#include #include using ::android::hardware::configstore::V1_0::ISurfaceFlingerConfigs; @@ -35,25 +36,12 @@ using ::android::sp; #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) #define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk()) -// Test environment for Configstore HIDL HAL. -class ConfigstoreHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { - public: - // get the test environment singleton - static ConfigstoreHidlEnvironment* Instance() { - static ConfigstoreHidlEnvironment* instance = new ConfigstoreHidlEnvironment; - return instance; - } - - virtual void registerTestServices() override { registerTestService(); } -}; - -class ConfigstoreHidlTest : public ::testing::VtsHalHidlTargetTestBase { +class ConfigstoreHidlTest : public ::testing::TestWithParam { public: sp sfConfigs; virtual void SetUp() override { - sfConfigs = ::testing::VtsHalHidlTargetTestBase::getService( - ConfigstoreHidlEnvironment::Instance()->getServiceName()); + sfConfigs = ISurfaceFlingerConfigs::getService(GetParam()); ASSERT_NE(sfConfigs, nullptr); } @@ -63,7 +51,7 @@ class ConfigstoreHidlTest : public ::testing::VtsHalHidlTargetTestBase { /** * Ensure all ISurfaceFlingerConfigs.hal function calls are successful. */ -TEST_F(ConfigstoreHidlTest, TestFunctionCalls) { +TEST_P(ConfigstoreHidlTest, TestFunctionCalls) { bool tmp; Return status = sfConfigs->vsyncEventPhaseOffsetNs( @@ -118,7 +106,7 @@ TEST_F(ConfigstoreHidlTest, TestFunctionCalls) { /** * Ensure repeated call to the same function returns the same result. */ -TEST_F(ConfigstoreHidlTest, TestSameReturnValue) { +TEST_P(ConfigstoreHidlTest, TestSameReturnValue) { int64_t original_ret; Return status = sfConfigs->vsyncEventPhaseOffsetNs( [&original_ret](OptionalInt64 arg) { original_ret = arg.value; }); @@ -135,7 +123,7 @@ TEST_F(ConfigstoreHidlTest, TestSameReturnValue) { * Make sure the constrains of hasWideColorDisplay, hasHDRDisplay * are enforced. */ -TEST_F(ConfigstoreHidlTest, TestColorConstrainsBasic) { +TEST_P(ConfigstoreHidlTest, TestColorConstrainsBasic) { bool hasWideColorDisplay; bool hasHDRDisplay; @@ -152,11 +140,7 @@ TEST_F(ConfigstoreHidlTest, TestColorConstrainsBasic) { } } -int main(int argc, char** argv) { - ::testing::AddGlobalTestEnvironment(ConfigstoreHidlEnvironment::Instance()); - ::testing::InitGoogleTest(&argc, argv); - ConfigstoreHidlEnvironment::Instance()->init(&argc, argv); - int status = RUN_ALL_TESTS(); - LOG(INFO) << "Test result = " << status; - return status; -} +INSTANTIATE_TEST_SUITE_P( + PerInstance, ConfigstoreHidlTest, + testing::ValuesIn(android::hardware::getAllHalInstanceNames(ISurfaceFlingerConfigs::descriptor)), + android::hardware::PrintInstanceNameToString);