feat(unittests): add a unit test framework.
This patch adds all the infrastructure needed to run unit tests for
RMM, including a new variant for platform host, called `host_test`.
To build and run the tests:
cmake -DRMM_CONFIG=host_defcfg -DHOST_VARIANT=host_test \
-DCMAKE_BUILD_TYPE=Debug -S ${RMM_SOURCE_DIR} -B ${RMM_BUILD_DIR}
cmake --build ${RMM_BUILD_DIR} -- run-unittests
Signed-off-by: Javier Almansa Sobrino <javier.almansasobrino@arm.com>
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
Change-Id: If16686e111d91c563f8e7281d4ee7ca2864125ae
diff --git a/plat/host/host_test/src/host_harness.c b/plat/host/host_test/src/host_harness.c
new file mode 100644
index 0000000..4357c29
--- /dev/null
+++ b/plat/host/host_test/src/host_harness.c
@@ -0,0 +1,23 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * SPDX-FileCopyrightText: Copyright TF-RMM Contributors.
+ */
+
+#include <host_harness.h>
+#include <test_harness.h>
+
+/*
+ * Maps addr to the requested slot buffer and returns a pointer to the
+ * fake VA for the slot (the current addr), so the host can perform R/W
+ * operations on the mapped granule.
+ */
+void *host_buffer_arch_map(enum buffer_slot slot,
+ unsigned long addr, bool ns)
+{
+ return test_buffer_map(slot, addr, ns);
+}
+
+void host_buffer_arch_unmap(void *buf)
+{
+ test_buffer_unmap(buf);
+}