aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/Makemodule.am7
-rw-r--r--tests/fstree_xattr.c88
2 files changed, 2 insertions, 93 deletions
diff --git a/tests/Makemodule.am b/tests/Makemodule.am
index 37e5d48..d7f8013 100644
--- a/tests/Makemodule.am
+++ b/tests/Makemodule.am
@@ -31,9 +31,6 @@ test_fstree_from_file_LDADD = libfstree.a libutil.la
test_fstree_init_SOURCES = tests/fstree_init.c
test_fstree_init_LDADD = libfstree.a libutil.la
-test_fstree_xattr_SOURCES = tests/fstree_xattr.c
-test_fstree_xattr_LDADD = libfstree.a libutil.la
-
test_tar_gnu_SOURCES = tests/tar_gnu.c
test_tar_gnu_LDADD = libtar.a libutil.la
test_tar_gnu_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
@@ -82,7 +79,7 @@ tar_fuzz_LDADD = libtar.a libutil.la
check_PROGRAMS += test_canonicalize_name test_mknode_simple test_mknode_slink
check_PROGRAMS += test_mknode_reg test_mknode_dir test_gen_inode_table
check_PROGRAMS += test_add_by_path test_get_path test_fstree_sort
-check_PROGRAMS += test_fstree_from_file test_fstree_init test_fstree_xattr
+check_PROGRAMS += test_fstree_from_file test_fstree_init
check_PROGRAMS += test_tar_ustar test_tar_pax test_tar_gnu test_tar_sparse_gnu
check_PROGRAMS += test_tar_sparse_gnu1 test_tar_sparse_gnu2
check_PROGRAMS += test_tar_xattr_bsd test_tar_xattr_schily test_str_table
@@ -92,7 +89,7 @@ noinst_PROGRAMS += fstree_fuzz tar_fuzz
TESTS += test_canonicalize_name test_mknode_simple test_mknode_slink
TESTS += test_mknode_reg test_mknode_dir test_gen_inode_table
TESTS += test_add_by_path test_get_path test_fstree_sort test_fstree_from_file
-TESTS += test_fstree_init test_fstree_xattr test_tar_ustar test_tar_pax
+TESTS += test_fstree_init test_tar_ustar test_tar_pax
TESTS += test_tar_gnu test_tar_sparse_gnu test_tar_sparse_gnu1
TESTS += test_tar_sparse_gnu2 test_tar_xattr_bsd test_tar_xattr_schily
TESTS += test_str_table
diff --git a/tests/fstree_xattr.c b/tests/fstree_xattr.c
deleted file mode 100644
index 0a5b487..0000000
--- a/tests/fstree_xattr.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
-/*
- * fstree_xattr.c
- *
- * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
- */
-#include "config.h"
-
-#include "fstree.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-int main(void)
-{
- tree_node_t *a, *b, *c, *d;
- struct stat sb;
- fstree_t fs;
-
- assert(fstree_init(&fs, 512, NULL) == 0);
-
- memset(&sb, 0, sizeof(sb));
- sb.st_mode = S_IFCHR | 0640;
- sb.st_rdev = 1337;
-
- a = fstree_add_generic(&fs, "/a", &sb, NULL);
- b = fstree_add_generic(&fs, "/b", &sb, NULL);
- c = fstree_add_generic(&fs, "/c", &sb, NULL);
- d = fstree_add_generic(&fs, "/d", &sb, NULL);
- assert(a != NULL);
- assert(b != NULL);
- assert(c != NULL);
- assert(d != NULL);
-
- assert(fstree_add_xattr(&fs, a, "foo", "bar") == 0);
-
- assert(fstree_add_xattr(&fs, b, "foo", "bar") == 0);
- assert(fstree_add_xattr(&fs, b, "baz", "qux") == 0);
-
- assert(fstree_add_xattr(&fs, c, "foo", "something else") == 0);
-
- assert(fstree_add_xattr(&fs, d, "baz", "qux") == 0);
- assert(fstree_add_xattr(&fs, d, "foo", "bar") == 0);
-
- assert(a->xattr != NULL);
- assert(b->xattr != NULL);
- assert(c->xattr != NULL);
- assert(d->xattr != NULL);
-
- assert(a->xattr != b->xattr);
- assert(a->xattr != c->xattr);
- assert(a->xattr != d->xattr);
- assert(b->xattr != c->xattr);
- assert(b->xattr != d->xattr);
- assert(c->xattr != d->xattr);
-
- assert(a->xattr->num_attr == 1);
- assert(b->xattr->num_attr == 2);
- assert(c->xattr->num_attr == 1);
- assert(d->xattr->num_attr == 2);
-
- assert(a->xattr->attr[0].key_index == b->xattr->attr[0].key_index);
- assert(a->xattr->attr[0].value_index == b->xattr->attr[0].value_index);
-
- assert(a->xattr->attr[0].key_index == d->xattr->attr[1].key_index);
- assert(a->xattr->attr[0].value_index == d->xattr->attr[1].value_index);
-
- assert(a->xattr->attr[0].key_index == c->xattr->attr[0].key_index);
- assert(a->xattr->attr[0].value_index != c->xattr->attr[0].value_index);
-
- assert(b->xattr->attr[1].key_index == d->xattr->attr[0].key_index);
- assert(b->xattr->attr[1].value_index == d->xattr->attr[0].value_index);
-
- fstree_xattr_deduplicate(&fs);
-
- assert(b->xattr == d->xattr);
- assert(a->xattr != b->xattr);
- assert(a->xattr != c->xattr);
-
- assert(str_table_get_ref_count(&fs.xattr_keys,
- a->xattr->attr[0].key_index) == 3);
- assert(str_table_get_ref_count(&fs.xattr_values,
- a->xattr->attr[0].value_index) == 2);
-
- fstree_cleanup(&fs);
- return EXIT_SUCCESS;
-}