From 51ec9306dce1684e35ebdcbf2f091359971fcc57 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Sun, 24 Nov 2024 23:48:59 +0100 Subject: test: Fix test on initrd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was broken since I first introduced the test on initrd on 40ffc517e20c ("Initial parsing of the provided initrd file") but it always was as a work in progress test. Now that the initrd parsing has separation of concerns with the global 'tasks' variable since f4986dab75fa ("Accept tasks as a parameter on initrd extraction"), we can have a proper test written for this. Signed-off-by: Miquel Sabaté Solà --- test/test_initrd.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'test/test_initrd.c') diff --git a/test/test_initrd.c b/test/test_initrd.c index 2d0d045..7c23acc 100644 --- a/test/test_initrd.c +++ b/test/test_initrd.c @@ -6,13 +6,13 @@ #include #include -unsigned long init_stack[4][THREAD_SIZE / sizeof(unsigned long)]; +unsigned long stack[4][THREAD_SIZE / sizeof(unsigned long)]; struct task_struct tasks[4] = { - [0] = { .stack = init_stack[0] }, - [1] = { .stack = init_stack[1] }, - [2] = { .stack = init_stack[2] }, - [3] = { .stack = init_stack[3] }, + [TASK_INIT] = { .stack = stack[0], .entry_addr = NULL, }, + [TASK_FIZZ] = { .stack = stack[1], .entry_addr = NULL, }, + [TASK_BUZZ] = { .stack = stack[2], .entry_addr = NULL, }, + [TASK_FIZZBUZZ] = { .stack = stack[3], .entry_addr = NULL, }, }; int main(void) @@ -33,7 +33,10 @@ int main(void) extract_initrd(contents, (uint64_t)fsize, tasks); free(contents); - // TODO + 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); exit(0); } -- cgit v1.2.3