diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-11-24 23:48:59 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-11-24 23:55:25 +0100 |
| commit | 51ec9306dce1684e35ebdcbf2f091359971fcc57 (patch) | |
| tree | 148b0c80b0159ca48767dd5d5ca23c8f93aa28d9 | |
| parent | f4986dab75fa612f4f3d525187cd04c029d9bc6b (diff) | |
| download | fbos-51ec9306dce1684e35ebdcbf2f091359971fcc57.tar.gz fbos-51ec9306dce1684e35ebdcbf2f091359971fcc57.zip | |
test: Fix test on initrd
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à <mikisabate@gmail.com>
| -rw-r--r-- | test/test_initrd.c | 15 |
1 files changed, 9 insertions, 6 deletions
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 <fbos/sched.h> #include <fbos/mm.h> -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); } |
