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

Commit 3fab64b2 authored by Manisha Jajoo's avatar Manisha Jajoo Committed by Pawin Vongmasa
Browse files

VTS: add validation for work result

Test: atest VtsHalMediaC2V1_0TargetAudioDecTest
Test: atest VtsHalMediaC2V1_0TargetAudioEncTest
Test: atest VtsHalMediaC2V1_0TargetVideoDecTest
Test: atest VtsHalMediaC2V1_0TargetVideoEncTest

Bug: 153660755

Change-Id: Ie3759e6cd185b4e07b82e957e5b5b96cb70d7f01
parent 278615a2
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ class Codec2AudioDecHidlTestBase : public ::testing::Test {
        mEos = false;
        mFramesReceived = 0;
        mTimestampUs = 0u;
        mWorkResult = C2_OK;
        mTimestampDevTest = false;
        if (mCompName == unknown_comp) mDisableTest = true;
        if (mDisableTest) std::cout << "[   WARN   ] Test Disabled \n";
@@ -131,6 +132,7 @@ class Codec2AudioDecHidlTestBase : public ::testing::Test {
            if (!work->worklets.empty()) {
                // For decoder components current timestamp always exceeds
                // previous timestamp
                mWorkResult |= work->result;
                bool codecConfig = ((work->worklets.front()->output.flags &
                                     C2FrameData::FLAG_CODEC_CONFIG) != 0);
                if (!codecConfig && !work->worklets.front()->output.buffers.empty()) {
@@ -182,6 +184,8 @@ class Codec2AudioDecHidlTestBase : public ::testing::Test {
    bool mDisableTest;
    bool mTimestampDevTest;
    standardComp mCompName;

    int32_t mWorkResult;
    uint64_t mTimestampUs;
    uint32_t mFramesReceived;
    std::list<uint64_t> mFlushedIndices;
@@ -584,6 +588,7 @@ TEST_P(Codec2AudioDecDecodeTest, DecodeTest) {
        mTimestampUslist.clear();
    }
    ASSERT_EQ(mComponent->stop(), C2_OK);
    ASSERT_EQ(mWorkResult, C2_OK);
}

// thumbnail test
@@ -644,6 +649,7 @@ TEST_P(Codec2AudioDecHidlTest, ThumbnailTest) {
    EXPECT_GE(mFramesReceived, 1U);
    ASSERT_EQ(mEos, true);
    ASSERT_EQ(mComponent->stop(), C2_OK);
    ASSERT_EQ(mWorkResult, C2_OK);
}

TEST_P(Codec2AudioDecHidlTest, EOSTest) {
@@ -684,6 +690,7 @@ TEST_P(Codec2AudioDecHidlTest, EOSTest) {
    ASSERT_EQ(mEos, true);
    ASSERT_EQ(mWorkQueue.size(), (size_t)MAX_INPUT_BUFFERS);
    ASSERT_EQ(mComponent->stop(), C2_OK);
    ASSERT_EQ(mWorkResult, C2_OK);
}

TEST_P(Codec2AudioDecHidlTest, FlushTest) {
@@ -797,6 +804,8 @@ TEST_P(Codec2AudioDecHidlTest, FlushTest) {
            }
        }
    }
    // TODO: (b/154671521)
    // Add assert for mWorkResult
    ASSERT_EQ(mFlushedIndices.empty(), true);
    ASSERT_EQ(mComponent->stop(), C2_OK);
}
+8 −0
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ class Codec2AudioEncHidlTestBase : public ::testing::Test {
        mEos = false;
        mCsd = false;
        mFramesReceived = 0;
        mWorkResult = C2_OK;
        if (mCompName == unknown_comp) mDisableTest = true;
        if (mDisableTest) std::cout << "[   WARN   ] Test Disabled \n";
        getInputMaxBufSize();
@@ -115,6 +116,7 @@ class Codec2AudioEncHidlTestBase : public ::testing::Test {
    void handleWorkDone(std::list<std::unique_ptr<C2Work>>& workItems) {
        for (std::unique_ptr<C2Work>& work : workItems) {
            if (!work->worklets.empty()) {
                mWorkResult |= work->result;
                workDone(mComponent, work, mFlushedIndices, mQueueLock, mQueueCondition, mWorkQueue,
                         mEos, mCsd, mFramesReceived);
            }
@@ -135,6 +137,8 @@ class Codec2AudioEncHidlTestBase : public ::testing::Test {
    bool mCsd;
    bool mDisableTest;
    standardComp mCompName;

    int32_t mWorkResult;
    uint32_t mFramesReceived;
    int32_t mInputMaxBufSize;
    std::list<uint64_t> mFlushedIndices;
@@ -439,6 +443,7 @@ TEST_P(Codec2AudioEncEncodeTest, EncodeTest) {
    }
    ASSERT_EQ(mEos, true);
    ASSERT_EQ(mComponent->stop(), C2_OK);
    ASSERT_EQ(mWorkResult, C2_OK);
}

TEST_P(Codec2AudioEncHidlTest, EOSTest) {
@@ -479,6 +484,7 @@ TEST_P(Codec2AudioEncHidlTest, EOSTest) {
    }
    ASSERT_EQ(mEos, true);
    ASSERT_EQ(mComponent->stop(), C2_OK);
    ASSERT_EQ(mWorkResult, C2_OK);
}

TEST_P(Codec2AudioEncHidlTest, FlushTest) {
@@ -588,6 +594,8 @@ TEST_P(Codec2AudioEncHidlTest, FlushTest) {
            }
        }
    }
    // TODO: (b/154671521)
    // Add assert for mWorkResult
    ASSERT_EQ(mFlushedIndices.empty(), true);
    ASSERT_EQ(mComponent->stop(), C2_OK);
}
+10 −0
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ class Codec2VideoDecHidlTestBase : public ::testing::Test {
        mEos = false;
        mFramesReceived = 0;
        mTimestampUs = 0u;
        mWorkResult = C2_OK;
        mTimestampDevTest = false;
        if (mCompName == unknown_comp) mDisableTest = true;

@@ -141,6 +142,7 @@ class Codec2VideoDecHidlTestBase : public ::testing::Test {
                // For decoder components current timestamp always exceeds
                // previous timestamp
                typedef std::unique_lock<std::mutex> ULock;
                mWorkResult |= work->result;
                bool codecConfig = ((work->worklets.front()->output.flags &
                                     C2FrameData::FLAG_CODEC_CONFIG) != 0);
                if (!codecConfig && !work->worklets.front()->output.buffers.empty()) {
@@ -200,6 +202,8 @@ class Codec2VideoDecHidlTestBase : public ::testing::Test {
    std::list<uint64_t> mTimestampUslist;
    std::list<uint64_t> mFlushedIndices;
    standardComp mCompName;

    int32_t mWorkResult;
    uint32_t mFramesReceived;
    C2BlockPool::local_id_t mBlockPoolId;
    std::shared_ptr<C2BlockPool> mLinearPool;
@@ -525,6 +529,7 @@ TEST_P(Codec2VideoDecDecodeTest, DecodeTest) {

    if (mTimestampDevTest) EXPECT_EQ(mTimestampUslist.empty(), true);
    ASSERT_EQ(mComponent->stop(), C2_OK);
    ASSERT_EQ(mWorkResult, C2_OK);
}

// Adaptive Test
@@ -631,6 +636,7 @@ TEST_P(Codec2VideoDecHidlTest, AdaptiveDecodeTest) {
    }

    if (mTimestampDevTest) EXPECT_EQ(mTimestampUslist.empty(), true);
    ASSERT_EQ(mWorkResult, C2_OK);
}

// thumbnail test
@@ -683,6 +689,7 @@ TEST_P(Codec2VideoDecHidlTest, ThumbnailTest) {
        ASSERT_EQ(mComponent->stop(), C2_OK);
    }
    ASSERT_EQ(mComponent->release(), C2_OK);
    ASSERT_EQ(mWorkResult, C2_OK);
}

TEST_P(Codec2VideoDecHidlTest, EOSTest) {
@@ -723,6 +730,7 @@ TEST_P(Codec2VideoDecHidlTest, EOSTest) {
    ASSERT_EQ(mEos, true);
    ASSERT_EQ(mWorkQueue.size(), (size_t)MAX_INPUT_BUFFERS);
    ASSERT_EQ(mComponent->stop(), C2_OK);
    ASSERT_EQ(mWorkResult, C2_OK);
}

TEST_P(Codec2VideoDecHidlTest, FlushTest) {
@@ -825,6 +833,8 @@ TEST_P(Codec2VideoDecHidlTest, FlushTest) {
            }
        }
    }
    // TODO: (b/154671521)
    // Add assert for mWorkResult
    ASSERT_EQ(mFlushedIndices.empty(), true);
    ASSERT_EQ(mComponent->stop(), C2_OK);
}
+6 −0
Original line number Diff line number Diff line
@@ -520,6 +520,9 @@ TEST_P(Codec2VideoEncEncodeTest, EncodeTest) {

    if (mTimestampDevTest) EXPECT_EQ(mTimestampUslist.empty(), true);
    ASSERT_EQ(mComponent->stop(), C2_OK);

    // TODO: (b/155534991)
    // Add assert for mFailedWorkReceived
}

TEST_P(Codec2VideoEncHidlTest, EOSTest) {
@@ -560,6 +563,7 @@ TEST_P(Codec2VideoEncHidlTest, EOSTest) {
    }
    ASSERT_EQ(mEos, true);
    ASSERT_EQ(mComponent->stop(), C2_OK);
    ASSERT_EQ(mFailedWorkReceived, 0);
}

TEST_P(Codec2VideoEncHidlTest, FlushTest) {
@@ -656,6 +660,8 @@ TEST_P(Codec2VideoEncHidlTest, FlushTest) {
            }
        }
    }
    // TODO: (b/154671521)
    // Add assert for mFailedWorkReceived
    ASSERT_EQ(mFlushedIndices.empty(), true);
    ASSERT_EQ(mComponent->stop(), C2_OK);
}