Do not allow duplicated major version across <hal> in manifests
<hal> entries has to be grouped by versions. Otherwise, if
<transport> is different in two <hal> entries with the same
<name> and <version>, getTransport always return the first match.
As a side effect, fixes an incorrect behavior in
HalManifest::isCompatible that test for <instance> tags across two
<hal>'s with the same name and version (because it shouldn't occur
at all). This incorrect behavior is hidden under an
EXPECT_FALSE in libvintf_test. Now that this is never allowed,
the test is changed to EXPECT_TRUE.
Test: libvintf_test
Change-Id: I10d4619f3828bf695485938c315c73a924ba6340
Merged-In: I10d4619f3828bf695485938c315c73a924ba6340
Fixes: 38502835
diff --git a/parse_xml.cpp b/parse_xml.cpp
index f2f3096..0ac87cb 100644
--- a/parse_xml.cpp
+++ b/parse_xml.cpp
@@ -651,8 +651,9 @@
}
}
for (auto &&hal : hals) {
+ std::string description{hal.name};
if (!object->add(std::move(hal))) {
- this->mLastError = "Duplicated manifest.hal entry";
+ this->mLastError = "Duplicated manifest.hal entry " + description;
return false;
}
}