Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf50a32e authored by Zhuoyao Zhang's avatar Zhuoyao Zhang
Browse files

Convert drm hal test to use VtsHalHidlTargetTestEnvBase

* The testEnvBase template is only used to register the testing hal.
* The service name is specifically determined by the test logic, so
  disable the feature for vts to run the test against all service
  instance (by setting HalServiceCombMode::NO_COMBINATION)

Bug: 64203181
Test: make vts
      vts-tradefed run vts -m VtsHalDrmV1_0Target
      vts-tradefed run vts -m VtsHalDrmV1_1Target

Change-Id: Ib2e005e8ccbc815067f0e9455fcd3e6c5ec151fb
parent 6b0b8669
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
@@ -97,6 +97,27 @@ static const uint8_t kInvalidUUID[16] = {

static drm_vts::VendorModules* gVendorModules = nullptr;

// Test environment for drm
class DrmHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
   public:
    // get the test environment singleton
    static DrmHidlEnvironment* Instance() {
        static DrmHidlEnvironment* instance = new DrmHidlEnvironment;
        return instance;
    }

    void registerTestServices() override {
        registerTestService<ICryptoFactory>();
        registerTestService<IDrmFactory>();
        setServiceCombMode(::testing::HalServiceCombMode::NO_COMBINATION);
    }

   private:
    DrmHidlEnvironment() {}

    GTEST_DISALLOW_COPY_AND_ASSIGN_(DrmHidlEnvironment);
};

class DrmHalVendorFactoryTest : public testing::TestWithParam<std::string> {
   public:
    DrmHalVendorFactoryTest()
@@ -1598,6 +1619,10 @@ int main(int argc, char** argv) {
        std::cerr << "WARNING: No vendor modules found in " << kModulePath <<
                ", all vendor tests will be skipped" << std::endl;
    }
    ::testing::AddGlobalTestEnvironment(DrmHidlEnvironment::Instance());
    ::testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
    DrmHidlEnvironment::Instance()->init(&argc, argv);
    int status = RUN_ALL_TESTS();
    ALOGI("Test result = %d", status);
    return status;
}
+6 −0
Original line number Diff line number Diff line
@@ -106,6 +106,12 @@ class DrmHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {

    virtual void HidlTearDown() override { ALOGI("TearDown DrmHidlEnvironment"); }

    void registerTestServices() override {
        registerTestService<ICryptoFactory>();
        registerTestService<IDrmFactory>();
        setServiceCombMode(::testing::HalServiceCombMode::NO_COMBINATION);
    }

   private:
    DrmHidlEnvironment() {}