diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2022-11-29 13:55:27 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2022-11-29 13:55:27 +0100 |
commit | e14d43e58f26960c90bd4a644f103a26186f7b04 (patch) | |
tree | c8eb7bfc848f05adc0f9fbfdb69de61ddbfd6199 /tests/gensquashfs | |
parent | a487eec3e3e7c1c5552d17acd0db8cd5dcc59fc7 (diff) |
Add dummy hierarchy for fstree_from_dir test
Instead of abusing the directory tree of another test case, add a
proper dummy hierarchy. This also fixes issues with parallel tests,
where another test generates squashfs images in the target path.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/gensquashfs')
-rw-r--r-- | tests/gensquashfs/Makemodule.am | 3 | ||||
-rw-r--r-- | tests/gensquashfs/fstree_from_dir.c | 221 | ||||
-rw-r--r-- | tests/gensquashfs/testdir/dira/file_a0 | 0 | ||||
-rw-r--r-- | tests/gensquashfs/testdir/dira/file_a1 | 0 | ||||
-rw-r--r-- | tests/gensquashfs/testdir/dira/file_a2 | 0 | ||||
-rw-r--r-- | tests/gensquashfs/testdir/dirb/file_b0 | 0 | ||||
-rw-r--r-- | tests/gensquashfs/testdir/dirb/file_b1 | 0 | ||||
-rw-r--r-- | tests/gensquashfs/testdir/dirb/file_b2 | 0 | ||||
-rw-r--r-- | tests/gensquashfs/testdir/dirc/file_c0 | 0 | ||||
-rw-r--r-- | tests/gensquashfs/testdir/dirc/file_c1 | 0 | ||||
-rw-r--r-- | tests/gensquashfs/testdir/dirc/file_c2 | 0 |
11 files changed, 14 insertions, 210 deletions
diff --git a/tests/gensquashfs/Makemodule.am b/tests/gensquashfs/Makemodule.am index c1ab164..70dc375 100644 --- a/tests/gensquashfs/Makemodule.am +++ b/tests/gensquashfs/Makemodule.am @@ -28,7 +28,7 @@ test_fstree_from_dir_SOURCES = tests/gensquashfs/fstree_from_dir.c \ bin/gensquashfs/fstree_from_dir.c \ bin/gensquashfs/mkfs.h test_fstree_from_dir_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/bin/gensquashfs -test_fstree_from_dir_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/libtar/data +test_fstree_from_dir_CPPFLAGS += -DTESTPATH=$(GENDATADIR)/testdir test_fstree_from_dir_LDADD = libfstree.a libutil.a libcompat.a test_sort_file_SOURCES = tests/gensquashfs/sort_file.c \ @@ -60,3 +60,4 @@ endif EXTRA_DIST += $(GENDATADIR)/xattr1.txt $(GENDATADIR)/fstree1.txt EXTRA_DIST += $(GENDATADIR)/fstree_glob1.txt $(GENDATADIR)/fstree_glob2.txt EXTRA_DIST += $(GENDATADIR)/fstree_glob3.txt +EXTRA_DIST += $(GENDATADIR)/testdir diff --git a/tests/gensquashfs/fstree_from_dir.c b/tests/gensquashfs/fstree_from_dir.c index 3aad1c6..5e73fa4 100644 --- a/tests/gensquashfs/fstree_from_dir.c +++ b/tests/gensquashfs/fstree_from_dir.c @@ -15,32 +15,26 @@ static void check_hierarchy(tree_node_t *root, bool recursive) n = root->data.dir.children; TEST_NOT_NULL(n); - TEST_STR_EQUAL(n->name, "CREDITS"); - TEST_ASSERT(S_ISREG(n->mode)); - TEST_ASSERT(n->parent == root); - - n = n->next; - TEST_NOT_NULL(n); - TEST_STR_EQUAL(n->name, "file-size"); + TEST_STR_EQUAL(n->name, "dira"); TEST_ASSERT(S_ISDIR(n->mode)); TEST_ASSERT(n->parent == root); if (recursive) { m = n->data.dir.children; TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "12-digit.tar"); + TEST_STR_EQUAL(m->name, "file_a0"); TEST_ASSERT(S_ISREG(m->mode)); TEST_ASSERT(m->parent == n); m = m->next; TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "gnu.tar"); + TEST_STR_EQUAL(m->name, "file_a1"); TEST_ASSERT(S_ISREG(m->mode)); TEST_ASSERT(m->parent == n); m = m->next; TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "pax.tar"); + TEST_STR_EQUAL(m->name, "file_a2"); TEST_ASSERT(S_ISREG(m->mode)); TEST_ASSERT(m->parent == n); @@ -52,50 +46,26 @@ static void check_hierarchy(tree_node_t *root, bool recursive) n = n->next; TEST_NOT_NULL(n); - TEST_STR_EQUAL(n->name, "format-acceptance"); + TEST_STR_EQUAL(n->name, "dirb"); TEST_ASSERT(S_ISDIR(n->mode)); TEST_ASSERT(n->parent == root); if (recursive) { m = n->data.dir.children; TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "gnu-g.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "gnu.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "link_filled.tar"); + TEST_STR_EQUAL(m->name, "file_b0"); TEST_ASSERT(S_ISREG(m->mode)); TEST_ASSERT(m->parent == n); m = m->next; TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "pax.tar"); + TEST_STR_EQUAL(m->name, "file_b1"); TEST_ASSERT(S_ISREG(m->mode)); TEST_ASSERT(m->parent == n); m = m->next; TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "ustar-pre-posix.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "ustar.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "v7.tar"); + TEST_STR_EQUAL(m->name, "file_b2"); TEST_ASSERT(S_ISREG(m->mode)); TEST_ASSERT(m->parent == n); @@ -107,193 +77,26 @@ static void check_hierarchy(tree_node_t *root, bool recursive) n = n->next; TEST_NOT_NULL(n); - TEST_STR_EQUAL(n->name, "large-mtime"); + TEST_STR_EQUAL(n->name, "dirc"); TEST_ASSERT(S_ISDIR(n->mode)); TEST_ASSERT(n->parent == root); if (recursive) { m = n->data.dir.children; TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "12-digit.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "gnu.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "pax.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NULL(m); - } else { - TEST_NULL(n->data.dir.children); - } - - n = n->next; - TEST_NOT_NULL(n); - TEST_STR_EQUAL(n->name, "long-paths"); - TEST_ASSERT(S_ISDIR(n->mode)); - TEST_ASSERT(n->parent == root); - - if (recursive) { - m = n->data.dir.children; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "gnu.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "pax.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "ustar.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NULL(m); - } else { - TEST_NULL(n->data.dir.children); - } - - n = n->next; - TEST_NOT_NULL(n); - TEST_STR_EQUAL(n->name, "negative-mtime"); - TEST_ASSERT(S_ISDIR(n->mode)); - TEST_ASSERT(n->parent == root); - - if (recursive) { - m = n->data.dir.children; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "gnu.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "pax.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NULL(m); - } else { - TEST_NULL(n->data.dir.children); - } - - n = n->next; - TEST_NOT_NULL(n); - TEST_STR_EQUAL(n->name, "sparse-files"); - TEST_ASSERT(S_ISDIR(n->mode)); - TEST_ASSERT(n->parent == root); - - if (recursive) { - m = n->data.dir.children; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "gnu-small.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "gnu.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "pax-gnu0-0.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "pax-gnu0-1.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "pax-gnu1-0.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NULL(m); - } else { - TEST_NULL(n->data.dir.children); - } - - n = n->next; - TEST_NOT_NULL(n); - TEST_STR_EQUAL(n->name, "user-group-largenum"); - TEST_ASSERT(S_ISDIR(n->mode)); - TEST_ASSERT(n->parent == root); - - if (recursive) { - m = n->data.dir.children; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "8-digit.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "gnu.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "pax.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NULL(m); - } else { - TEST_NULL(n->data.dir.children); - } - - n = n->next; - TEST_NOT_NULL(n); - TEST_STR_EQUAL(n->name, "xattr"); - TEST_ASSERT(S_ISDIR(n->mode)); - TEST_ASSERT(n->parent == root); - - if (recursive) { - m = n->data.dir.children; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "acl.tar"); - TEST_ASSERT(S_ISREG(m->mode)); - TEST_ASSERT(m->parent == n); - - m = m->next; - TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "xattr-libarchive.tar"); + TEST_STR_EQUAL(m->name, "file_c0"); TEST_ASSERT(S_ISREG(m->mode)); TEST_ASSERT(m->parent == n); m = m->next; TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "xattr-schily-binary.tar"); + TEST_STR_EQUAL(m->name, "file_c1"); TEST_ASSERT(S_ISREG(m->mode)); TEST_ASSERT(m->parent == n); m = m->next; TEST_NOT_NULL(m); - TEST_STR_EQUAL(m->name, "xattr-schily.tar"); + TEST_STR_EQUAL(m->name, "file_c2"); TEST_ASSERT(S_ISREG(m->mode)); TEST_ASSERT(m->parent == n); diff --git a/tests/gensquashfs/testdir/dira/file_a0 b/tests/gensquashfs/testdir/dira/file_a0 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/gensquashfs/testdir/dira/file_a0 diff --git a/tests/gensquashfs/testdir/dira/file_a1 b/tests/gensquashfs/testdir/dira/file_a1 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/gensquashfs/testdir/dira/file_a1 diff --git a/tests/gensquashfs/testdir/dira/file_a2 b/tests/gensquashfs/testdir/dira/file_a2 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/gensquashfs/testdir/dira/file_a2 diff --git a/tests/gensquashfs/testdir/dirb/file_b0 b/tests/gensquashfs/testdir/dirb/file_b0 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/gensquashfs/testdir/dirb/file_b0 diff --git a/tests/gensquashfs/testdir/dirb/file_b1 b/tests/gensquashfs/testdir/dirb/file_b1 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/gensquashfs/testdir/dirb/file_b1 diff --git a/tests/gensquashfs/testdir/dirb/file_b2 b/tests/gensquashfs/testdir/dirb/file_b2 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/gensquashfs/testdir/dirb/file_b2 diff --git a/tests/gensquashfs/testdir/dirc/file_c0 b/tests/gensquashfs/testdir/dirc/file_c0 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/gensquashfs/testdir/dirc/file_c0 diff --git a/tests/gensquashfs/testdir/dirc/file_c1 b/tests/gensquashfs/testdir/dirc/file_c1 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/gensquashfs/testdir/dirc/file_c1 diff --git a/tests/gensquashfs/testdir/dirc/file_c2 b/tests/gensquashfs/testdir/dirc/file_c2 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/gensquashfs/testdir/dirc/file_c2 |