summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/fstree_sort.c8
-rw-r--r--tests/gen_inode_table.c29
-rw-r--r--tests/mknode_dir.c6
-rw-r--r--tests/mknode_reg.c5
-rw-r--r--tests/mknode_simple.c8
-rw-r--r--tests/mknode_slink.c4
6 files changed, 29 insertions, 31 deletions
diff --git a/tests/fstree_sort.c b/tests/fstree_sort.c
index c90f4b0..86ef4e5 100644
--- a/tests/fstree_sort.c
+++ b/tests/fstree_sort.c
@@ -23,10 +23,10 @@ int main(void)
sb.st_mode = S_IFBLK | 0600;
sb.st_rdev = 1337;
- a = fstree_mknode(&fs, NULL, "a", 1, NULL, &sb);
- b = fstree_mknode(&fs, NULL, "b", 1, NULL, &sb);
- c = fstree_mknode(&fs, NULL, "c", 1, NULL, &sb);
- d = fstree_mknode(&fs, NULL, "d", 1, NULL, &sb);
+ a = fstree_mknode(NULL, "a", 1, NULL, &sb);
+ b = fstree_mknode(NULL, "b", 1, NULL, &sb);
+ c = fstree_mknode(NULL, "c", 1, NULL, &sb);
+ d = fstree_mknode(NULL, "d", 1, NULL, &sb);
assert(a != NULL && b != NULL && c != NULL && d != NULL);
/* empty list */
diff --git a/tests/gen_inode_table.c b/tests/gen_inode_table.c
index 7a93efc..190f393 100644
--- a/tests/gen_inode_table.c
+++ b/tests/gen_inode_table.c
@@ -12,15 +12,14 @@
#include <assert.h>
#include <string.h>
-static tree_node_t *gen_node(fstree_t *fs, tree_node_t *parent,
- const char *name)
+static tree_node_t *gen_node(tree_node_t *parent, const char *name)
{
struct stat sb;
memset(&sb, 0, sizeof(sb));
sb.st_mode = S_IFDIR | 0755;
- return fstree_mknode(fs, parent, name, strlen(name), NULL, &sb);
+ return fstree_mknode(parent, name, strlen(name), NULL, &sb);
}
static void check_children_before_root(tree_node_t *root)
@@ -67,24 +66,24 @@ int main(void)
// tree with 2 levels under root, fan out 3
assert(fstree_init(&fs, 0, NULL) == 0);
- a = gen_node(&fs, fs.root, "a");
- b = gen_node(&fs, fs.root, "b");
- c = gen_node(&fs, fs.root, "c");
+ a = gen_node(fs.root, "a");
+ b = gen_node(fs.root, "b");
+ c = gen_node(fs.root, "c");
assert(a != NULL);
assert(b != NULL);
assert(c != NULL);
- assert(gen_node(&fs, a, "a_a") != NULL);
- assert(gen_node(&fs, a, "a_b") != NULL);
- assert(gen_node(&fs, a, "a_c") != NULL);
+ assert(gen_node(a, "a_a") != NULL);
+ assert(gen_node(a, "a_b") != NULL);
+ assert(gen_node(a, "a_c") != NULL);
- assert(gen_node(&fs, b, "b_a") != NULL);
- assert(gen_node(&fs, b, "b_b") != NULL);
- assert(gen_node(&fs, b, "b_c") != NULL);
+ assert(gen_node(b, "b_a") != NULL);
+ assert(gen_node(b, "b_b") != NULL);
+ assert(gen_node(b, "b_c") != NULL);
- assert(gen_node(&fs, c, "c_a") != NULL);
- assert(gen_node(&fs, c, "c_b") != NULL);
- assert(gen_node(&fs, c, "c_c") != NULL);
+ assert(gen_node(c, "c_a") != NULL);
+ assert(gen_node(c, "c_b") != NULL);
+ assert(gen_node(c, "c_c") != NULL);
assert(fstree_gen_inode_table(&fs) == 0);
diff --git a/tests/mknode_dir.c b/tests/mknode_dir.c
index d4e7c01..2ca189d 100644
--- a/tests/mknode_dir.c
+++ b/tests/mknode_dir.c
@@ -26,7 +26,7 @@ int main(void)
sb.st_rdev = 789;
sb.st_size = 4096;
- root = fstree_mknode(&fs, NULL, "rootdir", 7, (void *)0x100, &sb);
+ root = fstree_mknode(NULL, "rootdir", 7, (void *)0x100, &sb);
assert(root->uid == sb.st_uid);
assert(root->gid == sb.st_gid);
assert(root->mode == sb.st_mode);
@@ -38,14 +38,14 @@ int main(void)
assert(root->parent == NULL);
assert(root->next == NULL);
- a = fstree_mknode(&fs, root, "adir", 4, (void *)0x100, &sb);
+ a = fstree_mknode(root, "adir", 4, (void *)0x100, &sb);
assert(a->parent == root);
assert(a->next == NULL);
assert(root->data.dir->children == a);
assert(root->parent == NULL);
assert(root->next == NULL);
- b = fstree_mknode(&fs, root, "bdir", 4, (void *)0x100, &sb);
+ b = fstree_mknode(root, "bdir", 4, (void *)0x100, &sb);
assert(a->parent == root);
assert(b->parent == root);
assert(root->data.dir->children == b);
diff --git a/tests/mknode_reg.c b/tests/mknode_reg.c
index 65de0b6..b9c81e0 100644
--- a/tests/mknode_reg.c
+++ b/tests/mknode_reg.c
@@ -28,15 +28,14 @@ int main(void)
sb.st_rdev = 789;
sb.st_size = 4096;
- node = fstree_mknode(&fs, NULL, "filename", 8, "input", &sb);
+ node = fstree_mknode(NULL, "filename", 8, "input", &sb);
assert(node->uid == sb.st_uid);
assert(node->gid == sb.st_gid);
assert(node->mode == sb.st_mode);
assert(node->parent == NULL);
assert((char *)node->name >= (char *)node->payload);
assert((char *)node->data.file >= (char *)node->payload);
- assert(node->data.file->input_file > (char *)(node->data.file + 1) +
- sizeof(node->data.file->block_size[0]) * 4);
+ assert(node->data.file->input_file >= (char *)(node->data.file + 1));
assert(node->name >= node->data.file->input_file + 6);
assert(strcmp(node->name, "filename") == 0);
assert(strcmp(node->data.file->input_file, "input") == 0);
diff --git a/tests/mknode_simple.c b/tests/mknode_simple.c
index 956c5fe..e872369 100644
--- a/tests/mknode_simple.c
+++ b/tests/mknode_simple.c
@@ -26,7 +26,7 @@ int main(void)
sb.st_rdev = 789;
sb.st_size = 1337;
- node = fstree_mknode(&fs, NULL, "sockfile", 8, (void *)0x1000, &sb);
+ node = fstree_mknode(NULL, "sockfile", 8, (void *)0x1000, &sb);
assert((char *)node->name >= (char *)node->payload);
assert(strcmp(node->name, "sockfile") == 0);
assert(node->uid == sb.st_uid);
@@ -47,7 +47,7 @@ int main(void)
sb.st_rdev = 789;
sb.st_size = 1337;
- node = fstree_mknode(&fs, NULL, "fifo", 4, (void *)0x1000, &sb);
+ node = fstree_mknode(NULL, "fifo", 4, (void *)0x1000, &sb);
assert((char *)node->name >= (char *)node->payload);
assert(strcmp(node->name, "fifo") == 0);
assert(node->uid == sb.st_uid);
@@ -68,7 +68,7 @@ int main(void)
sb.st_rdev = 789;
sb.st_size = 1337;
- node = fstree_mknode(&fs, NULL, "blkdev", 6, (void *)0x1000, &sb);
+ node = fstree_mknode(NULL, "blkdev", 6, (void *)0x1000, &sb);
assert((char *)node->name >= (char *)node->payload);
assert(strcmp(node->name, "blkdev") == 0);
assert(node->uid == sb.st_uid);
@@ -86,7 +86,7 @@ int main(void)
sb.st_rdev = 789;
sb.st_size = 1337;
- node = fstree_mknode(&fs, NULL, "chardev", 7, (void *)0x1000, &sb);
+ node = fstree_mknode(NULL, "chardev", 7, (void *)0x1000, &sb);
assert((char *)node->name >= (char *)node->payload);
assert(strcmp(node->name, "chardev") == 0);
assert(node->uid == sb.st_uid);
diff --git a/tests/mknode_slink.c b/tests/mknode_slink.c
index 2383717..bbf7045 100644
--- a/tests/mknode_slink.c
+++ b/tests/mknode_slink.c
@@ -26,7 +26,7 @@ int main(void)
sb.st_rdev = 789;
sb.st_size = 1337;
- node = fstree_mknode(&fs, NULL, "symlink", 7, "target", &sb);
+ node = fstree_mknode(NULL, "symlink", 7, "target", &sb);
assert(node->uid == sb.st_uid);
assert(node->gid == sb.st_gid);
assert(node->mode == (S_IFLNK | 0777));
@@ -38,7 +38,7 @@ int main(void)
assert(strcmp(node->data.slink_target, "target") == 0);
free(node);
- node = fstree_mknode(&fs, NULL, "symlink", 7, "", &sb);
+ node = fstree_mknode(NULL, "symlink", 7, "", &sb);
assert(node->uid == sb.st_uid);
assert(node->gid == sb.st_gid);
assert(node->mode == (S_IFLNK | 0777));