aboutsummaryrefslogtreecommitdiff
path: root/bin/gensquashfs/test
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-04-19 08:51:26 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-04-19 11:17:51 +0200
commit75fb524b5702bca4f8467309f7d95f9937ec6683 (patch)
treeb47a037c0f24873a9fc5b3f5b08583c9ad90de08 /bin/gensquashfs/test
parenta13df03fddd9499960d4653aaee0970983b65f73 (diff)
libfstree: get rid of dir_info_t
The single boolean created_implicitly can be replaced with a general purpose flag field. The "children" pointer can then be hoisted directly into the data union of tree_node_t. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'bin/gensquashfs/test')
-rw-r--r--bin/gensquashfs/test/fstree_from_dir.c22
-rw-r--r--bin/gensquashfs/test/fstree_from_file.c20
-rw-r--r--bin/gensquashfs/test/fstree_glob1.c38
3 files changed, 40 insertions, 40 deletions
diff --git a/bin/gensquashfs/test/fstree_from_dir.c b/bin/gensquashfs/test/fstree_from_dir.c
index d64934e..7d6fc06 100644
--- a/bin/gensquashfs/test/fstree_from_dir.c
+++ b/bin/gensquashfs/test/fstree_from_dir.c
@@ -13,14 +13,14 @@ static void check_hierarchy(tree_node_t *root, bool recursive)
{
tree_node_t *n, *m;
- n = root->data.dir.children;
+ n = root->data.children;
TEST_NOT_NULL(n);
TEST_STR_EQUAL(n->name, "dira");
TEST_ASSERT(S_ISDIR(n->mode));
TEST_ASSERT(n->parent == root);
if (recursive) {
- m = n->data.dir.children;
+ m = n->data.children;
TEST_NOT_NULL(m);
TEST_STR_EQUAL(m->name, "file_a0");
TEST_ASSERT(S_ISREG(m->mode));
@@ -41,7 +41,7 @@ static void check_hierarchy(tree_node_t *root, bool recursive)
m = m->next;
TEST_NULL(m);
} else {
- TEST_NULL(n->data.dir.children);
+ TEST_NULL(n->data.children);
}
n = n->next;
@@ -51,7 +51,7 @@ static void check_hierarchy(tree_node_t *root, bool recursive)
TEST_ASSERT(n->parent == root);
if (recursive) {
- m = n->data.dir.children;
+ m = n->data.children;
TEST_NOT_NULL(m);
TEST_STR_EQUAL(m->name, "file_b0");
TEST_ASSERT(S_ISREG(m->mode));
@@ -72,7 +72,7 @@ static void check_hierarchy(tree_node_t *root, bool recursive)
m = m->next;
TEST_NULL(m);
} else {
- TEST_NULL(n->data.dir.children);
+ TEST_NULL(n->data.children);
}
n = n->next;
@@ -82,7 +82,7 @@ static void check_hierarchy(tree_node_t *root, bool recursive)
TEST_ASSERT(n->parent == root);
if (recursive) {
- m = n->data.dir.children;
+ m = n->data.children;
TEST_NOT_NULL(m);
TEST_STR_EQUAL(m->name, "file_c0");
TEST_ASSERT(S_ISREG(m->mode));
@@ -103,7 +103,7 @@ static void check_hierarchy(tree_node_t *root, bool recursive)
m = m->next;
TEST_NULL(m);
} else {
- TEST_NULL(n->data.dir.children);
+ TEST_NULL(n->data.children);
}
n = n->next;
@@ -146,11 +146,11 @@ int main(int argc, char **argv)
n = fstree_mknode(fs.root, "foodir", 6, NULL, &sb);
TEST_NOT_NULL(n);
- fs.root->data.dir.children = n;
+ fs.root->data.children = n;
TEST_ASSERT(fstree_from_dir(&fs, n, TEST_PATH, NULL, NULL, 0) == 0);
- TEST_ASSERT(fs.root->data.dir.children == n);
+ TEST_ASSERT(fs.root->data.children == n);
TEST_NULL(n->next);
fstree_post_process(&fs);
@@ -165,12 +165,12 @@ int main(int argc, char **argv)
n = fstree_mknode(fs.root, "foodir", 6, NULL, &sb);
TEST_NOT_NULL(n);
- fs.root->data.dir.children = n;
+ fs.root->data.children = n;
TEST_ASSERT(fstree_from_dir(&fs, n, TEST_PATH, NULL, NULL,
DIR_SCAN_NO_RECURSION) == 0);
- TEST_ASSERT(fs.root->data.dir.children == n);
+ TEST_ASSERT(fs.root->data.children == n);
TEST_NULL(n->next);
fstree_post_process(&fs);
diff --git a/bin/gensquashfs/test/fstree_from_file.c b/bin/gensquashfs/test/fstree_from_file.c
index e526f2d..03591d5 100644
--- a/bin/gensquashfs/test/fstree_from_file.c
+++ b/bin/gensquashfs/test/fstree_from_file.c
@@ -21,7 +21,7 @@ int main(int argc, char **argv)
TEST_ASSERT(fstree_from_file(&fs, TEST_PATH, NULL) == 0);
fstree_post_process(&fs);
- n = fs.root->data.dir.children;
+ n = fs.root->data.children;
TEST_EQUAL_UI(fs.root->link_count, 9);
TEST_EQUAL_UI(fs.root->mode, S_IFDIR | 0755);
@@ -49,7 +49,7 @@ int main(int argc, char **argv)
TEST_EQUAL_UI(n->gid, 5);
TEST_EQUAL_UI(n->link_count, 2);
TEST_STR_EQUAL(n->name, "dir");
- TEST_NULL(n->data.dir.children);
+ TEST_NULL(n->data.children);
n = n->next;
TEST_EQUAL_UI(n->mode, S_IFDIR | 0755);
@@ -57,15 +57,15 @@ int main(int argc, char **argv)
TEST_EQUAL_UI(n->gid, 0);
TEST_EQUAL_UI(n->link_count, 3);
TEST_STR_EQUAL(n->name, "foo bar");
- TEST_NOT_NULL(n->data.dir.children);
+ TEST_NOT_NULL(n->data.children);
- TEST_NULL(n->data.dir.children->next);
- TEST_EQUAL_UI(n->data.dir.children->mode, S_IFDIR | 0755);
- TEST_EQUAL_UI(n->data.dir.children->uid, 0);
- TEST_EQUAL_UI(n->data.dir.children->gid, 0);
- TEST_EQUAL_UI(n->data.dir.children->link_count, 2);
- TEST_STR_EQUAL(n->data.dir.children->name, " test \"");
- TEST_NULL(n->data.dir.children->data.dir.children);
+ TEST_NULL(n->data.children->next);
+ TEST_EQUAL_UI(n->data.children->mode, S_IFDIR | 0755);
+ TEST_EQUAL_UI(n->data.children->uid, 0);
+ TEST_EQUAL_UI(n->data.children->gid, 0);
+ TEST_EQUAL_UI(n->data.children->link_count, 2);
+ TEST_STR_EQUAL(n->data.children->name, " test \"");
+ TEST_NULL(n->data.children->data.children);
n = n->next;
TEST_EQUAL_UI(n->mode, S_IFIFO | 0644);
diff --git a/bin/gensquashfs/test/fstree_glob1.c b/bin/gensquashfs/test/fstree_glob1.c
index dbe0e50..8df1d0f 100644
--- a/bin/gensquashfs/test/fstree_glob1.c
+++ b/bin/gensquashfs/test/fstree_glob1.c
@@ -14,7 +14,7 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
tree_node_t *n, *m, *parentdir;
if (subdir) {
- n = root->data.dir.children;
+ n = root->data.children;
TEST_NOT_NULL(n);
TEST_STR_EQUAL(n->name, "tarcorpus");
TEST_ASSERT(S_ISDIR(n->mode));
@@ -30,14 +30,14 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
}
parentdir = n;
- n = n->data.dir.children;
+ n = n->data.children;
TEST_NOT_NULL(n);
TEST_STR_EQUAL(n->name, "file-size");
TEST_ASSERT(S_ISDIR(n->mode));
TEST_ASSERT(n->parent == parentdir);
if (recursive) {
- m = n->data.dir.children;
+ m = n->data.children;
TEST_NOT_NULL(m);
TEST_STR_EQUAL(m->name, "gnu.tar");
TEST_ASSERT(S_ISREG(m->mode));
@@ -46,7 +46,7 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
m = m->next;
TEST_NULL(m);
} else {
- TEST_NULL(n->data.dir.children);
+ TEST_NULL(n->data.children);
}
n = n->next;
@@ -56,7 +56,7 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
TEST_ASSERT(n->parent == parentdir);
if (recursive) {
- m = n->data.dir.children;
+ m = n->data.children;
TEST_NOT_NULL(m);
TEST_STR_EQUAL(m->name, "gnu-g.tar");
TEST_ASSERT(S_ISREG(m->mode));
@@ -71,7 +71,7 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
m = m->next;
TEST_NULL(m);
} else {
- TEST_NULL(n->data.dir.children);
+ TEST_NULL(n->data.children);
}
n = n->next;
@@ -79,7 +79,7 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
TEST_STR_EQUAL(n->name, "istream");
TEST_ASSERT(S_ISDIR(n->mode));
TEST_ASSERT(n->parent == parentdir);
- TEST_NULL(n->data.dir.children);
+ TEST_NULL(n->data.children);
n = n->next;
TEST_NOT_NULL(n);
@@ -88,7 +88,7 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
TEST_ASSERT(n->parent == parentdir);
if (recursive) {
- m = n->data.dir.children;
+ m = n->data.children;
TEST_NOT_NULL(m);
TEST_STR_EQUAL(m->name, "gnu.tar");
TEST_ASSERT(S_ISREG(m->mode));
@@ -97,7 +97,7 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
m = m->next;
TEST_NULL(m);
} else {
- TEST_NULL(n->data.dir.children);
+ TEST_NULL(n->data.children);
}
n = n->next;
@@ -107,7 +107,7 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
TEST_ASSERT(n->parent == parentdir);
if (recursive) {
- m = n->data.dir.children;
+ m = n->data.children;
TEST_NOT_NULL(m);
TEST_STR_EQUAL(m->name, "gnu.tar");
TEST_ASSERT(S_ISREG(m->mode));
@@ -116,7 +116,7 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
m = m->next;
TEST_NULL(m);
} else {
- TEST_NULL(n->data.dir.children);
+ TEST_NULL(n->data.children);
}
n = n->next;
@@ -126,7 +126,7 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
TEST_ASSERT(n->parent == parentdir);
if (recursive) {
- m = n->data.dir.children;
+ m = n->data.children;
TEST_NOT_NULL(m);
TEST_STR_EQUAL(m->name, "gnu.tar");
TEST_ASSERT(S_ISREG(m->mode));
@@ -135,7 +135,7 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
m = m->next;
TEST_NULL(m);
} else {
- TEST_NULL(n->data.dir.children);
+ TEST_NULL(n->data.children);
}
n = n->next;
@@ -145,7 +145,7 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
TEST_ASSERT(n->parent == parentdir);
if (recursive) {
- m = n->data.dir.children;
+ m = n->data.children;
TEST_NOT_NULL(m);
TEST_STR_EQUAL(m->name, "gnu-small.tar");
TEST_ASSERT(S_ISREG(m->mode));
@@ -178,7 +178,7 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
m = m->next;
TEST_NULL(m);
} else {
- TEST_NULL(n->data.dir.children);
+ TEST_NULL(n->data.children);
}
n = n->next;
@@ -188,7 +188,7 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
TEST_ASSERT(n->parent == parentdir);
if (recursive) {
- m = n->data.dir.children;
+ m = n->data.children;
TEST_NOT_NULL(m);
TEST_STR_EQUAL(m->name, "gnu.tar");
TEST_ASSERT(S_ISREG(m->mode));
@@ -197,7 +197,7 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
m = m->next;
TEST_NULL(m);
} else {
- TEST_NULL(n->data.dir.children);
+ TEST_NULL(n->data.children);
}
n = n->next;
@@ -205,14 +205,14 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
TEST_STR_EQUAL(n->name, "write");
TEST_ASSERT(S_ISDIR(n->mode));
TEST_ASSERT(n->parent == parentdir);
- TEST_NULL(n->data.dir.children);
+ TEST_NULL(n->data.children);
n = n->next;
TEST_NOT_NULL(n);
TEST_STR_EQUAL(n->name, "xattr");
TEST_ASSERT(S_ISDIR(n->mode));
TEST_ASSERT(n->parent == parentdir);
- TEST_NULL(n->data.dir.children);
+ TEST_NULL(n->data.children);
n = n->next;
TEST_NULL(n);