diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2023-01-31 11:30:46 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2023-01-31 18:04:25 +0100 |
commit | 72c8155d9fc0eaeac72c053f46ebb7b231d4596a (patch) | |
tree | 5758865289c52fa93f56e3fe743bb40c283c5233 /tests/libtar | |
parent | cdccc69c62579b0c13b35fad0728079652b8f3c9 (diff) |
Reintegrate test code with library code
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/libtar')
40 files changed, 0 insertions, 694 deletions
diff --git a/tests/libtar/Makemodule.am b/tests/libtar/Makemodule.am deleted file mode 100644 index 07c19cc..0000000 --- a/tests/libtar/Makemodule.am +++ /dev/null @@ -1,176 +0,0 @@ -TARDATADIR=$(top_srcdir)/tests/libtar/data - -test_tar_gnu0_SOURCES = tests/libtar/tar_simple.c -test_tar_gnu0_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_gnu0_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_gnu0_CPPFLAGS += -DTESTFILE=format-acceptance/gnu.tar - -test_tar_gnu1_SOURCES = tests/libtar/tar_simple.c -test_tar_gnu1_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_gnu1_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_gnu1_CPPFLAGS += -DTESTFILE=format-acceptance/gnu-g.tar - -test_tar_gnu2_SOURCES = tests/libtar/tar_simple.c -test_tar_gnu2_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_gnu2_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_gnu2_CPPFLAGS += -DTESTFILE=user-group-largenum/gnu.tar -test_tar_gnu2_CPPFLAGS += -DTESTUID=0x80000000 -DTESTGID=0x80000000 -test_tar_gnu2_CPPFLAGS += -DTESTTS=1542995392 - -test_tar_gnu3_SOURCES = tests/libtar/tar_simple.c -test_tar_gnu3_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_gnu3_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_gnu3_CPPFLAGS += -DTESTFILE=negative-mtime/gnu.tar -DTESTTS=-315622800 - -test_tar_gnu4_SOURCES = tests/libtar/tar_simple.c -test_tar_gnu4_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_gnu4_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_gnu4_CPPFLAGS += -DTESTFILE=long-paths/gnu.tar -DLONG_NAME_TEST -test_tar_gnu4_CPPFLAGS += -DTESTTS=1542909670 - -test_tar_gnu5_SOURCES = tests/libtar/tar_simple.c -test_tar_gnu5_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_gnu5_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_gnu5_CPPFLAGS += -DTESTFILE=large-mtime/gnu.tar -DTESTTS=8589934592L - -test_tar_gnu6_SOURCES = tests/libtar/tar_big_file.c -test_tar_gnu6_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_gnu6_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_gnu6_CPPFLAGS += -DTESTFILE=file-size/gnu.tar - -test_tar_pax0_SOURCES = tests/libtar/tar_simple.c -test_tar_pax0_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_pax0_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_pax0_CPPFLAGS += -DTESTFILE=format-acceptance/pax.tar - -test_tar_pax1_SOURCES = tests/libtar/tar_simple.c -test_tar_pax1_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_pax1_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_pax1_CPPFLAGS += -DTESTFILE=user-group-largenum/pax.tar -test_tar_pax1_CPPFLAGS += -DTESTUID=2147483648UL -DTESTGID=2147483648UL -test_tar_pax1_CPPFLAGS += -DTESTTS=1542995392 - -test_tar_pax2_SOURCES = tests/libtar/tar_simple.c -test_tar_pax2_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_pax2_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_pax2_CPPFLAGS += -DTESTFILE=large-mtime/pax.tar -DTESTTS=8589934592L - -test_tar_pax3_SOURCES = tests/libtar/tar_simple.c -test_tar_pax3_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_pax3_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_pax3_CPPFLAGS += -DTESTFILE=negative-mtime/pax.tar -DTESTTS=-315622800 - -test_tar_pax4_SOURCES = tests/libtar/tar_simple.c -test_tar_pax4_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_pax4_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_pax4_CPPFLAGS += -DTESTFILE=long-paths/pax.tar -test_tar_pax4_CPPFLAGS += -DLONG_NAME_TEST -DTESTTS=1542909670 - -test_tar_pax5_SOURCES = tests/libtar/tar_big_file.c -test_tar_pax5_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_pax5_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_pax5_CPPFLAGS += -DTESTFILE=file-size/pax.tar - -test_tar_ustar0_SOURCES = tests/libtar/tar_simple.c -test_tar_ustar0_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_ustar0_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_ustar0_CPPFLAGS += -DTESTFILE=format-acceptance/ustar.tar - -test_tar_ustar1_SOURCES = tests/libtar/tar_simple.c -test_tar_ustar1_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_ustar1_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_ustar1_CPPFLAGS += -DTESTFILE=format-acceptance/ustar-pre-posix.tar - -test_tar_ustar2_SOURCES = tests/libtar/tar_simple.c -test_tar_ustar2_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_ustar2_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_ustar2_CPPFLAGS += -DTESTFILE=format-acceptance/v7.tar - -test_tar_ustar3_SOURCES = tests/libtar/tar_simple.c -test_tar_ustar3_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_ustar3_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_ustar3_CPPFLAGS += -DTESTFILE=user-group-largenum/8-digit.tar -test_tar_ustar3_CPPFLAGS += -DTESTUID=8388608 -DTESTGID=8388608 -test_tar_ustar3_CPPFLAGS += -DTESTTS=1542995392 - -test_tar_ustar4_SOURCES = tests/libtar/tar_simple.c -test_tar_ustar4_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_ustar4_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_ustar4_CPPFLAGS += -DTESTFILE=large-mtime/12-digit.tar -test_tar_ustar4_CPPFLAGS += -DTESTTS=8589934592L - -test_tar_ustar5_SOURCES = tests/libtar/tar_simple.c -test_tar_ustar5_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_ustar5_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_ustar5_CPPFLAGS += -DTESTFILE=long-paths/ustar.tar -test_tar_ustar5_CPPFLAGS += -DLONG_NAME_TEST -DTESTTS=1542909670 - -test_tar_ustar6_SOURCES = tests/libtar/tar_big_file.c -test_tar_ustar6_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_ustar6_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_ustar6_CPPFLAGS += -DTESTFILE=file-size/12-digit.tar - -test_tar_target_filled_SOURCES = tests/libtar/tar_target_filled.c -test_tar_target_filled_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_target_filled_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) - -test_tar_sparse_gnu_SOURCES = tests/libtar/tar_sparse_gnu.c -test_tar_sparse_gnu_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_sparse_gnu_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) - -test_tar_sparse_gnu0_SOURCES = tests/libtar/tar_sparse.c -test_tar_sparse_gnu0_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_sparse_gnu0_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_sparse_gnu0_CPPFLAGS += -DTESTFILE=sparse-files/pax-gnu0-0.tar - -test_tar_sparse_gnu1_SOURCES = tests/libtar/tar_sparse.c -test_tar_sparse_gnu1_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_sparse_gnu1_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_sparse_gnu1_CPPFLAGS += -DTESTFILE=sparse-files/pax-gnu0-1.tar - -test_tar_sparse_gnu2_SOURCES = tests/libtar/tar_sparse.c -test_tar_sparse_gnu2_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_sparse_gnu2_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_sparse_gnu2_CPPFLAGS += -DTESTFILE=sparse-files/pax-gnu1-0.tar - -test_tar_sparse_gnu3_SOURCES = tests/libtar/tar_sparse.c -test_tar_sparse_gnu3_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_sparse_gnu3_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_sparse_gnu3_CPPFLAGS += -DTESTFILE=sparse-files/gnu.tar - -test_tar_xattr_bsd_SOURCES = tests/libtar/tar_xattr.c -test_tar_xattr_bsd_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_xattr_bsd_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_xattr_bsd_CPPFLAGS += -DTESTFILE=xattr/xattr-libarchive.tar - -test_tar_xattr_schily_SOURCES = tests/libtar/tar_xattr.c -test_tar_xattr_schily_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_xattr_schily_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_xattr_schily_CPPFLAGS += -DTESTFILE=xattr/xattr-schily.tar - -test_tar_xattr_schily_bin_SOURCES = tests/libtar/tar_xattr_bin.c -test_tar_xattr_schily_bin_LDADD = libtar.a libio.a libutil.a libcompat.a -test_tar_xattr_schily_bin_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_xattr_schily_bin_CPPFLAGS += -DTESTFILE=xattr/xattr-schily-binary.tar - -tar_fuzz_SOURCES = tests/libtar/tar_fuzz.c -tar_fuzz_LDADD = libtar.a libio.a libutil.a libcompat.a - -LIBTAR_TESTS = \ - test_tar_ustar0 test_tar_ustar1 test_tar_ustar2 test_tar_ustar3 \ - test_tar_ustar4 test_tar_ustar5 test_tar_ustar6 \ - test_tar_pax0 test_tar_pax1 test_tar_pax2 test_tar_pax3 test_tar_pax4 \ - test_tar_pax5 \ - test_tar_gnu0 test_tar_gnu1 test_tar_gnu2 test_tar_gnu3 test_tar_gnu4 \ - test_tar_gnu5 test_tar_gnu6 \ - test_tar_sparse_gnu test_tar_sparse_gnu0 test_tar_sparse_gnu1 \ - test_tar_sparse_gnu2 test_tar_sparse_gnu3 \ - test_tar_xattr_bsd test_tar_xattr_schily test_tar_xattr_schily_bin \ - test_tar_target_filled - -check_PROGRAMS += $(LIBTAR_TESTS) -TESTS += $(LIBTAR_TESTS) - -noinst_PROGRAMS += tar_fuzz - -EXTRA_DIST += $(TARDATADIR) diff --git a/tests/libtar/data/CREDITS b/tests/libtar/data/CREDITS deleted file mode 100644 index 7a2738f..0000000 --- a/tests/libtar/data/CREDITS +++ /dev/null @@ -1,35 +0,0 @@ -The tar archives in this directory have been obtained from here: - - https://github.com/mgorny/tar-test-inputs - - git commit hash a2110a6 - -This repository was linked in the following article on interoperability of -various different tar programs: - - https://dev.gentoo.org/~mgorny/articles/portability-of-tar-features.html - -The original intention of the example archives was to test various tar programs -for interoperability with each others extensions and format quirks. - -The following have been removed since there is no intention in adding support -for those features: - - - volume-label tests - - multi-volume tests - - longe user + group names - - sun tar samples - - star samples - - file flags tests - -In addition to that, the files in "file-size" are truncated, since we are only -interested in parsing the header. - -The following addtional files have been added: - - xattr/xattr-shily-binary.tar - Created from xattr/xattr-shily.tar by manually patching in a capability - xattr key/value pair. - - tar/format-acceptance/link_filled.tar - Contributed in GitHub issue #64. A tar ball that contains a hard link - where the 100 byte target field is completely filled without containing - a null-terminator. diff --git a/tests/libtar/data/file-size/12-digit.tar b/tests/libtar/data/file-size/12-digit.tar Binary files differdeleted file mode 100644 index a6b3553..0000000 --- a/tests/libtar/data/file-size/12-digit.tar +++ /dev/null diff --git a/tests/libtar/data/file-size/gnu.tar b/tests/libtar/data/file-size/gnu.tar Binary files differdeleted file mode 100644 index aad726f..0000000 --- a/tests/libtar/data/file-size/gnu.tar +++ /dev/null diff --git a/tests/libtar/data/file-size/pax.tar b/tests/libtar/data/file-size/pax.tar Binary files differdeleted file mode 100644 index e391fee..0000000 --- a/tests/libtar/data/file-size/pax.tar +++ /dev/null diff --git a/tests/libtar/data/format-acceptance/gnu-g.tar b/tests/libtar/data/format-acceptance/gnu-g.tar Binary files differdeleted file mode 100644 index a72f60d..0000000 --- a/tests/libtar/data/format-acceptance/gnu-g.tar +++ /dev/null diff --git a/tests/libtar/data/format-acceptance/gnu.tar b/tests/libtar/data/format-acceptance/gnu.tar Binary files differdeleted file mode 100644 index 98e8157..0000000 --- a/tests/libtar/data/format-acceptance/gnu.tar +++ /dev/null diff --git a/tests/libtar/data/format-acceptance/link_filled.tar b/tests/libtar/data/format-acceptance/link_filled.tar Binary files differdeleted file mode 100644 index 9b80f89..0000000 --- a/tests/libtar/data/format-acceptance/link_filled.tar +++ /dev/null diff --git a/tests/libtar/data/format-acceptance/pax.tar b/tests/libtar/data/format-acceptance/pax.tar Binary files differdeleted file mode 100644 index 69a029f..0000000 --- a/tests/libtar/data/format-acceptance/pax.tar +++ /dev/null diff --git a/tests/libtar/data/format-acceptance/ustar-pre-posix.tar b/tests/libtar/data/format-acceptance/ustar-pre-posix.tar Binary files differdeleted file mode 100644 index 4230f5f..0000000 --- a/tests/libtar/data/format-acceptance/ustar-pre-posix.tar +++ /dev/null diff --git a/tests/libtar/data/format-acceptance/ustar.tar b/tests/libtar/data/format-acceptance/ustar.tar Binary files differdeleted file mode 100644 index 9a6d9b3..0000000 --- a/tests/libtar/data/format-acceptance/ustar.tar +++ /dev/null diff --git a/tests/libtar/data/format-acceptance/v7.tar b/tests/libtar/data/format-acceptance/v7.tar Binary files differdeleted file mode 100644 index 5483b4b..0000000 --- a/tests/libtar/data/format-acceptance/v7.tar +++ /dev/null diff --git a/tests/libtar/data/large-mtime/12-digit.tar b/tests/libtar/data/large-mtime/12-digit.tar Binary files differdeleted file mode 100644 index 8202b28..0000000 --- a/tests/libtar/data/large-mtime/12-digit.tar +++ /dev/null diff --git a/tests/libtar/data/large-mtime/gnu.tar b/tests/libtar/data/large-mtime/gnu.tar Binary files differdeleted file mode 100644 index 4e3dda2..0000000 --- a/tests/libtar/data/large-mtime/gnu.tar +++ /dev/null diff --git a/tests/libtar/data/large-mtime/pax.tar b/tests/libtar/data/large-mtime/pax.tar Binary files differdeleted file mode 100644 index 8d32530..0000000 --- a/tests/libtar/data/large-mtime/pax.tar +++ /dev/null diff --git a/tests/libtar/data/long-paths/gnu.tar b/tests/libtar/data/long-paths/gnu.tar Binary files differdeleted file mode 100644 index 4eee731..0000000 --- a/tests/libtar/data/long-paths/gnu.tar +++ /dev/null diff --git a/tests/libtar/data/long-paths/pax.tar b/tests/libtar/data/long-paths/pax.tar Binary files differdeleted file mode 100644 index 1e63e9c..0000000 --- a/tests/libtar/data/long-paths/pax.tar +++ /dev/null diff --git a/tests/libtar/data/long-paths/ustar.tar b/tests/libtar/data/long-paths/ustar.tar Binary files differdeleted file mode 100644 index 812255c..0000000 --- a/tests/libtar/data/long-paths/ustar.tar +++ /dev/null diff --git a/tests/libtar/data/negative-mtime/gnu.tar b/tests/libtar/data/negative-mtime/gnu.tar Binary files differdeleted file mode 100644 index a9b1272..0000000 --- a/tests/libtar/data/negative-mtime/gnu.tar +++ /dev/null diff --git a/tests/libtar/data/negative-mtime/pax.tar b/tests/libtar/data/negative-mtime/pax.tar Binary files differdeleted file mode 100644 index d0b3e6c..0000000 --- a/tests/libtar/data/negative-mtime/pax.tar +++ /dev/null diff --git a/tests/libtar/data/sparse-files/gnu-small.tar b/tests/libtar/data/sparse-files/gnu-small.tar Binary files differdeleted file mode 100644 index 7a1b222..0000000 --- a/tests/libtar/data/sparse-files/gnu-small.tar +++ /dev/null diff --git a/tests/libtar/data/sparse-files/gnu.tar b/tests/libtar/data/sparse-files/gnu.tar Binary files differdeleted file mode 100644 index 3d641a2..0000000 --- a/tests/libtar/data/sparse-files/gnu.tar +++ /dev/null diff --git a/tests/libtar/data/sparse-files/pax-gnu0-0.tar b/tests/libtar/data/sparse-files/pax-gnu0-0.tar Binary files differdeleted file mode 100644 index 628f09e..0000000 --- a/tests/libtar/data/sparse-files/pax-gnu0-0.tar +++ /dev/null diff --git a/tests/libtar/data/sparse-files/pax-gnu0-1.tar b/tests/libtar/data/sparse-files/pax-gnu0-1.tar Binary files differdeleted file mode 100644 index 87e362e..0000000 --- a/tests/libtar/data/sparse-files/pax-gnu0-1.tar +++ /dev/null diff --git a/tests/libtar/data/sparse-files/pax-gnu1-0.tar b/tests/libtar/data/sparse-files/pax-gnu1-0.tar Binary files differdeleted file mode 100644 index edb0ccf..0000000 --- a/tests/libtar/data/sparse-files/pax-gnu1-0.tar +++ /dev/null diff --git a/tests/libtar/data/user-group-largenum/8-digit.tar b/tests/libtar/data/user-group-largenum/8-digit.tar Binary files differdeleted file mode 100644 index a48ea5d..0000000 --- a/tests/libtar/data/user-group-largenum/8-digit.tar +++ /dev/null diff --git a/tests/libtar/data/user-group-largenum/gnu.tar b/tests/libtar/data/user-group-largenum/gnu.tar Binary files differdeleted file mode 100644 index 4c30f57..0000000 --- a/tests/libtar/data/user-group-largenum/gnu.tar +++ /dev/null diff --git a/tests/libtar/data/user-group-largenum/pax.tar b/tests/libtar/data/user-group-largenum/pax.tar Binary files differdeleted file mode 100644 index a9fe54c..0000000 --- a/tests/libtar/data/user-group-largenum/pax.tar +++ /dev/null diff --git a/tests/libtar/data/xattr/acl.tar b/tests/libtar/data/xattr/acl.tar Binary files differdeleted file mode 100644 index a65c0af..0000000 --- a/tests/libtar/data/xattr/acl.tar +++ /dev/null diff --git a/tests/libtar/data/xattr/xattr-libarchive.tar b/tests/libtar/data/xattr/xattr-libarchive.tar Binary files differdeleted file mode 100644 index 3bd6125..0000000 --- a/tests/libtar/data/xattr/xattr-libarchive.tar +++ /dev/null diff --git a/tests/libtar/data/xattr/xattr-schily-binary.tar b/tests/libtar/data/xattr/xattr-schily-binary.tar Binary files differdeleted file mode 100644 index 0312807..0000000 --- a/tests/libtar/data/xattr/xattr-schily-binary.tar +++ /dev/null diff --git a/tests/libtar/data/xattr/xattr-schily.tar b/tests/libtar/data/xattr/xattr-schily.tar Binary files differdeleted file mode 100644 index 1cf525c..0000000 --- a/tests/libtar/data/xattr/xattr-schily.tar +++ /dev/null diff --git a/tests/libtar/tar_big_file.c b/tests/libtar/tar_big_file.c deleted file mode 100644 index deb41f4..0000000 --- a/tests/libtar/tar_big_file.c +++ /dev/null @@ -1,31 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -/* - * tar_big_file.c - * - * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> - */ -#include "config.h" -#include "tar/tar.h" -#include "io/file.h" -#include "util/test.h" - -int main(int argc, char **argv) -{ - tar_header_decoded_t hdr; - istream_t *fp; - (void)argc; (void)argv; - - fp = istream_open_file(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE)); - TEST_NOT_NULL(fp); - TEST_ASSERT(read_header(fp, &hdr) == 0); - TEST_EQUAL_UI(hdr.mode, S_IFREG | 0644); - TEST_EQUAL_UI(hdr.uid, 01750); - TEST_EQUAL_UI(hdr.gid, 01750); - TEST_EQUAL_UI(hdr.actual_size, 8589934592); - TEST_EQUAL_UI(hdr.mtime, 1542959190); - TEST_STR_EQUAL(hdr.name, "big-file.bin"); - TEST_ASSERT(!hdr.unknown_record); - clear_header(&hdr); - sqfs_drop(fp); - return EXIT_SUCCESS; -} diff --git a/tests/libtar/tar_fuzz.c b/tests/libtar/tar_fuzz.c deleted file mode 100644 index 21e6978..0000000 --- a/tests/libtar/tar_fuzz.c +++ /dev/null @@ -1,49 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -/* - * tar_fuzz.c - * - * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> - */ -#include "config.h" - -#include "io/file.h" -#include "tar/tar.h" - -#include <stdlib.h> -#include <stdio.h> - -int main(int argc, char **argv) -{ - tar_header_decoded_t hdr; - istream_t *fp; - int ret; - - if (argc != 2) { - fputs("usage: tar_fuzz <tarball>\n", stderr); - return EXIT_FAILURE; - } - - fp = istream_open_file(argv[1]); - if (fp == NULL) - return EXIT_FAILURE; - - for (;;) { - ret = read_header(fp, &hdr); - if (ret > 0) - break; - if (ret < 0) - goto fail; - - ret = istream_skip(fp, hdr.record_size); - - clear_header(&hdr); - if (ret < 0) - goto fail; - } - - sqfs_drop(fp); - return EXIT_SUCCESS; -fail: - sqfs_drop(fp); - return EXIT_FAILURE; -} diff --git a/tests/libtar/tar_simple.c b/tests/libtar/tar_simple.c deleted file mode 100644 index cb38abb..0000000 --- a/tests/libtar/tar_simple.c +++ /dev/null @@ -1,64 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -/* - * tar_simple.c - * - * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> - */ -#include "config.h" -#include "io/file.h" -#include "tar/tar.h" -#include "util/test.h" - -#ifndef TESTUID -#define TESTUID 1000 -#endif - -#ifndef TESTGID -#define TESTGID TESTUID -#endif - -#ifndef TESTFNAME -#define TESTFNAME input.txt -#endif - -#ifndef TESTTS -#define TESTTS 1542905892 -#endif - -#ifdef LONG_NAME_TEST -static const char *fname = -"012345678901234567890123456789/012345678901234567890123456789/" -"012345678901234567890123456789/012345678901234567890123456789/" -"012345678901234567890123456789/input.txt"; -#else -static const char *fname = STRVALUE(TESTFNAME); -#endif - -int main(int argc, char **argv) -{ - tar_header_decoded_t hdr; - char buffer[6]; - sqfs_s64 ts; - istream_t *fp; - (void)argc; (void)argv; - - fp = istream_open_file(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE)); - TEST_NOT_NULL(fp); - TEST_ASSERT(read_header(fp, &hdr) == 0); - TEST_EQUAL_UI(hdr.mode, S_IFREG | 0644); - TEST_EQUAL_UI(hdr.uid, TESTUID); - TEST_EQUAL_UI(hdr.gid, TESTGID); - TEST_EQUAL_UI(hdr.actual_size, 5); - - ts = TESTTS; - TEST_EQUAL_UI(hdr.mtime, ts); - TEST_STR_EQUAL(hdr.name, fname); - TEST_ASSERT(!hdr.unknown_record); - - TEST_ASSERT(istream_read(fp, buffer, 5) == 5); - buffer[5] = '\0'; - TEST_STR_EQUAL(buffer, "test\n"); - clear_header(&hdr); - sqfs_drop(fp); - return EXIT_SUCCESS; -} diff --git a/tests/libtar/tar_sparse.c b/tests/libtar/tar_sparse.c deleted file mode 100644 index 27ce053..0000000 --- a/tests/libtar/tar_sparse.c +++ /dev/null @@ -1,86 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -/* - * tar_sparse.c - * - * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> - */ -#include "config.h" -#include "io/file.h" -#include "tar/tar.h" -#include "util/test.h" - -static void test_case_sparse(const char *path) -{ - tar_header_decoded_t hdr; - sparse_map_t *sparse; - istream_t *fp; - - fp = istream_open_file(path); - TEST_NOT_NULL(fp); - TEST_ASSERT(read_header(fp, &hdr) == 0); - TEST_EQUAL_UI(hdr.mode, S_IFREG | 0644); - TEST_EQUAL_UI(hdr.uid, 01750); - TEST_EQUAL_UI(hdr.gid, 01750); - TEST_EQUAL_UI(hdr.actual_size, 2097152); - TEST_EQUAL_UI(hdr.record_size, 32768); - TEST_STR_EQUAL(hdr.name, "input.bin"); - TEST_ASSERT(!hdr.unknown_record); - - sparse = hdr.sparse; - TEST_NOT_NULL(sparse); - TEST_EQUAL_UI(sparse->offset, 0); - TEST_EQUAL_UI(sparse->count, 4096); - - sparse = sparse->next; - TEST_NOT_NULL(sparse); - TEST_EQUAL_UI(sparse->offset, 262144); - TEST_EQUAL_UI(sparse->count, 4096); - - sparse = sparse->next; - TEST_NOT_NULL(sparse); - TEST_EQUAL_UI(sparse->offset, 524288); - TEST_EQUAL_UI(sparse->count, 4096); - - sparse = sparse->next; - TEST_NOT_NULL(sparse); - TEST_EQUAL_UI(sparse->offset, 786432); - TEST_EQUAL_UI(sparse->count, 4096); - - sparse = sparse->next; - TEST_NOT_NULL(sparse); - TEST_EQUAL_UI(sparse->offset, 1048576); - TEST_EQUAL_UI(sparse->count, 4096); - - sparse = sparse->next; - TEST_NOT_NULL(sparse); - TEST_EQUAL_UI(sparse->offset, 1310720); - TEST_EQUAL_UI(sparse->count, 4096); - - sparse = sparse->next; - TEST_NOT_NULL(sparse); - TEST_EQUAL_UI(sparse->offset, 1572864); - TEST_EQUAL_UI(sparse->count, 4096); - - sparse = sparse->next; - TEST_NOT_NULL(sparse); - TEST_EQUAL_UI(sparse->offset, 1835008); - TEST_EQUAL_UI(sparse->count, 4096); - - sparse = sparse->next; - TEST_NOT_NULL(sparse); - TEST_EQUAL_UI(sparse->offset, 2097152); - TEST_EQUAL_UI(sparse->count, 0); - - sparse = sparse->next; - TEST_NULL(sparse); - - clear_header(&hdr); - sqfs_drop(fp); -} - -int main(int argc, char **argv) -{ - (void)argc; (void)argv; - test_case_sparse( STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE) ); - return EXIT_SUCCESS; -} diff --git a/tests/libtar/tar_sparse_gnu.c b/tests/libtar/tar_sparse_gnu.c deleted file mode 100644 index 19ddd0a..0000000 --- a/tests/libtar/tar_sparse_gnu.c +++ /dev/null @@ -1,52 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -/* - * tar_sparse_gnu.c - * - * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> - */ -#include "config.h" -#include "io/file.h" -#include "tar/tar.h" -#include "util/test.h" - -int main(int argc, char **argv) -{ - tar_header_decoded_t hdr; - sparse_map_t *sparse; - istream_t *fp; - (void)argc; (void)argv; - - TEST_ASSERT(chdir(TEST_PATH) == 0); - - fp = istream_open_file("sparse-files/gnu-small.tar"); - TEST_NOT_NULL(fp); - TEST_ASSERT(read_header(fp, &hdr) == 0); - TEST_EQUAL_UI(hdr.mode, S_IFREG | 0644); - TEST_EQUAL_UI(hdr.uid, 01750); - TEST_EQUAL_UI(hdr.gid, 01750); - TEST_EQUAL_UI(hdr.actual_size, 524288); - TEST_EQUAL_UI(hdr.record_size, 8192); - TEST_STR_EQUAL(hdr.name, "input.bin"); - TEST_ASSERT(!hdr.unknown_record); - - sparse = hdr.sparse; - TEST_NOT_NULL(sparse); - TEST_EQUAL_UI(sparse->offset, 0); - TEST_EQUAL_UI(sparse->count, 4096); - - sparse = sparse->next; - TEST_NOT_NULL(sparse); - TEST_EQUAL_UI(sparse->offset, 262144); - TEST_EQUAL_UI(sparse->count, 4096); - - sparse = sparse->next; - TEST_NOT_NULL(sparse); - TEST_EQUAL_UI(sparse->offset, 524288); - TEST_EQUAL_UI(sparse->count, 0); - - TEST_NULL(sparse->next); - - clear_header(&hdr); - sqfs_drop(fp); - return EXIT_SUCCESS; -} diff --git a/tests/libtar/tar_target_filled.c b/tests/libtar/tar_target_filled.c deleted file mode 100644 index abc6a47..0000000 --- a/tests/libtar/tar_target_filled.c +++ /dev/null @@ -1,109 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -/* - * tar_target_filled.c - * - * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> - */ -#include "config.h" -#include "io/file.h" -#include "tar/tar.h" -#include "util/test.h" - -int main(int argc, char **argv) -{ - tar_header_decoded_t hdr; - char buffer[16]; - istream_t *fp; - (void)argc; (void)argv; - - TEST_ASSERT(chdir(TEST_PATH) == 0); - - fp = istream_open_file("format-acceptance/link_filled.tar"); - TEST_NOT_NULL(fp); - - /* "deep" directory hierarchy containg 2 files */ - TEST_ASSERT(read_header(fp, &hdr) == 0); - TEST_EQUAL_UI(hdr.mode, S_IFDIR | 0777); - TEST_STR_EQUAL(hdr.name, "20_characters_here01/"); - clear_header(&hdr); - - TEST_ASSERT(read_header(fp, &hdr) == 0); - TEST_EQUAL_UI(hdr.mode, S_IFDIR | 0777); - TEST_STR_EQUAL(hdr.name, "20_characters_here01/20_characters_here02/"); - clear_header(&hdr); - - TEST_ASSERT(read_header(fp, &hdr) == 0); - TEST_EQUAL_UI(hdr.mode, S_IFDIR | 0777); - TEST_STR_EQUAL(hdr.name, "20_characters_here01/20_characters_here02/" - "20_characters_here03/"); - clear_header(&hdr); - - TEST_ASSERT(read_header(fp, &hdr) == 0); - TEST_EQUAL_UI(hdr.mode, S_IFDIR | 0777); - TEST_STR_EQUAL(hdr.name, "20_characters_here01/20_characters_here02/" - "20_characters_here03/20_characters_here04/"); - clear_header(&hdr); - - TEST_ASSERT(read_header(fp, &hdr) == 0); - TEST_EQUAL_UI(hdr.mode, S_IFREG | 0777); - TEST_STR_EQUAL(hdr.name, "20_characters_here01/20_characters_here02/" - "20_characters_here03/20_characters_here04/" - "errored_file_tst"); - TEST_EQUAL_UI(hdr.actual_size, 5); - TEST_ASSERT(istream_read(fp, buffer, 5) == 5); - buffer[5] = '\0'; - TEST_STR_EQUAL(buffer, "test\n"); - TEST_ASSERT(skip_padding(fp, 5) == 0); - clear_header(&hdr); - - TEST_ASSERT(read_header(fp, &hdr) == 0); - TEST_EQUAL_UI(hdr.mode, S_IFREG | 0777); - TEST_STR_EQUAL(hdr.name, "20_characters_here01/20_characters_here02/" - "20_characters_here03/20_characters_here04/" - "some_test_file"); - TEST_EQUAL_UI(hdr.actual_size, 5); - TEST_ASSERT(istream_read(fp, buffer, 5) == 5); - buffer[5] = '\0'; - TEST_STR_EQUAL(buffer, "test\n"); - TEST_ASSERT(skip_padding(fp, 5) == 0); - clear_header(&hdr); - - /* "deep" directory hierarchy containg a hard link */ - TEST_ASSERT(read_header(fp, &hdr) == 0); - TEST_EQUAL_UI(hdr.mode, S_IFDIR | 0777); - TEST_STR_EQUAL(hdr.name, "20CharsForLnkTest001/"); - clear_header(&hdr); - - TEST_ASSERT(read_header(fp, &hdr) == 0); - TEST_EQUAL_UI(hdr.mode, S_IFDIR | 0777); - TEST_STR_EQUAL(hdr.name, "20CharsForLnkTest001/20CharsForLnkTest002/"); - clear_header(&hdr); - - TEST_ASSERT(read_header(fp, &hdr) == 0); - TEST_EQUAL_UI(hdr.mode, S_IFDIR | 0777); - TEST_STR_EQUAL(hdr.name, "20CharsForLnkTest001/20CharsForLnkTest002/" - "20CharsForLnkTest003/"); - clear_header(&hdr); - - TEST_ASSERT(read_header(fp, &hdr) == 0); - TEST_EQUAL_UI(hdr.mode, S_IFDIR | 0777); - TEST_STR_EQUAL(hdr.name, "20CharsForLnkTest001/20CharsForLnkTest002/" - "20CharsForLnkTest003/20CharsForLnkTest004/"); - clear_header(&hdr); - - TEST_ASSERT(read_header(fp, &hdr) == 0); - TEST_STR_EQUAL(hdr.name, "20CharsForLnkTest001/20CharsForLnkTest002/" - "20CharsForLnkTest003/20CharsForLnkTest004/" - "01234567890123456789"); - TEST_ASSERT(hdr.is_hard_link); - - TEST_STR_EQUAL(hdr.link_target, "20_characters_here01/" - "20_characters_here02/20_characters_here03/" - "20_characters_here04/errored_file_tst"); - clear_header(&hdr); - - /* end of file */ - TEST_ASSERT(read_header(fp, &hdr) > 0); - sqfs_drop(fp); - return EXIT_SUCCESS; -} diff --git a/tests/libtar/tar_xattr.c b/tests/libtar/tar_xattr.c deleted file mode 100644 index 122d1db..0000000 --- a/tests/libtar/tar_xattr.c +++ /dev/null @@ -1,42 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -/* - * tar_xattr.c - * - * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> - */ -#include "config.h" -#include "io/file.h" -#include "tar/tar.h" -#include "util/test.h" - -int main(int argc, char **argv) -{ - tar_header_decoded_t hdr; - char buffer[6]; - istream_t *fp; - (void)argc; (void)argv; - - fp = istream_open_file(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE)); - TEST_NOT_NULL(fp); - TEST_ASSERT(read_header(fp, &hdr) == 0); - TEST_EQUAL_UI(hdr.mode, S_IFREG | 0644); - TEST_EQUAL_UI(hdr.uid, 01750); - TEST_EQUAL_UI(hdr.gid, 01750); - TEST_EQUAL_UI(hdr.actual_size, 5); - TEST_EQUAL_UI(hdr.mtime, 1543094477); - TEST_STR_EQUAL(hdr.name, "input.txt"); - TEST_ASSERT(!hdr.unknown_record); - TEST_ASSERT(istream_read(fp, buffer, 5) == 5); - buffer[5] = '\0'; - TEST_STR_EQUAL(buffer, "test\n"); - - TEST_NOT_NULL(hdr.xattr); - TEST_STR_EQUAL(hdr.xattr->key, "user.mime_type"); - TEST_STR_EQUAL((const char *)hdr.xattr->value, "text/plain"); - TEST_EQUAL_UI(hdr.xattr->value_len, 10); - TEST_NULL(hdr.xattr->next); - - clear_header(&hdr); - sqfs_drop(fp); - return EXIT_SUCCESS; -} diff --git a/tests/libtar/tar_xattr_bin.c b/tests/libtar/tar_xattr_bin.c deleted file mode 100644 index 90443a1..0000000 --- a/tests/libtar/tar_xattr_bin.c +++ /dev/null @@ -1,50 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -/* - * tar_xattr_bin.c - * - * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> - */ -#include "config.h" -#include "io/file.h" -#include "tar/tar.h" -#include "util/test.h" - -static const uint8_t value[] = { - 0x00, 0x00, 0x00, 0x02, - 0x00, 0x30, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, -}; - -int main(int argc, char **argv) -{ - tar_header_decoded_t hdr; - char buffer[6]; - istream_t *fp; - (void)argc; (void)argv; - - fp = istream_open_file(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE)); - TEST_NOT_NULL(fp); - TEST_ASSERT(read_header(fp, &hdr) == 0); - TEST_EQUAL_UI(hdr.mode, S_IFREG | 0644); - TEST_EQUAL_UI(hdr.uid, 01750); - TEST_EQUAL_UI(hdr.gid, 01750); - TEST_EQUAL_UI(hdr.actual_size, 5); - TEST_EQUAL_UI(hdr.mtime, 1543094477); - TEST_STR_EQUAL(hdr.name, "input.txt"); - TEST_ASSERT(!hdr.unknown_record); - TEST_ASSERT(istream_read(fp, buffer, 5) == 5); - buffer[5] = '\0'; - TEST_STR_EQUAL(buffer, "test\n"); - - TEST_NOT_NULL(hdr.xattr); - TEST_STR_EQUAL(hdr.xattr->key, "security.capability"); - TEST_EQUAL_UI(hdr.xattr->value_len, sizeof(value)); - TEST_ASSERT(memcmp(hdr.xattr->value, value, sizeof(value)) == 0); - TEST_NULL(hdr.xattr->next); - - clear_header(&hdr); - sqfs_drop(fp); - return EXIT_SUCCESS; -} |