summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYifan Hong2018-02-02 20:34:36 -0600
committerandroid-build-merger2018-02-02 20:34:36 -0600
commit8dc9be49a0b77b3c164c47eb6c8d88c57b65deed (patch)
treef1828e361c11ed4cac84ef68280eeb542bb4d2e2
parent804b0ca59bf4ea3ca56f063ec67c88243c64f03e (diff)
parent26e2ce7ea56c6a9c6a51604033a31b2df8ccf894 (diff)
downloadplatform-system-libvintf-8dc9be49a0b77b3c164c47eb6c8d88c57b65deed.tar.gz
platform-system-libvintf-8dc9be49a0b77b3c164c47eb6c8d88c57b65deed.tar.xz
platform-system-libvintf-8dc9be49a0b77b3c164c47eb6c8d88c57b65deed.zip
Do not allow duplicated manifest.vendor-ndk.version. am: 0bfbc1259b am: 6bbda6356e
am: 26e2ce7ea5 Change-Id: Ic3ba9c489aed1b2c8fe1a03f0fbfd2b4bab40720
-rw-r--r--parse_xml.cpp10
-rw-r--r--test/LibVintfTest.cpp17
2 files changed, 27 insertions, 0 deletions
diff --git a/parse_xml.cpp b/parse_xml.cpp
index 9f53d72..7abbc55 100644
--- a/parse_xml.cpp
+++ b/parse_xml.cpp
@@ -866,6 +866,16 @@ struct HalManifestConverter : public XmlNodeConverter<HalManifest> {
866 return false; 866 return false;
867 } 867 }
868 868
869 std::set<std::string> vendorNdkVersions;
870 for (const auto& vendorNdk : object->framework.mVendorNdks) {
871 if (vendorNdkVersions.find(vendorNdk.version()) != vendorNdkVersions.end()) {
872 this->mLastError =
873 "Duplicated manifest.vendor-ndk.version " + vendorNdk.version();
874 return false;
875 }
876 vendorNdkVersions.insert(vendorNdk.version());
877 }
878
869 if (!parseOptionalChild(root, systemSdkConverter, {}, &object->framework.mSystemSdk)) { 879 if (!parseOptionalChild(root, systemSdkConverter, {}, &object->framework.mSystemSdk)) {
870 return false; 880 return false;
871 } 881 }
diff --git a/test/LibVintfTest.cpp b/test/LibVintfTest.cpp
index 149afc5..ef19a4c 100644
--- a/test/LibVintfTest.cpp
+++ b/test/LibVintfTest.cpp
@@ -2410,6 +2410,23 @@ TEST_F(LibVintfTest, MissingVendorNdkInMatrix) {
2410 } 2410 }
2411} 2411}
2412 2412
2413TEST_F(LibVintfTest, DuplicatedVendorNdkVersion) {
2414 std::string error;
2415 HalManifest manifest;
2416 std::string xml =
2417 "<manifest version=\"1.0\" type=\"framework\">\n"
2418 " <vendor-ndk>\n"
2419 " <version>27</version>\n"
2420 " </vendor-ndk>\n"
2421 " <vendor-ndk>\n"
2422 " <version>27</version>\n"
2423 " </vendor-ndk>\n"
2424 "</manifest>\n";
2425
2426 EXPECT_FALSE(gHalManifestConverter(&manifest, xml));
2427 EXPECT_EQ("Duplicated manifest.vendor-ndk.version 27", gHalManifestConverter.lastError());
2428}
2429
2413TEST_F(LibVintfTest, ManifestHalOverride) { 2430TEST_F(LibVintfTest, ManifestHalOverride) {
2414 HalManifest manifest; 2431 HalManifest manifest;
2415 std::string xml = 2432 std::string xml =