Skip to content

Commit b39e7cb

Browse files
feat(recipe): Add the patch required to add tests to the baremetal
The patch is currently use to add the framework entry point to run all tests in the main of the baremetal application. Signed-off-by: Miguel Silva <[email protected]>
1 parent 8879997 commit b39e7cb

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
diff --git a/setup.mk b/setup.mk
2+
index 3a230aa..2edf9ee 100644
3+
--- a/setup.mk
4+
+++ b/setup.mk
5+
@@ -29,6 +29,14 @@ src_dirs+=$(src_dir) $(core_dir) $(platform_dir)
6+
SRC_DIRS+=$(src_dirs)
7+
INC_DIRS+=$(addsuffix /inc, $(src_dirs))
8+
9+
+# Test framework setup
10+
+include $(TESTF_REPO_DIR)/src/bao-test.mk
11+
+SRC_DIRS+=$(TESTF_SRC_DIR) $(TESTF_TESTS_DIR)
12+
+C_SRC+=$(TESTF_SRCS)
13+
+INC_DIRS+=$(TESTF_INC_DIR)
14+
+CFLAGS+=$(TESTF_FLAGS)
15+
+# End of test framework setup
16+
+
17+
ifeq ($(wildcard $(platform_dir)),)
18+
$(error unsupported platform $(PLATFORM))
19+
endif
20+
diff --git a/src/main.c b/src/main.c
21+
index 9a9e972..69cfa6f 100644
22+
--- a/src/main.c
23+
+++ b/src/main.c
24+
@@ -54,6 +54,8 @@ void main(void){
25+
printf("Bao bare-metal test guest\n");
26+
spin_unlock(&print_lock);
27+
28+
+ testf_entry();
29+
+
30+
irq_set_handler(UART_IRQ_ID, uart_rx_handler);
31+
irq_set_handler(TIMER_IRQ_ID, timer_handler);
32+
irq_set_handler(IPI_IRQ_ID, ipi_handler);

0 commit comments

Comments
 (0)