mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 05:49:27 +00:00
VtsHalMediaOmx: avoid std::set and std::vector of const T
These containers use std::allocator<const T>, which is an undocumented libc++ extension to the C++ standard library. The extension was removed in llvm.org/PR96319. Use an ordinary non-const T instead. Bug: http://b/349681543 Test: m VtsHalMediaOmxV1_0TargetStoreTest Flag: EXEMPT, refactor to fix build failure Change-Id: I5b5ceed1d2618b7ce1f979242f33f6bc92df0545
This commit is contained in:
@@ -93,9 +93,9 @@ void displayComponentInfo(hidl_vec<IOmx::ComponentInfo>& nodeList) {
|
|||||||
|
|
||||||
void validateAttributes(
|
void validateAttributes(
|
||||||
const std::map<const std::string, const testing::internal::RE>& knownPatterns,
|
const std::map<const std::string, const testing::internal::RE>& knownPatterns,
|
||||||
const std::vector<const struct AttributePattern>& unknownPatterns,
|
const std::vector<struct AttributePattern>& unknownPatterns,
|
||||||
hidl_vec<IOmxStore::Attribute> attributes) {
|
hidl_vec<IOmxStore::Attribute> attributes) {
|
||||||
std::set<const std::string> attributeKeys;
|
std::set<std::string> attributeKeys;
|
||||||
for (const auto& attr : attributes) {
|
for (const auto& attr : attributes) {
|
||||||
// Make sure there are no duplicates
|
// Make sure there are no duplicates
|
||||||
const auto [nodeIter, inserted] = attributeKeys.insert(attr.key);
|
const auto [nodeIter, inserted] = attributeKeys.insert(attr.key);
|
||||||
@@ -179,7 +179,7 @@ TEST_P(StoreHidlTest, ListServiceAttr) {
|
|||||||
* tried for a match with the second element of the pair. If this second
|
* tried for a match with the second element of the pair. If this second
|
||||||
* match fails, the test will fail.
|
* match fails, the test will fail.
|
||||||
*/
|
*/
|
||||||
const std::vector<const struct AttributePattern> unknownPatterns = {
|
const std::vector<struct AttributePattern> unknownPatterns = {
|
||||||
{"supports-[a-z0-9-]*", "0|1"}};
|
{"supports-[a-z0-9-]*", "0|1"}};
|
||||||
|
|
||||||
validateAttributes(knownPatterns, unknownPatterns, attributes);
|
validateAttributes(knownPatterns, unknownPatterns, attributes);
|
||||||
@@ -248,7 +248,7 @@ TEST_P(StoreHidlTest, ListRoles) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Strings for matching rules for node attributes with key patterns
|
// Strings for matching rules for node attributes with key patterns
|
||||||
const std::vector<const struct AttributePattern> unknownPatterns = {
|
const std::vector<struct AttributePattern> unknownPatterns = {
|
||||||
{"measured-frame-rate-" + size + "-range", range_num},
|
{"measured-frame-rate-" + size + "-range", range_num},
|
||||||
{"feature-[a-zA-Z0-9_-]+", string},
|
{"feature-[a-zA-Z0-9_-]+", string},
|
||||||
};
|
};
|
||||||
@@ -257,9 +257,9 @@ TEST_P(StoreHidlTest, ListRoles) {
|
|||||||
const testing::internal::RE nodeNamePattern = "[a-zA-Z0-9._-]+";
|
const testing::internal::RE nodeNamePattern = "[a-zA-Z0-9._-]+";
|
||||||
const testing::internal::RE nodeOwnerPattern = "[a-zA-Z0-9._-]+";
|
const testing::internal::RE nodeOwnerPattern = "[a-zA-Z0-9._-]+";
|
||||||
|
|
||||||
std::set<const std::string> roleKeys;
|
std::set<std::string> roleKeys;
|
||||||
std::map<const std::string, std::set<const std::string>> nodeToRoles;
|
std::map<const std::string, std::set<std::string>> nodeToRoles;
|
||||||
std::map<const std::string, std::set<const std::string>> ownerToNodes;
|
std::map<const std::string, std::set<std::string>> ownerToNodes;
|
||||||
for (const IOmxStore::RoleInfo& role : roleList) {
|
for (const IOmxStore::RoleInfo& role : roleList) {
|
||||||
// Make sure there are no duplicates
|
// Make sure there are no duplicates
|
||||||
const auto [roleIter, inserted] = roleKeys.insert(role.role);
|
const auto [roleIter, inserted] = roleKeys.insert(role.role);
|
||||||
@@ -276,7 +276,7 @@ TEST_P(StoreHidlTest, ListRoles) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check the nodes for this role
|
// Check the nodes for this role
|
||||||
std::set<const std::string> nodeKeys;
|
std::set<std::string> nodeKeys;
|
||||||
for (const IOmxStore::NodeInfo& node : role.nodes) {
|
for (const IOmxStore::NodeInfo& node : role.nodes) {
|
||||||
// Make sure there are no duplicates
|
// Make sure there are no duplicates
|
||||||
const auto [nodeIter, inserted] = nodeKeys.insert(node.name);
|
const auto [nodeIter, inserted] = nodeKeys.insert(node.name);
|
||||||
@@ -317,7 +317,7 @@ TEST_P(StoreHidlTest, ListRoles) {
|
|||||||
|
|
||||||
// Verify that roles for each node match with the information from
|
// Verify that roles for each node match with the information from
|
||||||
// IOmxStore::listRoles().
|
// IOmxStore::listRoles().
|
||||||
std::set<const std::string> nodeKeys;
|
std::set<std::string> nodeKeys;
|
||||||
for (IOmx::ComponentInfo node : nodeList) {
|
for (IOmx::ComponentInfo node : nodeList) {
|
||||||
// Make sure there are no duplicates
|
// Make sure there are no duplicates
|
||||||
const auto [nodeIter, inserted] = nodeKeys.insert(node.mName);
|
const auto [nodeIter, inserted] = nodeKeys.insert(node.mName);
|
||||||
@@ -334,7 +334,7 @@ TEST_P(StoreHidlTest, ListRoles) {
|
|||||||
|
|
||||||
// All the roles advertised by IOmxStore::listRoles() for this
|
// All the roles advertised by IOmxStore::listRoles() for this
|
||||||
// node must be included in roleKeys.
|
// node must be included in roleKeys.
|
||||||
std::set<const std::string> difference;
|
std::set<std::string> difference;
|
||||||
std::set_difference(nodeToRoles[node.mName].begin(), nodeToRoles[node.mName].end(),
|
std::set_difference(nodeToRoles[node.mName].begin(), nodeToRoles[node.mName].end(),
|
||||||
roleKeys.begin(), roleKeys.end(),
|
roleKeys.begin(), roleKeys.end(),
|
||||||
std::inserter(difference, difference.begin()));
|
std::inserter(difference, difference.begin()));
|
||||||
@@ -347,7 +347,7 @@ TEST_P(StoreHidlTest, ListRoles) {
|
|||||||
}
|
}
|
||||||
// Check that all nodes obtained from IOmxStore::listRoles() are
|
// Check that all nodes obtained from IOmxStore::listRoles() are
|
||||||
// supported by the their corresponding IOmx instances.
|
// supported by the their corresponding IOmx instances.
|
||||||
std::set<const std::string> difference;
|
std::set<std::string> difference;
|
||||||
std::set_difference(nodes.begin(), nodes.end(), nodeKeys.begin(), nodeKeys.end(),
|
std::set_difference(nodes.begin(), nodes.end(), nodeKeys.begin(), nodeKeys.end(),
|
||||||
std::inserter(difference, difference.begin()));
|
std::inserter(difference, difference.begin()));
|
||||||
EXPECT_EQ(difference.empty(), true) << "IOmx::listNodes() for IOmx "
|
EXPECT_EQ(difference.empty(), true) << "IOmx::listNodes() for IOmx "
|
||||||
|
|||||||
Reference in New Issue
Block a user