Add support for Inventory.Decorator.Compatible
This adds support for the compatibility strings interface described in
https://github.com/openbmc/phosphor-dbus-interfaces/tree/master/yaml/xyz/openbmc_project/Software#compatibility.
The Version objects will now be created with the Inventory.Decorator.Compatible
interface with the compatibility names coming from the MANIFEST file.
e.g.
version=1.2.3
MachineName=foo
purpose=Other
ExtendedVersion=a.b.c
CompatibleName=foo.bar
CompatibleName=baz.bim
Tested:
$ busctl get-property xyz.openbmc_project.Software.Version \
/xyz/openbmc_project/software/517751da \
xyz.openbmc_project.Inventory.Decorator.Compatible Names
as 2 "foo.bar" "baz.bim"
Signed-off-by: Justin Ledford <justinledford@google.com>
Change-Id: I9ee36af2d3d1494d533a3b09c466a250c4fe786b
diff --git a/test/utest.cpp b/test/utest.cpp
index 1c32b1a..03dbe26 100644
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -58,6 +58,25 @@
EXPECT_EQ(Version::getValue(manifestFilePath, "purpose"), purpose);
}
+TEST_F(VersionTest, TestGetRepeatedValue)
+{
+ auto manifestFilePath = _directory + "/" + "MANIFEST";
+ const std::vector<std::string> names = {"foo.bar", "baz.bim"};
+
+ std::ofstream file;
+ file.open(manifestFilePath, std::ofstream::out);
+ ASSERT_TRUE(file.is_open());
+
+ for (const auto& name : names)
+ {
+ file << "CompatibleName=" << name << "\n";
+ }
+ file.close();
+
+ EXPECT_EQ(Version::getRepeatedValues(manifestFilePath, "CompatibleName"),
+ names);
+}
+
TEST_F(VersionTest, TestGetValueWithCRLF)
{
auto manifestFilePath = _directory + "/" + "MANIFEST";