summaryrefslogtreecommitdiff
path: root/tests/gensquashfs/fstree_fuzz.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-11-22 14:45:32 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-11-22 14:45:32 +0100
commit168ef9be32ad754d7bcb38ed70787237fc12630d (patch)
tree39d567fa667b2f170783329a07481769dd538d43 /tests/gensquashfs/fstree_fuzz.c
parent61a0dd71c4b69c21ee4aacdc0459dba58504a24a (diff)
Move gensquashfs specific code from libfstree to gensquashfs
The "from dir" and from "from file" code, as well as the "sort file" code is specific to gensquashfs, so move them there and the test cases as well. The medium term idea is to reduce libfstree to a stub, merge it into the generic writer and ultimately hoist that into libsquashfs. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/gensquashfs/fstree_fuzz.c')
-rw-r--r--tests/gensquashfs/fstree_fuzz.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/gensquashfs/fstree_fuzz.c b/tests/gensquashfs/fstree_fuzz.c
new file mode 100644
index 0000000..4fbb72b
--- /dev/null
+++ b/tests/gensquashfs/fstree_fuzz.c
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-3.0-or-later */
+/*
+ * fstree_fuzz.c
+ *
+ * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
+ */
+#include "config.h"
+
+#include "mkfs.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+ int ret = EXIT_FAILURE;
+ fstree_t fs;
+
+ if (argc != 2) {
+ fputs("Usage: fstree_fuzz <input_file>\n", stderr);
+ return EXIT_FAILURE;
+ }
+
+ if (fstree_init(&fs, NULL))
+ return EXIT_FAILURE;
+
+ if (fstree_from_file(&fs, argv[1], NULL))
+ goto out_fs;
+
+ ret = EXIT_SUCCESS;
+out_fs:
+ fstree_cleanup(&fs);
+ return ret;
+}