summaryrefslogtreecommitdiff
path: root/tests/mknode_simple.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-03-05 15:53:21 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-03-06 22:08:36 +0100
commitb950412ca3a91aa37349cf51ebe98cc84767d448 (patch)
treee3bb062114d019984321a5a21b29818c88c36795 /tests/mknode_simple.c
parent3fc6bf24b5cc071fc323f08ece541e37578f6369 (diff)
Cleanup: add some structure to the test directory
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/mknode_simple.c')
-rw-r--r--tests/mknode_simple.c97
1 files changed, 0 insertions, 97 deletions
diff --git a/tests/mknode_simple.c b/tests/mknode_simple.c
deleted file mode 100644
index 271ff96..0000000
--- a/tests/mknode_simple.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
-/*
- * mknode_simple.c
- *
- * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
- */
-#include "config.h"
-
-#include "fstree.h"
-#include "test.h"
-
-int main(void)
-{
- tree_node_t *node;
- struct stat sb;
- fstree_t fs;
-
- memset(&fs, 0, sizeof(fs));
- memset(&sb, 0, sizeof(sb));
- sb.st_mode = S_IFSOCK | 0654;
- sb.st_uid = 123;
- sb.st_gid = 456;
- sb.st_rdev = 789;
- sb.st_size = 1337;
-
- node = fstree_mknode(NULL, "sockfile", 8, NULL, &sb);
- TEST_ASSERT((char *)node->name >= (char *)node->payload);
- TEST_STR_EQUAL(node->name, "sockfile");
- TEST_EQUAL_UI(node->uid, sb.st_uid);
- TEST_EQUAL_UI(node->gid, sb.st_gid);
- TEST_EQUAL_UI(node->mode, sb.st_mode);
- TEST_EQUAL_UI(node->link_count, 1);
- TEST_NULL(node->parent);
- TEST_NULL(node->data.target);
- TEST_EQUAL_UI(node->data.devno, 0);
- free(node);
-
- memset(&fs, 0, sizeof(fs));
- memset(&sb, 0, sizeof(sb));
- sb.st_mode = S_IFIFO | 0654;
- sb.st_uid = 123;
- sb.st_gid = 456;
- sb.st_rdev = 789;
- sb.st_size = 1337;
-
- node = fstree_mknode(NULL, "fifo", 4, NULL, &sb);
- TEST_ASSERT((char *)node->name >= (char *)node->payload);
- TEST_STR_EQUAL(node->name, "fifo");
- TEST_EQUAL_UI(node->uid, sb.st_uid);
- TEST_EQUAL_UI(node->gid, sb.st_gid);
- TEST_EQUAL_UI(node->mode, sb.st_mode);
- TEST_EQUAL_UI(node->link_count, 1);
- TEST_NULL(node->parent);
- TEST_NULL(node->data.target);
- TEST_EQUAL_UI(node->data.devno, 0);
- free(node);
-
- memset(&fs, 0, sizeof(fs));
- memset(&sb, 0, sizeof(sb));
- sb.st_mode = S_IFBLK | 0654;
- sb.st_uid = 123;
- sb.st_gid = 456;
- sb.st_rdev = 789;
- sb.st_size = 1337;
-
- node = fstree_mknode(NULL, "blkdev", 6, NULL, &sb);
- TEST_ASSERT((char *)node->name >= (char *)node->payload);
- TEST_STR_EQUAL(node->name, "blkdev");
- TEST_EQUAL_UI(node->uid, sb.st_uid);
- TEST_EQUAL_UI(node->gid, sb.st_gid);
- TEST_EQUAL_UI(node->mode, sb.st_mode);
- TEST_EQUAL_UI(node->link_count, 1);
- TEST_EQUAL_UI(node->data.devno, sb.st_rdev);
- TEST_NULL(node->parent);
- free(node);
-
- memset(&fs, 0, sizeof(fs));
- memset(&sb, 0, sizeof(sb));
- sb.st_mode = S_IFCHR | 0654;
- sb.st_uid = 123;
- sb.st_gid = 456;
- sb.st_rdev = 789;
- sb.st_size = 1337;
-
- node = fstree_mknode(NULL, "chardev", 7, NULL, &sb);
- TEST_ASSERT((char *)node->name >= (char *)node->payload);
- TEST_STR_EQUAL(node->name, "chardev");
- TEST_EQUAL_UI(node->uid, sb.st_uid);
- TEST_EQUAL_UI(node->gid, sb.st_gid);
- TEST_EQUAL_UI(node->mode, sb.st_mode);
- TEST_EQUAL_UI(node->link_count, 1);
- TEST_EQUAL_UI(node->data.devno, sb.st_rdev);
- TEST_NULL(node->parent);
- free(node);
-
- return EXIT_SUCCESS;
-}