aboutsummaryrefslogtreecommitdiff
path: root/test/test_initrd.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_initrd.c')
-rw-r--r--test/test_initrd.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/test_initrd.c b/test/test_initrd.c
new file mode 100644
index 0000000..3662eaa
--- /dev/null
+++ b/test/test_initrd.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include <fbos/init.h>
+
+int main(void)
+{
+ FILE *fh = fopen("./usr/initramfs.cpio", "rb");
+ assert(fh);
+
+ fseek(fh, 0, SEEK_END);
+ long fsize = ftell(fh);
+ rewind(fh);
+
+ char *contents = malloc((unsigned long)fsize + 1);
+ fread(contents, (unsigned long)fsize, 1, fh);
+ fclose(fh);
+
+ contents[fsize] = 0;
+
+ extract_initrd(contents, (uint64_t)fsize);
+ free(contents);
+
+ // TODO
+
+ exit(0);
+}