aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2024-11-25 07:35:35 +0100
committerMiquel Sabaté Solà <mikisabate@gmail.com>2024-11-25 07:45:26 +0100
commitea542e18e7bc7e9d401aefd044bf0317676867ca (patch)
treeed8fda560fb8c4d04a9e4633d17c35c384ca8fd9
parent51ec9306dce1684e35ebdcbf2f091359971fcc57 (diff)
downloadfbos-ea542e18e7bc7e9d401aefd044bf0317676867ca.tar.gz
fbos-ea542e18e7bc7e9d401aefd044bf0317676867ca.zip
tests: Only test initrd addresses on debug
In initrd tests, and in general, we only need to check that the function did something. As in, that it set the entry addresses somewhere and did not leave them NULL. This is going to be performed from now on on CI and regular tests. And, just if you want to go the extra mile, we will run specific tests that check on memory addresses but that are not guaranteed to work. This is to be replaced in the future by having some proper debugging output. As in, having a message at kernel boot time specifying the addresses being used among other info. This needs a more complex printk utility, of course. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
-rw-r--r--.github/workflows/ci.yml2
-rw-r--r--Makefile2
-rw-r--r--test/test_initrd.c15
3 files changed, 13 insertions, 6 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e278d5f..64d403e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -25,5 +25,5 @@ jobs:
- name: Lint
run: make lint V=1
- - name: Check that it builds
+ - name: Build and run unit tests
run: make V=1
diff --git a/Makefile b/Makefile
index b3642f0..03febb5 100644
--- a/Makefile
+++ b/Makefile
@@ -49,7 +49,7 @@ ifeq ($(strip $(DEBUG)),)
QEMU_FLAGS += -nographic
else
ASFLAGS += -g
- CCFLAGS += -g
+ CCFLAGS += -g -D__DEBUG__
QEMU_FLAGS += -s -S
endif
diff --git a/test/test_initrd.c b/test/test_initrd.c
index 7c23acc..314bd25 100644
--- a/test/test_initrd.c
+++ b/test/test_initrd.c
@@ -33,10 +33,17 @@ int main(void)
extract_initrd(contents, (uint64_t)fsize, tasks);
free(contents);
- assert(((uintptr_t)tasks[0].entry_addr & 0xff) == 0xe8);
- assert(((uintptr_t)tasks[1].entry_addr & 0xff) == 0xbc);
- assert(((uintptr_t)tasks[2].entry_addr & 0xff) == 0xb4);
- assert(((uintptr_t)tasks[3].entry_addr & 0xff) == 0x80);
+#ifdef __DEBUG__
+ assert(((uintptr_t)tasks[0].entry_addr & 0xfff) == 0xbe8);
+ assert(((uintptr_t)tasks[1].entry_addr & 0xfff) == 0x5bc);
+ assert(((uintptr_t)tasks[2].entry_addr & 0xfff) == 0x7b4);
+ assert(((uintptr_t)tasks[3].entry_addr & 0xfff) == 0x180);
+#else
+ assert(tasks[0].entry_addr);
+ assert(tasks[1].entry_addr);
+ assert(tasks[2].entry_addr);
+ assert(tasks[3].entry_addr);
+#endif
exit(0);
}