Loading media/codec2/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioDecTest.cpp +1 −12 Original line number Diff line number Diff line Loading @@ -39,9 +39,6 @@ static std::vector<std::tuple<std::string, std::string, std::string, std::string static std::vector<std::tuple<std::string, std::string, std::string>> kCsdFlushTestParameters; // Resource directory static std::string sResourceDir = ""; struct CompToURL { std::string mime; std::string mURL; Loading Loading @@ -892,6 +889,7 @@ INSTANTIATE_TEST_SUITE_P(CsdInputs, Codec2AudioDecCsdInputTests, } // anonymous namespace int main(int argc, char** argv) { parseArgs(argc, argv); kTestParameters = getTestParameters(C2Component::DOMAIN_AUDIO, C2Component::KIND_DECODER); for (auto params : kTestParameters) { kDecodeTestParameters.push_back( Loading @@ -909,15 +907,6 @@ int main(int argc, char** argv) { std::make_tuple(std::get<0>(params), std::get<1>(params), "false")); } // Set the resource directory based on command line args. // Test will fail to set up if the argument is not set. for (int i = 1; i < argc; i++) { if (strcmp(argv[i], "-P") == 0 && i < argc - 1) { sResourceDir = argv[i + 1]; break; } } ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } media/codec2/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioEncTest.cpp +1 −12 Original line number Diff line number Diff line Loading @@ -38,9 +38,6 @@ using android::C2AllocatorIon; static std::vector<std::tuple<std::string, std::string, std::string, std::string>> kEncodeTestParameters; // Resource directory static std::string sResourceDir = ""; class LinearBuffer : public C2Buffer { public: explicit LinearBuffer(const std::shared_ptr<C2LinearBlock>& block) Loading Loading @@ -797,6 +794,7 @@ INSTANTIATE_TEST_SUITE_P(EncodeTest, Codec2AudioEncEncodeTest, } // anonymous namespace int main(int argc, char** argv) { parseArgs(argc, argv); kTestParameters = getTestParameters(C2Component::DOMAIN_AUDIO, C2Component::KIND_ENCODER); for (auto params : kTestParameters) { kEncodeTestParameters.push_back( Loading @@ -809,15 +807,6 @@ int main(int argc, char** argv) { std::make_tuple(std::get<0>(params), std::get<1>(params), "true", "2")); } // Set the resource directory based on command line args. // Test will fail to set up if the argument is not set. for (int i = 1; i < argc; i++) { if (strcmp(argv[i], "-P") == 0 && i < argc - 1) { sResourceDir = argv[i + 1]; break; } } ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } media/codec2/hidl/1.0/vts/functional/common/media_c2_hidl_test_common.cpp +50 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,48 @@ #include <android/hardware/media/c2/1.0/IComponentStore.h> std::string sResourceDir = ""; std::string sComponentNamePrefix = ""; static constexpr struct option kArgOptions[] = { {"res", required_argument, 0, 'P'}, {"prefix", required_argument, 0, 'p'}, {"help", required_argument, 0, 'h'}, {nullptr, 0, nullptr, 0}, }; void printUsage(char *me) { std::cerr << "VTS tests to test codec2 components \n"; std::cerr << "Usage: " << me << " [options] \n"; std::cerr << "\t -P, --res: Mandatory path to a folder that contains test resources \n"; std::cerr << "\t -p, --prefix: Optional prefix to select component/s to be tested \n"; std::cerr << "\t All codecs are tested by default \n"; std::cerr << "\t Eg: c2.android - test codecs starting with c2.android \n"; std::cerr << "\t Eg: c2.android.aac.decoder - test a specific codec \n"; std::cerr << "\t -h, --help: Print usage \n"; } void parseArgs(int argc, char** argv) { int arg; int option_index; while ((arg = getopt_long(argc, argv, ":P:p:h", kArgOptions, &option_index)) != -1) { switch (arg) { case 'P': sResourceDir = optarg; break; case 'p': sComponentNamePrefix = optarg; break; case 'h': printUsage(argv[0]); break; default: break; } } } // Test the codecs for NullBuffer, Empty Input Buffer with(out) flags set void testInputBuffer(const std::shared_ptr<android::Codec2Client::Component>& component, std::mutex& queueLock, std::list<std::unique_ptr<C2Work>>& workQueue, Loading Loading @@ -157,11 +199,18 @@ const std::vector<std::tuple<std::string, std::string>>& getTestParameters( (traits.domain != domain || traits.kind != kind)) { continue; } if (traits.name.rfind(sComponentNamePrefix, 0) != 0) { ALOGD("Skipping tests for %s. Prefix specified is %s", traits.name.c_str(), sComponentNamePrefix.c_str()); continue; } parameters.push_back(std::make_tuple(instance, traits.name)); } } if (parameters.empty()) { ALOGE("No test parameters added. Verify component prefix passed to the test"); } return parameters; } Loading media/codec2/hidl/1.0/vts/functional/common/media_c2_hidl_test_common.h +8 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,12 @@ using namespace ::std::chrono; static std::vector<std::tuple<std::string, std::string>> kTestParameters; // Resource directory extern std::string sResourceDir; // Component name prefix extern std::string sComponentNamePrefix; struct FrameInfo { int bytesCount; uint32_t flags; Loading Loading @@ -105,6 +111,8 @@ struct CodecListener : public android::Codec2Client::Listener { std::function<void(std::list<std::unique_ptr<C2Work>>& workItems)> callBack; }; void parseArgs(int argc, char** argv); // Return all test parameters, a list of tuple of <instance, component>. const std::vector<std::tuple<std::string, std::string>>& getTestParameters(); Loading media/codec2/hidl/1.0/vts/functional/component/VtsHalMediaC2V1_0TargetComponentTest.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -360,6 +360,7 @@ INSTANTIATE_TEST_CASE_P(NonStdInputs, Codec2ComponentInputTests, // TODO: Add test for Invalid work, // TODO: Add test for Invalid states int main(int argc, char** argv) { parseArgs(argc, argv); kTestParameters = getTestParameters(); for (auto params : kTestParameters) { kInputTestParameters.push_back( Loading Loading
media/codec2/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioDecTest.cpp +1 −12 Original line number Diff line number Diff line Loading @@ -39,9 +39,6 @@ static std::vector<std::tuple<std::string, std::string, std::string, std::string static std::vector<std::tuple<std::string, std::string, std::string>> kCsdFlushTestParameters; // Resource directory static std::string sResourceDir = ""; struct CompToURL { std::string mime; std::string mURL; Loading Loading @@ -892,6 +889,7 @@ INSTANTIATE_TEST_SUITE_P(CsdInputs, Codec2AudioDecCsdInputTests, } // anonymous namespace int main(int argc, char** argv) { parseArgs(argc, argv); kTestParameters = getTestParameters(C2Component::DOMAIN_AUDIO, C2Component::KIND_DECODER); for (auto params : kTestParameters) { kDecodeTestParameters.push_back( Loading @@ -909,15 +907,6 @@ int main(int argc, char** argv) { std::make_tuple(std::get<0>(params), std::get<1>(params), "false")); } // Set the resource directory based on command line args. // Test will fail to set up if the argument is not set. for (int i = 1; i < argc; i++) { if (strcmp(argv[i], "-P") == 0 && i < argc - 1) { sResourceDir = argv[i + 1]; break; } } ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
media/codec2/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioEncTest.cpp +1 −12 Original line number Diff line number Diff line Loading @@ -38,9 +38,6 @@ using android::C2AllocatorIon; static std::vector<std::tuple<std::string, std::string, std::string, std::string>> kEncodeTestParameters; // Resource directory static std::string sResourceDir = ""; class LinearBuffer : public C2Buffer { public: explicit LinearBuffer(const std::shared_ptr<C2LinearBlock>& block) Loading Loading @@ -797,6 +794,7 @@ INSTANTIATE_TEST_SUITE_P(EncodeTest, Codec2AudioEncEncodeTest, } // anonymous namespace int main(int argc, char** argv) { parseArgs(argc, argv); kTestParameters = getTestParameters(C2Component::DOMAIN_AUDIO, C2Component::KIND_ENCODER); for (auto params : kTestParameters) { kEncodeTestParameters.push_back( Loading @@ -809,15 +807,6 @@ int main(int argc, char** argv) { std::make_tuple(std::get<0>(params), std::get<1>(params), "true", "2")); } // Set the resource directory based on command line args. // Test will fail to set up if the argument is not set. for (int i = 1; i < argc; i++) { if (strcmp(argv[i], "-P") == 0 && i < argc - 1) { sResourceDir = argv[i + 1]; break; } } ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
media/codec2/hidl/1.0/vts/functional/common/media_c2_hidl_test_common.cpp +50 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,48 @@ #include <android/hardware/media/c2/1.0/IComponentStore.h> std::string sResourceDir = ""; std::string sComponentNamePrefix = ""; static constexpr struct option kArgOptions[] = { {"res", required_argument, 0, 'P'}, {"prefix", required_argument, 0, 'p'}, {"help", required_argument, 0, 'h'}, {nullptr, 0, nullptr, 0}, }; void printUsage(char *me) { std::cerr << "VTS tests to test codec2 components \n"; std::cerr << "Usage: " << me << " [options] \n"; std::cerr << "\t -P, --res: Mandatory path to a folder that contains test resources \n"; std::cerr << "\t -p, --prefix: Optional prefix to select component/s to be tested \n"; std::cerr << "\t All codecs are tested by default \n"; std::cerr << "\t Eg: c2.android - test codecs starting with c2.android \n"; std::cerr << "\t Eg: c2.android.aac.decoder - test a specific codec \n"; std::cerr << "\t -h, --help: Print usage \n"; } void parseArgs(int argc, char** argv) { int arg; int option_index; while ((arg = getopt_long(argc, argv, ":P:p:h", kArgOptions, &option_index)) != -1) { switch (arg) { case 'P': sResourceDir = optarg; break; case 'p': sComponentNamePrefix = optarg; break; case 'h': printUsage(argv[0]); break; default: break; } } } // Test the codecs for NullBuffer, Empty Input Buffer with(out) flags set void testInputBuffer(const std::shared_ptr<android::Codec2Client::Component>& component, std::mutex& queueLock, std::list<std::unique_ptr<C2Work>>& workQueue, Loading Loading @@ -157,11 +199,18 @@ const std::vector<std::tuple<std::string, std::string>>& getTestParameters( (traits.domain != domain || traits.kind != kind)) { continue; } if (traits.name.rfind(sComponentNamePrefix, 0) != 0) { ALOGD("Skipping tests for %s. Prefix specified is %s", traits.name.c_str(), sComponentNamePrefix.c_str()); continue; } parameters.push_back(std::make_tuple(instance, traits.name)); } } if (parameters.empty()) { ALOGE("No test parameters added. Verify component prefix passed to the test"); } return parameters; } Loading
media/codec2/hidl/1.0/vts/functional/common/media_c2_hidl_test_common.h +8 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,12 @@ using namespace ::std::chrono; static std::vector<std::tuple<std::string, std::string>> kTestParameters; // Resource directory extern std::string sResourceDir; // Component name prefix extern std::string sComponentNamePrefix; struct FrameInfo { int bytesCount; uint32_t flags; Loading Loading @@ -105,6 +111,8 @@ struct CodecListener : public android::Codec2Client::Listener { std::function<void(std::list<std::unique_ptr<C2Work>>& workItems)> callBack; }; void parseArgs(int argc, char** argv); // Return all test parameters, a list of tuple of <instance, component>. const std::vector<std::tuple<std::string, std::string>>& getTestParameters(); Loading
media/codec2/hidl/1.0/vts/functional/component/VtsHalMediaC2V1_0TargetComponentTest.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -360,6 +360,7 @@ INSTANTIATE_TEST_CASE_P(NonStdInputs, Codec2ComponentInputTests, // TODO: Add test for Invalid work, // TODO: Add test for Invalid states int main(int argc, char** argv) { parseArgs(argc, argv); kTestParameters = getTestParameters(); for (auto params : kTestParameters) { kInputTestParameters.push_back( Loading