Loading audio/common/all-versions/test/utility/include/utility/ValidateXml.h +24 −16 Original line number Diff line number Diff line Loading @@ -45,29 +45,37 @@ namespace utility { xmlFilePath, xsdFilePath) /** Validate an XML according to an xsd. * The XML file must be in at least one of the provided locations. * If multiple are found, all are validated. * All file named xmlFileName in each xmlFileLocations folder must be valid if present. * @tparam atLeastOneRequired If true, at least one file has to be found. * If false, no found file is a success. */ template <bool atLeastOneRequired = true> ::testing::AssertionResult validateXmlMultipleLocations( const char* xmlFileNameExpr, const char* xmlFileLocationsExpr, const char* xsdFilePathExpr, const char* xmlFileName, std::vector<const char*> xmlFileLocations, const char* xsdFilePath); /** ASSERT that an XML is valid according to an xsd. * The XML file must be in at least one of the provided locations. * If multiple are found, all are validated. */ /** ASSERT that all found XML are valid according to an xsd. */ #define ASSERT_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \ ASSERT_PRED_FORMAT3( \ ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<false>, \ xmlFileName, xmlFileLocations, xsdFilePath) /** EXPECT that all found XML are valid according to an xsd. */ #define EXPECT_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \ EXPECT_PRED_FORMAT3( \ ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<false>, \ xmlFileName, xmlFileLocations, xsdFilePath) /** ASSERT that all found XML are valid according to an xsd. At least one must be found. */ #define ASSERT_ONE_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \ ASSERT_PRED_FORMAT3( \ ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations, \ ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<true>, \ xmlFileName, xmlFileLocations, xsdFilePath) /** EXPECT an XML to be valid according to an xsd. * The XML file must be in at least one of the provided locations. * If multiple are found, all are validated. */ /** EXPECT that all found XML are valid according to an xsd. At least one must be found. */ #define EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \ EXPECT_PRED_FORMAT3( \ ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations, \ ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<true>, \ xmlFileName, xmlFileLocations, xsdFilePath) } // namespace utility Loading audio/common/all-versions/test/utility/src/ValidateXml.cpp +14 −2 Original line number Diff line number Diff line Loading @@ -129,6 +129,7 @@ struct Libxml2Global { return ::testing::AssertionSuccess(); } template <bool atLeastOneRequired> ::testing::AssertionResult validateXmlMultipleLocations( const char* xmlFileNameExpr, const char* xmlFileLocationsExpr, const char* xsdFilePathExpr, const char* xmlFileName, std::vector<const char*> xmlFileLocations, const char* xsdFilePath) { Loading @@ -150,7 +151,7 @@ struct Libxml2Global { } } if (foundFiles.empty()) { if (atLeastOneRequired && foundFiles.empty()) { errors.push_back("No xml file found in provided locations.\n"); } Loading @@ -160,8 +161,19 @@ struct Libxml2Global { << " While validating all: " << xmlFileNameExpr << "\n Which is: " << xmlFileName << "\n In the following folders: " << xmlFileLocationsExpr << "\n Which is: " << ::testing::PrintToString(xmlFileLocations); } << "\n Which is: " << ::testing::PrintToString(xmlFileLocations) << (atLeastOneRequired ? "Where at least one file must be found." : "Where no file might exist."); } template ::testing::AssertionResult validateXmlMultipleLocations<true>(const char*, const char*, const char*, const char*, std::vector<const char*>, const char*); template ::testing::AssertionResult validateXmlMultipleLocations<false>(const char*, const char*, const char*, const char*, std::vector<const char*>, const char*); } // namespace utility } // namespace test Loading audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,6 @@ TEST(CheckConfig, audioEffectsConfigurationValidation) { using namespace android::effectsConfig; std::vector<const char*> locations(std::begin(DEFAULT_LOCATIONS), std::end(DEFAULT_LOCATIONS)); EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(DEFAULT_NAME, locations, EXPECT_VALID_XML_MULTIPLE_LOCATIONS(DEFAULT_NAME, locations, "/data/local/tmp/audio_effects_conf_V2_0.xsd"); } Loading
audio/common/all-versions/test/utility/include/utility/ValidateXml.h +24 −16 Original line number Diff line number Diff line Loading @@ -45,29 +45,37 @@ namespace utility { xmlFilePath, xsdFilePath) /** Validate an XML according to an xsd. * The XML file must be in at least one of the provided locations. * If multiple are found, all are validated. * All file named xmlFileName in each xmlFileLocations folder must be valid if present. * @tparam atLeastOneRequired If true, at least one file has to be found. * If false, no found file is a success. */ template <bool atLeastOneRequired = true> ::testing::AssertionResult validateXmlMultipleLocations( const char* xmlFileNameExpr, const char* xmlFileLocationsExpr, const char* xsdFilePathExpr, const char* xmlFileName, std::vector<const char*> xmlFileLocations, const char* xsdFilePath); /** ASSERT that an XML is valid according to an xsd. * The XML file must be in at least one of the provided locations. * If multiple are found, all are validated. */ /** ASSERT that all found XML are valid according to an xsd. */ #define ASSERT_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \ ASSERT_PRED_FORMAT3( \ ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<false>, \ xmlFileName, xmlFileLocations, xsdFilePath) /** EXPECT that all found XML are valid according to an xsd. */ #define EXPECT_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \ EXPECT_PRED_FORMAT3( \ ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<false>, \ xmlFileName, xmlFileLocations, xsdFilePath) /** ASSERT that all found XML are valid according to an xsd. At least one must be found. */ #define ASSERT_ONE_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \ ASSERT_PRED_FORMAT3( \ ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations, \ ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<true>, \ xmlFileName, xmlFileLocations, xsdFilePath) /** EXPECT an XML to be valid according to an xsd. * The XML file must be in at least one of the provided locations. * If multiple are found, all are validated. */ /** EXPECT that all found XML are valid according to an xsd. At least one must be found. */ #define EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \ EXPECT_PRED_FORMAT3( \ ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations, \ ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<true>, \ xmlFileName, xmlFileLocations, xsdFilePath) } // namespace utility Loading
audio/common/all-versions/test/utility/src/ValidateXml.cpp +14 −2 Original line number Diff line number Diff line Loading @@ -129,6 +129,7 @@ struct Libxml2Global { return ::testing::AssertionSuccess(); } template <bool atLeastOneRequired> ::testing::AssertionResult validateXmlMultipleLocations( const char* xmlFileNameExpr, const char* xmlFileLocationsExpr, const char* xsdFilePathExpr, const char* xmlFileName, std::vector<const char*> xmlFileLocations, const char* xsdFilePath) { Loading @@ -150,7 +151,7 @@ struct Libxml2Global { } } if (foundFiles.empty()) { if (atLeastOneRequired && foundFiles.empty()) { errors.push_back("No xml file found in provided locations.\n"); } Loading @@ -160,8 +161,19 @@ struct Libxml2Global { << " While validating all: " << xmlFileNameExpr << "\n Which is: " << xmlFileName << "\n In the following folders: " << xmlFileLocationsExpr << "\n Which is: " << ::testing::PrintToString(xmlFileLocations); } << "\n Which is: " << ::testing::PrintToString(xmlFileLocations) << (atLeastOneRequired ? "Where at least one file must be found." : "Where no file might exist."); } template ::testing::AssertionResult validateXmlMultipleLocations<true>(const char*, const char*, const char*, const char*, std::vector<const char*>, const char*); template ::testing::AssertionResult validateXmlMultipleLocations<false>(const char*, const char*, const char*, const char*, std::vector<const char*>, const char*); } // namespace utility } // namespace test Loading
audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,6 @@ TEST(CheckConfig, audioEffectsConfigurationValidation) { using namespace android::effectsConfig; std::vector<const char*> locations(std::begin(DEFAULT_LOCATIONS), std::end(DEFAULT_LOCATIONS)); EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(DEFAULT_NAME, locations, EXPECT_VALID_XML_MULTIPLE_LOCATIONS(DEFAULT_NAME, locations, "/data/local/tmp/audio_effects_conf_V2_0.xsd"); }