test(manifest): relative address unit tests
* Check that parsing a manifest with `relative-address` is successful
* Check that parsing a manifest with both `base-address` and
`relative-address` produces an error
* Check that parsing a manifest where `load-address` +
`relative-address` overflows produces an error
Change-Id: Ie32252b8c52ef85bedb18508a8f7d1da6a96b991
diff --git a/src/manifest_test.cc b/src/manifest_test.cc
index c81ae74..9587459 100644
--- a/src/manifest_test.cc
+++ b/src/manifest_test.cc
@@ -1199,6 +1199,47 @@
MANIFEST_ERROR_MEM_REGION_EMPTY);
manifest_dealloc();
+ /* Mutually exclusive base-address and relative-address properties */
+ /* clang-format off */
+ dtb = ManifestDtBuilder()
+ .FfaValidManifest()
+ .StartChild("memory-regions")
+ .Compatible({ "arm,ffa-manifest-memory-regions" })
+ .Label("rx")
+ .StartChild("rx")
+ .Description("rx-buffer")
+ .Property("base-address", "<0x7300000>")
+ .Property("relative-address", "<0x7300000>")
+ .Property("pages-count", "<1>")
+ .Property("attributes", "<1>")
+ .EndChild()
+ .EndChild()
+ .Build();
+ /* clang-format on */
+ ASSERT_EQ(ffa_manifest_from_vec(&m, dtb),
+ MANIFEST_ERROR_BASE_ADDRESS_AND_RELATIVE_ADDRESS);
+ manifest_dealloc();
+ /* Relative-address overflow*/
+ /* clang-format off */
+ dtb = ManifestDtBuilder()
+ .FfaValidManifest()
+ .Property("load-address", "<0xffffff00 0xffffff00>")
+ .StartChild("memory-regions")
+ .Compatible({ "arm,ffa-manifest-memory-regions" })
+ .Label("rx")
+ .StartChild("rx")
+ .Description("rx-buffer")
+ .Property("relative-address", "<0xffffff00 0xffffff00>")
+ .Property("pages-count", "<1>")
+ .Property("attributes", "<1>")
+ .EndChild()
+ .EndChild()
+ .Build();
+ /* clang-format on */
+ ASSERT_EQ(ffa_manifest_from_vec(&m, dtb),
+ MANIFEST_ERROR_INTEGER_OVERFLOW);
+ manifest_dealloc();
+
/* Overlapping memory regions */
/* clang-format off */
dtb = ManifestDtBuilder()
@@ -1552,7 +1593,7 @@
.Compatible({ "arm,ffa-manifest-memory-regions" })
.StartChild("test-memory")
.Description("test-memory")
- .Property("base-address", "<0x7100000>")
+ .Property("relative-address", "<0x7100000>")
.Property("pages-count", "<4>")
.Property("attributes", "<3>")
.EndChild()
@@ -1597,7 +1638,6 @@
.EndChild()
.Build();
/* clang-format on */
-
ASSERT_EQ(ffa_manifest_from_vec(&m, dtb), MANIFEST_SUCCESS);
vm = &m->vm[0];