From ea542e18e7bc7e9d401aefd044bf0317676867ca Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Mon, 25 Nov 2024 07:35:35 +0100 Subject: tests: Only test initrd addresses on debug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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à --- test/test_initrd.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'test') 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); } -- cgit v1.2.3