summaryrefslogtreecommitdiffstats
path: root/audio/common/all-versions/test/utility
diff options
context:
space:
mode:
authorKevin Rocard <krocard@google.com>2018-07-19 13:31:47 -0700
committerKeun Soo Yim <yim@google.com>2018-08-28 18:18:21 +0000
commit8ca56c3dee0eb2e74a670d93d9bd0175eb1ebc9c (patch)
tree6d5cf47903a63d930ea5fab8f635f9f773ea7fbd /audio/common/all-versions/test/utility
parentdd06d73cabd7ca0df542e7384978c4c6b5087632 (diff)
downloadandroid_hardware_interfaces-8ca56c3dee0eb2e74a670d93d9bd0175eb1ebc9c.tar.gz
android_hardware_interfaces-8ca56c3dee0eb2e74a670d93d9bd0175eb1ebc9c.tar.bz2
android_hardware_interfaces-8ca56c3dee0eb2e74a670d93d9bd0175eb1ebc9c.zip
VTS: Do not require XML for Audio effect V2
In O, the Audio effect V2 HAL allows not to have an audio effect XML configuration but to use a .conf format. In P, before this patch, the Audio effect V2 HAL _requires_ to have an audio effect XML configuration and forbids the use of a .conf format. This is discouraged by Treble as it means that an unchanged HAL V2 implementation that was compatible with O VTS will not be with P VTS. As a result, revert to the Oreo behavior for Audio Effect V2 VTS. Note that the audio effect V4 VTS is not changed by this patch and still requires an audio effect XML configuration. Aka device _updating_ to P will not have to upgrade to XML but new devices lunching on P are still required to have an audio effect XML configuration. This commit only changes VTS code. Test: cd hardware/interfaces/audio/effect/ mmm 2.0/vts/functional 4.0/vts/functional && adb sync data adb push *.0/xml/audio_effects_conf_V*.xsd /data/local/tmp/ adb shell cd /data/nativetest64 OPS=--gtest_filter=CheckConfig.audioEffectsConfigurationValidation VtsHalAudioEffectV2_0TargetTest/VtsHalAudioEffectV2_0TargetTest $OPS VtsHalAudioEffectV4_0TargetTest/VtsHalAudioEffectV4_0TargetTest $OPS rm /{odm,vendor,system}/etc/audio_effects.xml || true VtsHalAudioEffectV2_0TargetTest/VtsHalAudioEffectV2_0TargetTest $OPS ! VtsHalAudioEffectV4_0TargetTest/VtsHalAudioEffectV4_0TargetTest $OPS Bug: 111421676 Change-Id: Ifb15d65ae4aa65759c8ebaa91cbc8c02234030dc Merged-In: Ifb15d65ae4aa65759c8ebaa91cbc8c02234030dc Signed-off-by: Kevin Rocard <krocard@google.com> (cherry picked from commit b41b575475f3c93fe30216b9cdb2db441b92854b)
Diffstat (limited to 'audio/common/all-versions/test/utility')
-rw-r--r--audio/common/all-versions/test/utility/include/utility/ValidateXml.h40
-rw-r--r--audio/common/all-versions/test/utility/src/ValidateXml.cpp16
2 files changed, 38 insertions, 18 deletions
diff --git a/audio/common/all-versions/test/utility/include/utility/ValidateXml.h b/audio/common/all-versions/test/utility/include/utility/ValidateXml.h
index 95080d1c4..91adfc12c 100644
--- a/audio/common/all-versions/test/utility/include/utility/ValidateXml.h
+++ b/audio/common/all-versions/test/utility/include/utility/ValidateXml.h
@@ -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.
- */
-#define ASSERT_ONE_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \
- ASSERT_PRED_FORMAT3( \
- ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations, \
+/** 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 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.
- */
-#define EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \
- EXPECT_PRED_FORMAT3( \
- ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations, \
+/** 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<true>, \
+ xmlFileName, xmlFileLocations, xsdFilePath)
+
+/** 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<true>, \
xmlFileName, xmlFileLocations, xsdFilePath)
} // namespace utility
diff --git a/audio/common/all-versions/test/utility/src/ValidateXml.cpp b/audio/common/all-versions/test/utility/src/ValidateXml.cpp
index 5030af506..1a906d668 100644
--- a/audio/common/all-versions/test/utility/src/ValidateXml.cpp
+++ b/audio/common/all-versions/test/utility/src/ValidateXml.cpp
@@ -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) {
@@ -150,7 +151,7 @@ struct Libxml2Global {
}
}
- if (foundFiles.empty()) {
+ if (atLeastOneRequired && foundFiles.empty()) {
errors.push_back("No xml file found in provided locations.\n");
}
@@ -160,9 +161,20 @@ 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
} // namespace common