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

Commit e2a91ed3 authored by Dan Shi's avatar Dan Shi
Browse files

Convert MediaOmx tests to parameterized gtest

Bug: 142950220
Test: atest VtsHalMediaOmxV1_0TargetMasterTest \
  VtsHalMediaOmxV1_0TargetComponentTest \
  VtsHalMediaOmxV1_0TargetAudioEncTest \
  VtsHalMediaOmxV1_0TargetAudioDecTest \
  VtsHalMediaOmxV1_0TargetVideoDecTest \
  VtsHalMediaOmxV1_0TargetVideoEncTest

Change-Id: Id1b8f6073c98db36c0ac86a881e7220ecfd0a71f
parent c940a179
Loading
Loading
Loading
Loading

media/Android.bp

0 → 100644
+27 −0
Original line number Original line Diff line number Diff line
//
// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

filegroup {
    name: "media_omx_audio_res",
    path: "res",
    srcs: ["res/*hz*"],
}

filegroup {
    name: "media_omx_video_res",
    path: "res",
    srcs: ["res/*fps*"],
}
+6 −8
Original line number Original line Diff line number Diff line
@@ -6,29 +6,27 @@ The scope of the tests presented here is not restricted solely to testing omx ha
#### master :
#### master :
Functionality of master is to enumerate all the omx components (and the roles it supports) available in android media framework.
Functionality of master is to enumerate all the omx components (and the roles it supports) available in android media framework.


usage: VtsHalMediaOmxV1\_0TargetMasterTest -I default
usage: atest VtsHalMediaOmxV1\_0TargetMasterTest


#### component :
#### component :
This folder includes test fixtures that tests aspects common to all omx compatible components. For instance, port enabling/disabling, enumerating port formats, state transitions, flush, ..., stay common to all components irrespective of the service they offer. Test fixtures here are directed towards testing these (omx core). Every standard OMX compatible component is expected to pass these tests.
This folder includes test fixtures that tests aspects common to all omx compatible components. For instance, port enabling/disabling, enumerating port formats, state transitions, flush, ..., stay common to all components irrespective of the service they offer. Test fixtures here are directed towards testing these (omx core). Every standard OMX compatible component is expected to pass these tests.


usage: VtsHalMediaOmxV1\_0TargetComponentTest -I default -C <comp name> -R <comp role>
usage: atest VtsHalMediaOmxV1\_0TargetComponentTest


#### audio :
#### audio :
This folder includes test fixtures associated with testing audio encoder and decoder components such as simple encoding of a raw clip or decoding of an elementary stream, end of stream test, timestamp deviations test, flush test and so on. These tests are aimed towards testing the plugin that connects the component to the omx core.
This folder includes test fixtures associated with testing audio encoder and decoder components such as simple encoding of a raw clip or decoding of an elementary stream, end of stream test, timestamp deviations test, flush test and so on. These tests are aimed towards testing the plugin that connects the component to the omx core.


usage:
usage:


VtsHalMediaOmxV1\_0TargetAudioDecTest -I default -C <comp name> -R audio_decoder.<comp class> -P /data/local/tmp/media/
atest VtsHalMediaOmxV1\_0TargetAudioDecTest


VtsHalMediaOmxV1\_0TargetAudioEncTest -I default -C <comp name> -R audio_encoder.<comp class> -P /data/local/tmp/media/
atest VtsHalMediaOmxV1\_0TargetAudioEncTest


#### video :
#### video :
This folder includes test fixtures associated with testing video encoder and decoder components such as simple encoding of a raw clip or decoding of an elementary stream, end of stream test, timestamp deviations test, flush test and so on. These tests are aimed towards testing the plugin that connects the component to the omx core.
This folder includes test fixtures associated with testing video encoder and decoder components such as simple encoding of a raw clip or decoding of an elementary stream, end of stream test, timestamp deviations test, flush test and so on. These tests are aimed towards testing the plugin that connects the component to the omx core.


usage:
usage:


VtsHalMediaOmxV1\_0TargetVideoDecTest -I default -C <comp name> -R video_decoder.<comp class> -P /data/local/tmp/media/
atest VtsHalMediaOmxV1\_0TargetVideoDecTest


VtsHalMediaOmxV1\_0TargetVideoEncTest -I default -C <comp name> -R video_encoder.<comp class> -P /data/local/tmp/media/
atest VtsHalMediaOmxV1\_0TargetVideoEncTest

While tesing audio/video encoder, decoder components, test fixtures require input files. These input are files are present in the folder 'res'. Before running the tests all the files in 'res' have to be placed in '/data/local/tmp/media' or a path of your choice and this path needs to be provided as an argument to the test application
+14 −6
Original line number Original line Diff line number Diff line
@@ -16,22 +16,30 @@


cc_test {
cc_test {
    name: "VtsHalMediaOmxV1_0TargetAudioEncTest",
    name: "VtsHalMediaOmxV1_0TargetAudioEncTest",
    stem: "vts_hal_media_omx_v1_0_audio_enc_test",
    defaults: ["VtsHalMediaOmxV1_0Defaults"],
    defaults: ["VtsHalMediaOmxV1_0Defaults"],
    srcs: [
    srcs: [
        "VtsHalMediaOmxV1_0TargetAudioEncTest.cpp",
        "VtsHalMediaOmxV1_0TargetAudioEncTest.cpp",
        "media_audio_hidl_test_common.cpp"
        "media_audio_hidl_test_common.cpp",
    ],
    data: [":media_omx_audio_res"],
    test_config: "VtsHalMediaOmxV1_0TargetAudioEncTest.xml",
    test_suites: [
        "vts-core",
    ],
    ],
    test_suites: ["general-tests"],
}
}


cc_test {
cc_test {
    name: "VtsHalMediaOmxV1_0TargetAudioDecTest",
    name: "VtsHalMediaOmxV1_0TargetAudioDecTest",
    stem: "vts_hal_media_omx_v1_0_audio_dec_test",
    defaults: ["VtsHalMediaOmxV1_0Defaults"],
    defaults: ["VtsHalMediaOmxV1_0Defaults"],
    srcs: [
    srcs: [
        "VtsHalMediaOmxV1_0TargetAudioDecTest.cpp",
        "VtsHalMediaOmxV1_0TargetAudioDecTest.cpp",
        "media_audio_hidl_test_common.cpp"
        "media_audio_hidl_test_common.cpp",
    ],
    data: [":media_omx_audio_res"],
    test_config: "VtsHalMediaOmxV1_0TargetAudioDecTest.xml",
    test_suites: [
        "vts-core",
    ],
    ],
    test_suites: ["general-tests"],
}
}

+69 −64
Original line number Original line Diff line number Diff line
@@ -28,6 +28,8 @@
#include <android/hidl/allocator/1.0/IAllocator.h>
#include <android/hidl/allocator/1.0/IAllocator.h>
#include <android/hidl/memory/1.0/IMapper.h>
#include <android/hidl/memory/1.0/IMapper.h>
#include <android/hidl/memory/1.0/IMemory.h>
#include <android/hidl/memory/1.0/IMemory.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>


using ::android::hardware::media::omx::V1_0::IOmx;
using ::android::hardware::media::omx::V1_0::IOmx;
using ::android::hardware::media::omx::V1_0::IOmxObserver;
using ::android::hardware::media::omx::V1_0::IOmxObserver;
@@ -44,42 +46,39 @@ using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_string;
using ::android::sp;
using ::android::sp;


#include <VtsHalHidlTargetTestBase.h>
#include <getopt.h>
#include <getopt.h>
#include <media_audio_hidl_test_common.h>
#include <media_audio_hidl_test_common.h>
#include <media_hidl_test_common.h>
#include <fstream>
#include <fstream>


static ComponentTestEnvironment* gEnv = nullptr;
// Resource directory
std::string sResourceDir = "";


// audio decoder test fixture class
// audio decoder test fixture class
class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
class AudioDecHidlTest
   private:
    : public ::testing::TestWithParam<std::tuple<std::string, std::string, std::string>> {
    typedef ::testing::VtsHalHidlTargetTestBase Super;
  public:
  public:
    ::std::string getTestCaseInfo() const override {
    ::std::string getTestCaseInfo() const {
        return ::std::string() +
        return ::std::string() + "Component: " + component_ + " | " + "Role: " + role_ + " | " +
                "Component: " + gEnv->getComponent().c_str() + " | " +
               "Instance: " + instance_ + " | " + "Res: " + sResourceDir;
                "Role: " + gEnv->getRole().c_str() + " | " +
                "Instance: " + gEnv->getInstance().c_str() + " | " +
                "Res: " + gEnv->getRes().c_str();
    }
    }


    virtual void SetUp() override {
    virtual void SetUp() override {
        Super::SetUp();
        instance_ = std::get<0>(GetParam());
        component_ = std::get<1>(GetParam());
        role_ = std::get<2>(GetParam());
        ASSERT_NE(sResourceDir.empty(), true);

        disableTest = false;
        disableTest = false;
        android::hardware::media::omx::V1_0::Status status;
        android::hardware::media::omx::V1_0::Status status;
        omx = Super::getService<IOmx>(gEnv->getInstance());
        omx = IOmx::getService(instance_);
        ASSERT_NE(omx, nullptr);
        ASSERT_NE(omx, nullptr);
        observer =
        observer =
            new CodecObserver([this](Message msg, const BufferInfo* buffer) {
            new CodecObserver([this](Message msg, const BufferInfo* buffer) {
                handleMessage(msg, buffer);
                handleMessage(msg, buffer);
            });
            });
        ASSERT_NE(observer, nullptr);
        ASSERT_NE(observer, nullptr);
        if (strncmp(gEnv->getComponent().c_str(), "OMX.", 4) != 0)
        if (component_.find("OMX.") != 0) disableTest = true;
            disableTest = true;
        EXPECT_TRUE(omx->allocateNode(component_, observer,
        EXPECT_TRUE(omx->allocateNode(
                           gEnv->getComponent(), observer,
                                      [&](android::hardware::media::omx::V1_0::Status _s,
                                      [&](android::hardware::media::omx::V1_0::Status _s,
                                          sp<IOmxNode> const& _nl) {
                                          sp<IOmxNode> const& _nl) {
                                          status = _s;
                                          status = _s;
@@ -93,7 +92,7 @@ class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
        }
        }
        ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
        ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
        ASSERT_NE(omxNode, nullptr);
        ASSERT_NE(omxNode, nullptr);
        ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
        ASSERT_NE(role_.empty(), true) << "Invalid Component Role";
        struct StringToName {
        struct StringToName {
            const char* Name;
            const char* Name;
            standardComp CompName;
            standardComp CompName;
@@ -108,7 +107,7 @@ class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
            sizeof(kStringToName) / sizeof(kStringToName[0]);
            sizeof(kStringToName) / sizeof(kStringToName[0]);
        const char* pch;
        const char* pch;
        char substring[OMX_MAX_STRINGNAME_SIZE];
        char substring[OMX_MAX_STRINGNAME_SIZE];
        strcpy(substring, gEnv->getRole().c_str());
        strcpy(substring, role_.c_str());
        pch = strchr(substring, '.');
        pch = strchr(substring, '.');
        ASSERT_NE(pch, nullptr);
        ASSERT_NE(pch, nullptr);
        compName = unknown_comp;
        compName = unknown_comp;
@@ -153,11 +152,8 @@ class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
        timestampDevTest = false;
        timestampDevTest = false;
        isSecure = false;
        isSecure = false;
        size_t suffixLen = strlen(".secure");
        size_t suffixLen = strlen(".secure");
        if (strlen(gEnv->getComponent().c_str()) >= suffixLen) {
        if (component_.rfind(".secure") == component_.length() - suffixLen) {
            isSecure =
            isSecure = true;
                !strcmp(gEnv->getComponent().c_str() +
                            strlen(gEnv->getComponent().c_str()) - suffixLen,
                        ".secure");
        }
        }
        if (isSecure) disableTest = true;
        if (isSecure) disableTest = true;
        if (disableTest) std::cout << "[   WARN   ] Test Disabled \n";
        if (disableTest) std::cout << "[   WARN   ] Test Disabled \n";
@@ -172,7 +168,6 @@ class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
            EXPECT_TRUE((omxNode->freeNode()).isOk());
            EXPECT_TRUE((omxNode->freeNode()).isOk());
            omxNode = nullptr;
            omxNode = nullptr;
        }
        }
        Super::TearDown();
    }
    }


    // callback function to process messages received by onMessages() from IL
    // callback function to process messages received by onMessages() from IL
@@ -249,6 +244,10 @@ class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
        unknown_comp,
        unknown_comp,
    };
    };


    std::string component_;
    std::string role_;
    std::string instance_;

    sp<IOmx> omx;
    sp<IOmx> omx;
    sp<CodecObserver> observer;
    sp<CodecObserver> observer;
    sp<IOmxNode> omxNode;
    sp<IOmxNode> omxNode;
@@ -656,21 +655,21 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
}
}


// set component role
// set component role
TEST_F(AudioDecHidlTest, SetRole) {
TEST_P(AudioDecHidlTest, SetRole) {
    description("Test Set Component Role");
    description("Test Set Component Role");
    if (disableTest) return;
    if (disableTest) return;
    android::hardware::media::omx::V1_0::Status status;
    android::hardware::media::omx::V1_0::Status status;
    status = setRole(omxNode, gEnv->getRole().c_str());
    status = setRole(omxNode, role_);
    ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
    ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
}
}


// port format enumeration
// port format enumeration
TEST_F(AudioDecHidlTest, EnumeratePortFormat) {
TEST_P(AudioDecHidlTest, EnumeratePortFormat) {
    description("Test Component on Mandatory Port Parameters (Port Format)");
    description("Test Component on Mandatory Port Parameters (Port Format)");
    if (disableTest) return;
    if (disableTest) return;
    android::hardware::media::omx::V1_0::Status status;
    android::hardware::media::omx::V1_0::Status status;
    uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
    uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
    status = setRole(omxNode, gEnv->getRole().c_str());
    status = setRole(omxNode, role_);
    ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
    ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
    OMX_PORT_PARAM_TYPE params;
    OMX_PORT_PARAM_TYPE params;
    status = getParam(omxNode, OMX_IndexParamAudioInit, &params);
    status = getParam(omxNode, OMX_IndexParamAudioInit, &params);
@@ -687,12 +686,12 @@ TEST_F(AudioDecHidlTest, EnumeratePortFormat) {


// test port settings reconfiguration, elementary stream decode and timestamp
// test port settings reconfiguration, elementary stream decode and timestamp
// deviation
// deviation
TEST_F(AudioDecHidlTest, DecodeTest) {
TEST_P(AudioDecHidlTest, DecodeTest) {
    description("Tests Port Reconfiguration, Decode and timestamp deviation");
    description("Tests Port Reconfiguration, Decode and timestamp deviation");
    if (disableTest) return;
    if (disableTest) return;
    android::hardware::media::omx::V1_0::Status status;
    android::hardware::media::omx::V1_0::Status status;
    uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
    uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
    status = setRole(omxNode, gEnv->getRole().c_str());
    status = setRole(omxNode, role_);
    ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
    ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
    OMX_PORT_PARAM_TYPE params;
    OMX_PORT_PARAM_TYPE params;
    status = getParam(omxNode, OMX_IndexParamAudioInit, &params);
    status = getParam(omxNode, OMX_IndexParamAudioInit, &params);
@@ -702,8 +701,8 @@ TEST_F(AudioDecHidlTest, DecodeTest) {
        kPortIndexOutput = kPortIndexInput + 1;
        kPortIndexOutput = kPortIndexInput + 1;
    }
    }
    char mURL[512], info[512];
    char mURL[512], info[512];
    strcpy(mURL, gEnv->getRes().c_str());
    strcpy(mURL, sResourceDir.c_str());
    strcpy(info, gEnv->getRes().c_str());
    strcpy(info, sResourceDir.c_str());
    GetURLForComponent(compName, mURL, info);
    GetURLForComponent(compName, mURL, info);


    std::ifstream eleStream, eleInfo;
    std::ifstream eleStream, eleInfo;
@@ -776,12 +775,12 @@ TEST_F(AudioDecHidlTest, DecodeTest) {
}
}


// end of sequence test
// end of sequence test
TEST_F(AudioDecHidlTest, EOSTest_M) {
TEST_P(AudioDecHidlTest, EOSTest_M) {
    description("Test end of stream monkeying");
    description("Test end of stream monkeying");
    if (disableTest) return;
    if (disableTest) return;
    android::hardware::media::omx::V1_0::Status status;
    android::hardware::media::omx::V1_0::Status status;
    uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
    uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
    status = setRole(omxNode, gEnv->getRole().c_str());
    status = setRole(omxNode, role_);
    ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
    ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
    OMX_PORT_PARAM_TYPE params;
    OMX_PORT_PARAM_TYPE params;
    status = getParam(omxNode, OMX_IndexParamAudioInit, &params);
    status = getParam(omxNode, OMX_IndexParamAudioInit, &params);
@@ -840,12 +839,12 @@ TEST_F(AudioDecHidlTest, EOSTest_M) {
}
}


// end of sequence test
// end of sequence test
TEST_F(AudioDecHidlTest, ThumbnailTest) {
TEST_P(AudioDecHidlTest, ThumbnailTest) {
    description("Test Request for thumbnail");
    description("Test Request for thumbnail");
    if (disableTest) return;
    if (disableTest) return;
    android::hardware::media::omx::V1_0::Status status;
    android::hardware::media::omx::V1_0::Status status;
    uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
    uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
    status = setRole(omxNode, gEnv->getRole().c_str());
    status = setRole(omxNode, role_);
    ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
    ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
    OMX_PORT_PARAM_TYPE params;
    OMX_PORT_PARAM_TYPE params;
    status = getParam(omxNode, OMX_IndexParamAudioInit, &params);
    status = getParam(omxNode, OMX_IndexParamAudioInit, &params);
@@ -855,8 +854,8 @@ TEST_F(AudioDecHidlTest, ThumbnailTest) {
        kPortIndexOutput = kPortIndexInput + 1;
        kPortIndexOutput = kPortIndexInput + 1;
    }
    }
    char mURL[512], info[512];
    char mURL[512], info[512];
    strcpy(mURL, gEnv->getRes().c_str());
    strcpy(mURL, sResourceDir.c_str());
    strcpy(info, gEnv->getRes().c_str());
    strcpy(info, sResourceDir.c_str());
    GetURLForComponent(compName, mURL, info);
    GetURLForComponent(compName, mURL, info);


    std::ifstream eleStream, eleInfo;
    std::ifstream eleStream, eleInfo;
@@ -954,12 +953,12 @@ TEST_F(AudioDecHidlTest, ThumbnailTest) {
}
}


// end of sequence test
// end of sequence test
TEST_F(AudioDecHidlTest, SimpleEOSTest) {
TEST_P(AudioDecHidlTest, SimpleEOSTest) {
    description("Test end of stream");
    description("Test end of stream");
    if (disableTest) return;
    if (disableTest) return;
    android::hardware::media::omx::V1_0::Status status;
    android::hardware::media::omx::V1_0::Status status;
    uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
    uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
    status = setRole(omxNode, gEnv->getRole().c_str());
    status = setRole(omxNode, role_);
    ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
    ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
    OMX_PORT_PARAM_TYPE params;
    OMX_PORT_PARAM_TYPE params;
    status = getParam(omxNode, OMX_IndexParamAudioInit, &params);
    status = getParam(omxNode, OMX_IndexParamAudioInit, &params);
@@ -969,8 +968,8 @@ TEST_F(AudioDecHidlTest, SimpleEOSTest) {
        kPortIndexOutput = kPortIndexInput + 1;
        kPortIndexOutput = kPortIndexInput + 1;
    }
    }
    char mURL[512], info[512];
    char mURL[512], info[512];
    strcpy(mURL, gEnv->getRes().c_str());
    strcpy(mURL, sResourceDir.c_str());
    strcpy(info, gEnv->getRes().c_str());
    strcpy(info, sResourceDir.c_str());
    GetURLForComponent(compName, mURL, info);
    GetURLForComponent(compName, mURL, info);


    std::ifstream eleStream, eleInfo;
    std::ifstream eleStream, eleInfo;
@@ -1046,12 +1045,12 @@ TEST_F(AudioDecHidlTest, SimpleEOSTest) {
}
}


// test input/output port flush
// test input/output port flush
TEST_F(AudioDecHidlTest, FlushTest) {
TEST_P(AudioDecHidlTest, FlushTest) {
    description("Test Flush");
    description("Test Flush");
    if (disableTest) return;
    if (disableTest) return;
    android::hardware::media::omx::V1_0::Status status;
    android::hardware::media::omx::V1_0::Status status;
    uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
    uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
    status = setRole(omxNode, gEnv->getRole().c_str());
    status = setRole(omxNode, role_);
    ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
    ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
    OMX_PORT_PARAM_TYPE params;
    OMX_PORT_PARAM_TYPE params;
    status = getParam(omxNode, OMX_IndexParamAudioInit, &params);
    status = getParam(omxNode, OMX_IndexParamAudioInit, &params);
@@ -1061,8 +1060,8 @@ TEST_F(AudioDecHidlTest, FlushTest) {
        kPortIndexOutput = kPortIndexInput + 1;
        kPortIndexOutput = kPortIndexInput + 1;
    }
    }
    char mURL[512], info[512];
    char mURL[512], info[512];
    strcpy(mURL, gEnv->getRes().c_str());
    strcpy(mURL, sResourceDir.c_str());
    strcpy(info, gEnv->getRes().c_str());
    strcpy(info, sResourceDir.c_str());
    GetURLForComponent(compName, mURL, info);
    GetURLForComponent(compName, mURL, info);


    std::ifstream eleStream, eleInfo;
    std::ifstream eleStream, eleInfo;
@@ -1153,15 +1152,21 @@ TEST_F(AudioDecHidlTest, FlushTest) {
                                                    kPortIndexOutput));
                                                    kPortIndexOutput));
}
}


INSTANTIATE_TEST_SUITE_P(PerInstance, AudioDecHidlTest, testing::ValuesIn(kTestParameters),
                         android::hardware::PrintInstanceTupleNameToString<>);

int main(int argc, char** argv) {
int main(int argc, char** argv) {
    gEnv = new ComponentTestEnvironment();
    kTestParameters = getTestParameters("audio_decoder");
    ::testing::AddGlobalTestEnvironment(gEnv);
    ::testing::InitGoogleTest(&argc, argv);
    ::testing::InitGoogleTest(&argc, argv);
    gEnv->init(&argc, argv);

    int status = gEnv->initFromOptions(argc, argv);
    // Set the resource directory based on command line args.
    if (status == 0) {
    // Test will fail to set up if the argument is not set.
        status = RUN_ALL_TESTS();
    for (int i = 1; i < argc; i++) {
        ALOGI("Test result = %d", status);
        if (strcmp(argv[i], "-P") == 0 && i < argc - 1) {
            sResourceDir = argv[i + 1];
            break;
        }
        }
    return status;
    }

    return RUN_ALL_TESTS();
}
}
 No newline at end of file
+56 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2020 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the"License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an"AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<configuration description="Runs VtsHalMediaOmxV1_0TargetAudioDecTest.">
    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />

    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
        <option name="cleanup" value="true" />
        <option name="push-file" key="vts_hal_media_omx_v1_0_audio_dec_test" value="/data/local/tmp/vts_hal_media_omx_v1_0_audio_dec_test" />

        <!-- Files used for audio testing -->
        <option name="push-file" key="bbb_aac_stereo_128kbps_48000hz.aac" value="/data/local/tmp/media/bbb_aac_stereo_128kbps_48000hz.aac" />
        <option name="push-file" key="bbb_aac_stereo_128kbps_48000hz.info" value="/data/local/tmp/media/bbb_aac_stereo_128kbps_48000hz.info" />
        <option name="push-file" key="bbb_amrwb_1ch_14kbps_16000hz.amrwb" value="/data/local/tmp/media/bbb_amrwb_1ch_14kbps_16000hz.amrwb" />
        <option name="push-file" key="bbb_amrwb_1ch_14kbps_16000hz.info" value="/data/local/tmp/media/bbb_amrwb_1ch_14kbps_16000hz.info" />
        <option name="push-file" key="bbb_flac_stereo_680kbps_48000hz.flac" value="/data/local/tmp/media/bbb_flac_stereo_680kbps_48000hz.flac" />
        <option name="push-file" key="bbb_flac_stereo_680kbps_48000hz.info" value="/data/local/tmp/media/bbb_flac_stereo_680kbps_48000hz.info" />
        <option name="push-file" key="bbb_g711alaw_1ch_8khz.info" value="/data/local/tmp/media/bbb_g711alaw_1ch_8khz.info" />
        <option name="push-file" key="bbb_g711alaw_1ch_8khz.raw" value="/data/local/tmp/media/bbb_g711alaw_1ch_8khz.raw" />
        <option name="push-file" key="bbb_g711mulaw_1ch_8khz.info" value="/data/local/tmp/media/bbb_g711mulaw_1ch_8khz.info" />
        <option name="push-file" key="bbb_g711mulaw_1ch_8khz.raw" value="/data/local/tmp/media/bbb_g711mulaw_1ch_8khz.raw" />
        <option name="push-file" key="bbb_gsm_1ch_8khz_13kbps.info" value="/data/local/tmp/media/bbb_gsm_1ch_8khz_13kbps.info" />
        <option name="push-file" key="bbb_gsm_1ch_8khz_13kbps.raw" value="/data/local/tmp/media/bbb_gsm_1ch_8khz_13kbps.raw" />
        <option name="push-file" key="bbb_mp3_stereo_192kbps_48000hz.info" value="/data/local/tmp/media/bbb_mp3_stereo_192kbps_48000hz.info" />
        <option name="push-file" key="bbb_mp3_stereo_192kbps_48000hz.mp3" value="/data/local/tmp/media/bbb_mp3_stereo_192kbps_48000hz.mp3" />
        <option name="push-file" key="bbb_opus_stereo_128kbps_48000hz.info" value="/data/local/tmp/media/bbb_opus_stereo_128kbps_48000hz.info" />
        <option name="push-file" key="bbb_opus_stereo_128kbps_48000hz.opus" value="/data/local/tmp/media/bbb_opus_stereo_128kbps_48000hz.opus" />
        <option name="push-file" key="bbb_raw_1ch_16khz_s16le.raw" value="/data/local/tmp/media/bbb_raw_1ch_16khz_s16le.raw" />
        <option name="push-file" key="bbb_raw_1ch_8khz_s16le.raw" value="/data/local/tmp/media/bbb_raw_1ch_8khz_s16le.raw" />
        <option name="push-file" key="bbb_raw_1ch_8khz_s32le.info" value="/data/local/tmp/media/bbb_raw_1ch_8khz_s32le.info" />
        <option name="push-file" key="bbb_raw_1ch_8khz_s32le.raw" value="/data/local/tmp/media/bbb_raw_1ch_8khz_s32le.raw" />
        <option name="push-file" key="bbb_raw_2ch_48khz_s16le.raw" value="/data/local/tmp/media/bbb_raw_2ch_48khz_s16le.raw" />
        <option name="push-file" key="bbb_vorbis_stereo_128kbps_48000hz.info" value="/data/local/tmp/media/bbb_vorbis_stereo_128kbps_48000hz.info" />
        <option name="push-file" key="bbb_vorbis_stereo_128kbps_48000hz.vorbis" value="/data/local/tmp/media/bbb_vorbis_stereo_128kbps_48000hz.vorbis" />
        <option name="push-file" key="sine_amrnb_1ch_12kbps_8000hz.amrnb" value="/data/local/tmp/media/sine_amrnb_1ch_12kbps_8000hz.amrnb" />
        <option name="push-file" key="sine_amrnb_1ch_12kbps_8000hz.info" value="/data/local/tmp/media/sine_amrnb_1ch_12kbps_8000hz.info" />
    </target_preparer>

    <test class="com.android.tradefed.testtype.GTest" >
        <option name="native-test-device-path" value="/data/local/tmp" />
        <option name="module-name" value="vts_hal_media_omx_v1_0_audio_dec_test" />
        <option name="native-test-flag" value="-P /data/local/tmp/media/" />
    </test>
</configuration>
 No newline at end of file
Loading