aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBastian Koppelmann <kbastian@mail.uni-paderborn.de>2023-05-26 08:19:46 +0200
committerBastian Koppelmann <kbastian@mail.uni-paderborn.de>2023-06-07 18:20:51 +0200
commite926c94171ae37397c8c4b54cef60e5c7ebbf243 (patch)
tree3f3357fb2b033fc4306fcc4d71ad0798de6789df /tests
parent12b95dc432eb9a50569258ffa094a029f3cc13dc (diff)
tests/tcg/tricore: Add recursion test for CSAs
Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Message-Id: <20230526061946.54514-7-kbastian@mail.uni-paderborn.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/tcg/tricore/Makefile.softmmu-target3
-rw-r--r--tests/tcg/tricore/c/test_context_save_areas.c15
2 files changed, 17 insertions, 1 deletions
diff --git a/tests/tcg/tricore/Makefile.softmmu-target b/tests/tcg/tricore/Makefile.softmmu-target
index f051444991..aff7c1b580 100644
--- a/tests/tcg/tricore/Makefile.softmmu-target
+++ b/tests/tcg/tricore/Makefile.softmmu-target
@@ -4,7 +4,7 @@ C_TESTS_PATH = $(TESTS_PATH)/c
LDFLAGS = -T$(TESTS_PATH)/link.ld --mcpu=tc162
ASFLAGS = -mtc162
-CFLAGS = -mtc162 -c
+CFLAGS = -mtc162 -c -I$(TESTS_PATH)
TESTS += test_abs.asm.tst
TESTS += test_bmerge.asm.tst
@@ -23,6 +23,7 @@ TESTS += test_msub.asm.tst
TESTS += test_muls.asm.tst
TESTS += test_boot_to_main.c.tst
+TESTS += test_context_save_areas.c.tst
QEMU_OPTS += -M tricore_testboard -cpu tc27x -nographic -kernel
diff --git a/tests/tcg/tricore/c/test_context_save_areas.c b/tests/tcg/tricore/c/test_context_save_areas.c
new file mode 100644
index 0000000000..a300ee2f9c
--- /dev/null
+++ b/tests/tcg/tricore/c/test_context_save_areas.c
@@ -0,0 +1,15 @@
+#include "testdev_assert.h"
+
+static int fib(int n)
+{
+ if (n == 1 || n == 2) {
+ return 1;
+ }
+ return fib(n - 2) + fib(n - 1);
+}
+
+int main(int argc, char **argv)
+{
+ testdev_assert(fib(10) == 55);
+ return 0;
+}