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

Commit 1e283b38 authored by Frankie Lizcano's avatar Frankie Lizcano
Browse files

Improve Tuner VTS: Generate LnbLive Combos

This CL allows the VTS to read a vendor's configuration file, determine
if the given devices could support the Lnb Live dataflow, and generate
all combinations of units to run them on corresponding integration tests.

Bug: b/182519645

Test: vts-tradefed run vts --module VtsHalTvTunerTargetTest. Manual
tests with different input configuration files.

Change-Id: Iba5262375b3053e0093f91fd3b05a9ebd42ca7d0
parent a53f554c
Loading
Loading
Loading
Loading
+34 −17
Original line number Diff line number Diff line
@@ -494,6 +494,14 @@ TEST_P(TunerLnbAidlTest, SendDiseqcMessageToLnb) {
    if (!lnbLive.support) {
        return;
    }
    vector<LnbLiveHardwareConnections> lnbLive_configs = generateLnbLiveConfigurations();
    if (lnbLive_configs.empty()) {
        ALOGD("No frontends that support satellites.");
        return;
    }
    for (auto& combination : lnbLive_configs) {
        lnbLive = combination;

        if (lnbMap[lnbLive.lnbId].name.compare(emptyHardwareId) == 0) {
            vector<int32_t> ids;
            ASSERT_TRUE(mLnbTests.getLnbIds(ids));
@@ -512,6 +520,7 @@ TEST_P(TunerLnbAidlTest, SendDiseqcMessageToLnb) {
        }
        ASSERT_TRUE(mLnbTests.closeLnb());
    }
}

TEST_P(TunerDemuxAidlTest, openDemux) {
    description("Open and close a Demux.");
@@ -1019,9 +1028,17 @@ TEST_P(TunerBroadcastAidlTest, LnbBroadcastDataFlowVideoFilterTest) {
    if (!lnbLive.support) {
        return;
    }
    vector<LnbLiveHardwareConnections> lnbLive_configs = generateLnbLiveConfigurations();
    if (lnbLive_configs.empty()) {
        ALOGD("No frontends that support satellites.");
        return;
    }
    for (auto& combination : lnbLive_configs) {
        lnbLive = combination;
        broadcastSingleFilterTestWithLnb(filterMap[lnbLive.videoFilterId],
                                         frontendMap[lnbLive.frontendId], lnbMap[lnbLive.lnbId]);
    }
}

TEST_P(TunerBroadcastAidlTest, MediaFilterWithSharedMemoryHandle) {
    description("Test the Media Filter with shared memory handle");
+3 −0
Original line number Diff line number Diff line
@@ -65,6 +65,9 @@ AssertionResult filterDataOutputTestBase(FilterTests& tests) {
}

void clearIds() {
    lnbIds.clear();
    diseqcMsgs.clear();
    frontendIds.clear();
    recordDvrIds.clear();
    audioFilterIds.clear();
    videoFilterIds.clear();
+50 −1
Original line number Diff line number Diff line
@@ -173,6 +173,55 @@ static inline vector<DvrPlaybackHardwareConnections> generatePlaybackConfigs() {
    return playback_configs;
}

/*
 * index 0 - frontends
 * index 1 - audio filters
 * index 2 - video filters
 * index 3 - lnbs
 */
static inline vector<LnbLiveHardwareConnections> generateLnbLiveCombinations() {
    vector<LnbLiveHardwareConnections> combinations;
    vector<vector<string>> deviceIds{frontendIds, audioFilterIds, videoFilterIds, lnbIds};

    const int frontendIndex = 0;
    const int audioFilterIndex = 1;
    const int videoFilterIndex = 2;
    const int lnbIndex = 3;

    // TODO: Find a better way to vary diseqcMsgs, if at all
    auto idCombinations = generateIdCombinations(deviceIds);
    for (auto& combo : idCombinations) {
        const string feId = combo[frontendIndex];
        auto type = frontendMap[feId].type;
        if (type == FrontendType::DVBS || type == FrontendType::ISDBS ||
            type == FrontendType::ISDBS3) {
            LnbLiveHardwareConnections mLnbLive;
            mLnbLive.frontendId = feId;
            mLnbLive.audioFilterId = combo[audioFilterIndex];
            mLnbLive.videoFilterId = combo[videoFilterIndex];
            mLnbLive.lnbId = combo[lnbIndex];
            mLnbLive.diseqcMsgs = diseqcMsgs;
            combinations.push_back(mLnbLive);
        }
    }

    return combinations;
}

static inline vector<LnbLiveHardwareConnections> generateLnbLiveConfigurations() {
    vector<LnbLiveHardwareConnections> lnbLive_configs;
    if (configuredLnbLive) {
        ALOGD("Using LnbLive configuration provided.");
        lnbLive_configs = {lnbLive};
    } else {
        ALOGD("LnbLive not provided. Generating possible combinations. Consider adding it to the "
              "configuration file.");
        lnbLive_configs = generateLnbLiveCombinations();
    }

    return lnbLive_configs;
}

/** Config all the frontends that would be used in the tests */
inline void initFrontendConfig() {
    // The test will use the internal default fe when default fe is connected to any data flow
@@ -368,8 +417,8 @@ inline void connectHardwaresToTestCases() {
    TunerTestingConfigAidlReader1_0::connectDvrRecord(record);
    TunerTestingConfigAidlReader1_0::connectTimeFilter(timeFilter);
    TunerTestingConfigAidlReader1_0::connectDescrambling(descrambling);
    TunerTestingConfigAidlReader1_0::connectLnbLive(lnbLive);
    TunerTestingConfigAidlReader1_0::connectLnbRecord(lnbRecord);
    TunerTestingConfigAidlReader1_0::connectLnbLive(lnbLive);
    TunerTestingConfigAidlReader1_0::connectDvrPlayback(playback);
};

+6 −0
Original line number Diff line number Diff line
@@ -84,6 +84,9 @@ static vector<string> audioFilterIds;
static vector<string> videoFilterIds;
static vector<string> recordFilterIds;
static vector<string> sectionFilterIds;
static vector<string> frontendIds;
static vector<string> lnbIds;
static vector<string> diseqcMsgs;

#define PROVISION_STR                                      \
    "{                                                   " \
@@ -268,6 +271,7 @@ struct TunerTestingConfigAidlReader1_0 {
            auto frontends = *hardwareConfig.getFirstFrontends();
            for (auto feConfig : frontends.getFrontend()) {
                string id = feConfig.getId();
                frontendIds.push_back(id);
                if (id.compare(string("FE_DEFAULT")) == 0) {
                    // overrid default
                    frontendMap.erase(string("FE_DEFAULT"));
@@ -438,6 +442,7 @@ struct TunerTestingConfigAidlReader1_0 {
            auto lnbs = *hardwareConfig.getFirstLnbs();
            for (auto lnbConfig : lnbs.getLnb()) {
                string id = lnbConfig.getId();
                lnbIds.push_back(id);
                if (lnbConfig.hasName()) {
                    lnbMap[id].name = lnbConfig.getName();
                } else {
@@ -481,6 +486,7 @@ struct TunerTestingConfigAidlReader1_0 {
            auto msgs = *hardwareConfig.getFirstDiseqcMessages();
            for (auto msgConfig : msgs.getDiseqcMessage()) {
                string name = msgConfig.getMsgName();
                diseqcMsgs.push_back(name);
                for (uint8_t atom : msgConfig.getMsgBody()) {
                    diseqcMsgMap[name].push_back(atom);
                }