mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-02 17:31:58 +00:00
Merge "[vts-core] add VtsHalConfigstoreV1_0TargetTest to vts-core"
This commit is contained in:
@@ -19,6 +19,6 @@ cc_test {
|
|||||||
defaults: ["VtsHalTargetTestDefaults"],
|
defaults: ["VtsHalTargetTestDefaults"],
|
||||||
srcs: ["VtsHalConfigstoreV1_0TargetTest.cpp"],
|
srcs: ["VtsHalConfigstoreV1_0TargetTest.cpp"],
|
||||||
static_libs: ["android.hardware.configstore@1.0"],
|
static_libs: ["android.hardware.configstore@1.0"],
|
||||||
test_suites: ["general-tests"],
|
test_suites: ["general-tests", "vts-core"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +16,12 @@
|
|||||||
|
|
||||||
#define LOG_TAG "ConfigstoreHidlHalTest"
|
#define LOG_TAG "ConfigstoreHidlHalTest"
|
||||||
|
|
||||||
#include <VtsHalHidlTargetTestBase.h>
|
|
||||||
#include <VtsHalHidlTargetTestEnvBase.h>
|
|
||||||
#include <android-base/logging.h>
|
#include <android-base/logging.h>
|
||||||
#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
|
#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
|
||||||
#include <android/hardware/configstore/1.0/types.h>
|
#include <android/hardware/configstore/1.0/types.h>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include <hidl/GtestPrinter.h>
|
||||||
|
#include <hidl/ServiceManagement.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
using ::android::hardware::configstore::V1_0::ISurfaceFlingerConfigs;
|
using ::android::hardware::configstore::V1_0::ISurfaceFlingerConfigs;
|
||||||
@@ -35,25 +36,12 @@ using ::android::sp;
|
|||||||
#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
|
#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
|
||||||
#define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk())
|
#define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk())
|
||||||
|
|
||||||
// Test environment for Configstore HIDL HAL.
|
class ConfigstoreHidlTest : public ::testing::TestWithParam<std::string> {
|
||||||
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<ISurfaceFlingerConfigs>(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
class ConfigstoreHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|
||||||
public:
|
public:
|
||||||
sp<ISurfaceFlingerConfigs> sfConfigs;
|
sp<ISurfaceFlingerConfigs> sfConfigs;
|
||||||
|
|
||||||
virtual void SetUp() override {
|
virtual void SetUp() override {
|
||||||
sfConfigs = ::testing::VtsHalHidlTargetTestBase::getService<ISurfaceFlingerConfigs>(
|
sfConfigs = ISurfaceFlingerConfigs::getService(GetParam());
|
||||||
ConfigstoreHidlEnvironment::Instance()->getServiceName<ISurfaceFlingerConfigs>());
|
|
||||||
ASSERT_NE(sfConfigs, nullptr);
|
ASSERT_NE(sfConfigs, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +51,7 @@ class ConfigstoreHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||||||
/**
|
/**
|
||||||
* Ensure all ISurfaceFlingerConfigs.hal function calls are successful.
|
* Ensure all ISurfaceFlingerConfigs.hal function calls are successful.
|
||||||
*/
|
*/
|
||||||
TEST_F(ConfigstoreHidlTest, TestFunctionCalls) {
|
TEST_P(ConfigstoreHidlTest, TestFunctionCalls) {
|
||||||
bool tmp;
|
bool tmp;
|
||||||
|
|
||||||
Return<void> status = sfConfigs->vsyncEventPhaseOffsetNs(
|
Return<void> status = sfConfigs->vsyncEventPhaseOffsetNs(
|
||||||
@@ -118,7 +106,7 @@ TEST_F(ConfigstoreHidlTest, TestFunctionCalls) {
|
|||||||
/**
|
/**
|
||||||
* Ensure repeated call to the same function returns the same result.
|
* Ensure repeated call to the same function returns the same result.
|
||||||
*/
|
*/
|
||||||
TEST_F(ConfigstoreHidlTest, TestSameReturnValue) {
|
TEST_P(ConfigstoreHidlTest, TestSameReturnValue) {
|
||||||
int64_t original_ret;
|
int64_t original_ret;
|
||||||
Return<void> status = sfConfigs->vsyncEventPhaseOffsetNs(
|
Return<void> status = sfConfigs->vsyncEventPhaseOffsetNs(
|
||||||
[&original_ret](OptionalInt64 arg) { original_ret = arg.value; });
|
[&original_ret](OptionalInt64 arg) { original_ret = arg.value; });
|
||||||
@@ -135,7 +123,7 @@ TEST_F(ConfigstoreHidlTest, TestSameReturnValue) {
|
|||||||
* Make sure the constrains of hasWideColorDisplay, hasHDRDisplay
|
* Make sure the constrains of hasWideColorDisplay, hasHDRDisplay
|
||||||
* are enforced.
|
* are enforced.
|
||||||
*/
|
*/
|
||||||
TEST_F(ConfigstoreHidlTest, TestColorConstrainsBasic) {
|
TEST_P(ConfigstoreHidlTest, TestColorConstrainsBasic) {
|
||||||
bool hasWideColorDisplay;
|
bool hasWideColorDisplay;
|
||||||
bool hasHDRDisplay;
|
bool hasHDRDisplay;
|
||||||
|
|
||||||
@@ -152,11 +140,7 @@ TEST_F(ConfigstoreHidlTest, TestColorConstrainsBasic) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
::testing::AddGlobalTestEnvironment(ConfigstoreHidlEnvironment::Instance());
|
PerInstance, ConfigstoreHidlTest,
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
testing::ValuesIn(android::hardware::getAllHalInstanceNames(ISurfaceFlingerConfigs::descriptor)),
|
||||||
ConfigstoreHidlEnvironment::Instance()->init(&argc, argv);
|
android::hardware::PrintInstanceNameToString);
|
||||||
int status = RUN_ALL_TESTS();
|
|
||||||
LOG(INFO) << "Test result = " << status;
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user