diff options
Diffstat (limited to 'tests/fdt/init.c')
| -rw-r--r-- | tests/fdt/init.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/fdt/init.c b/tests/fdt/init.c new file mode 100644 index 0000000..c6c35dd --- /dev/null +++ b/tests/fdt/init.c @@ -0,0 +1,29 @@ +#include <common/test.h> +#include <libfdt.h> + +START(pid, tid, d0, d1, d2, d3) +{ + UNUSED(d2); + UNUSED(d3); + + check(pid == 0, "wrong src process ID"); + check(tid == 1, "wrong root thread ID"); + check(d0 == SYS_USER_SPAWNED, "wrong op"); + printf("fdt at %lx\n", d1); + + void *fdt = (void *)d1; + + int chosen_offset = fdt_path_offset(fdt, "/chosen"); + check(chosen_offset > 0, "couldn't find /chosen"); + + const char *stdout = + fdt_getprop(fdt, chosen_offset, "stdout-path", NULL); + + check(stdout != NULL, "couldn't find stdout-path"); + + /* ideally we would also parse the stdout node and check that it is some + * reasonable value, but I'm not sure if we can trust the Qemu fdt to be + * stable. The above is suspicious enough I suppose */ + printf("found stdout at: %s\n", stdout); + ok(); +} |
