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/include/test_harness.h b/plat/host/host_test/include/test_harness.h
new file mode 100644
index 0000000..db4f045
--- /dev/null
+++ b/plat/host/host_test/include/test_harness.h
@@ -0,0 +1,34 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * SPDX-FileCopyrightText: Copyright TF-RMM Contributors.
+ */
+
+#ifndef TEST_HARNESS_H
+#define TEST_HARNESS_H
+
+#include <buffer.h>
+
+/*
+ * Below functions are to be defined by the tests and allow them to implement
+ * specific host harness APIs as defined in host_harness.h
+ */
+
+/*
+ * Map a given granule address to a specific slot buffer
+ * Args
+ * slot - Slot buffer type where to map to
+ * addr - Granule address to map
+ * ns - Flag to indicate if the granule is a non-secure one
+ * Return
+ * The VA (or platform equivalent) where the granule was mapped to
+ */
+void *test_buffer_map(enum buffer_slot slot,
+ unsigned long addr, bool ns);
+
+/*
+ * Unmap a given granule from its corresponding slot buffer given the
+ * mapped granule address.
+ */
+void test_buffer_unmap(void *buf);
+
+#endif /* TEST_HARNESS */