commit 669548208ba99fecb51a4620e79b6a67525ffeee
parent f6af3c1ee6f72640479778d7c864e436b8015188
Author: Dimitris Papastamos <dimitris.papastamos@arm.com>
Date: Wed, 17 Oct 2018 15:47:45 +0100
[test] Add unit test for RMU_System_InterfaceVersion()
Change-Id: I869a934013467e1cfa6a5f8eaf497e817345b9b9
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
Diffstat:
2 files changed, 36 insertions(+), 21 deletions(-)
diff --git a/test/test3/Makefile b/test/test3/Makefile
@@ -1,9 +1,9 @@
PROJECTDIR = ../..
include $(PROJECTDIR)/scripts/rules.mk
-OBJS = $(ARCHDIR)/crt-$(SYS).o test.o
-LIBS = -ltypes -lc
-LIBDEP = $(LIBDIR)/libtypes.a $(LIBDIR)/libc.a
+OBJS = $(ARCHDIR)/crt-$(SYS).o $(SRCDIR)/romfw/builtin.o test.o
+LIBS = -lhdl -lrmu -lc
+LIBDEP = $(LIBDIR)/libhdl.a $(LIBDIR)/librmu.a $(LIBDIR)/libc.a
TARGET = run
diff --git a/test/test3/test.c b/test/test3/test.c
@@ -1,27 +1,42 @@
#include <assert.h>
-#include <stdint.h>
-#include <string.h>
-#include <types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <rcode.h>
int
main(void)
{
- struct rscb_ctrl a = { 0 }, b = { 0 };
- uint64_t buf[128];
+ Rmucmd cmd;
+ struct trapframe frame;
- a.en = 0;
- a.preg_lock = 1;
- a.dbg = 1;
- a.res0_0 = 0;
- a.rmu_wlock = 1;
- a.rot_wlock = 1;
- a.rscb_lock = 0;
- a.alive = 1;
- a.res0_1 = 0;
-
- assert(pack_rscb_ctrl(buf, &a) != -1);
- assert(unpack_rscb_ctrl(buf, &b) != -1);
- assert(memcmp(&a, &b, sizeof(struct rscb_ctrl)) == 0);
+ cmd.imm1 = 0;
+ cmd.imm2 = 0;
+ cmd.fp = &frame;
+ bss->cmd = &cmd;
+ if (!setjmp(cmd.recover))
+ rmc(&cmd);
+ assert(cmd.fp->x0 == 0);
+ assert(cmd.fp->x1 == 0);
+ assert(cmd.fp->x2 == 1);
return 0;
}
+
+void
+halt(void)
+{
+ abort();
+}
+
+void
+dopanic(void)
+{
+ printf("%s\n", bss->errstr);
+ halt();
+}
+
+void
+swtch(struct trapframe *fp)
+{
+ panic("swtch() not implemented");
+}