From 7c4b2a289cab34e4ec1b966663530a7babf08707 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sat, 31 Oct 2020 21:31:39 +0100 Subject: Backport changes to the test setup Signed-off-by: David Oberhollenzer --- .travis.yml | 4 ++-- tests/Makemodule.am | 55 ++++++++++++++++++++++------------------------- tests/fstree_from_file.c | 5 ----- tests/str_table.c | 5 ----- tests/tar_big_file.c | 4 +++- tests/tar_simple.c | 4 +++- tests/tar_sparse.c | 4 +++- tests/tar_sparse_gnu.c | 4 +++- tests/tar_target_filled.c | 4 +++- tests/tar_xattr.c | 4 +++- tests/tar_xattr_bin.c | 4 +++- tests/test.h | 5 +++++ tests/test_tar.h | 19 ---------------- 13 files changed, 54 insertions(+), 67 deletions(-) delete mode 100644 tests/test_tar.h diff --git a/.travis.yml b/.travis.yml index dac0584..e277ff3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,10 +3,10 @@ language: c addons: apt: packages: - - libzstd-dev liblzo2-dev liblz4-dev lzma-dev zlib1g-dev libreadline-dev + - libzstd-dev liblzo2-dev liblz4-dev lzma-dev zlib1g-dev libreadline-dev libbz2-dev homebrew: packages: - - zstd lzo lz4 xz zlib readline + - zstd lzo lz4 xz zlib bzip2 readline script: - ./autogen.sh diff --git a/tests/Makemodule.am b/tests/Makemodule.am index 4937b65..e1a3a26 100644 --- a/tests/Makemodule.am +++ b/tests/Makemodule.am @@ -61,164 +61,161 @@ test_filename_sane_w32_SOURCES = tests/filename_sane.c test_filename_sane_w32_SOURCES += lib/fstree/filename_sane.c test_filename_sane_w32_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_WIN32=1 -test_tar_gnu0_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h +test_tar_gnu0_SOURCES = tests/tar_simple.c tests/test.h test_tar_gnu0_LDADD = libtar.a libcompat.a test_tar_gnu0_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_gnu0_CPPFLAGS += -DTESTFILE=format-acceptance/gnu.tar -test_tar_gnu1_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h +test_tar_gnu1_SOURCES = tests/tar_simple.c tests/test.h test_tar_gnu1_LDADD = libtar.a libcompat.a test_tar_gnu1_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_gnu1_CPPFLAGS += -DTESTFILE=format-acceptance/gnu-g.tar -test_tar_gnu2_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h +test_tar_gnu2_SOURCES = tests/tar_simple.c tests/test.h test_tar_gnu2_LDADD = libtar.a libcompat.a test_tar_gnu2_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar 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/tar_simple.c tests/test.h tests/test_tar.h +test_tar_gnu3_SOURCES = tests/tar_simple.c tests/test.h test_tar_gnu3_LDADD = libtar.a libcompat.a test_tar_gnu3_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_gnu3_CPPFLAGS += -DTESTFILE=negative-mtime/gnu.tar -DTESTTS=-315622800 -test_tar_gnu4_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h +test_tar_gnu4_SOURCES = tests/tar_simple.c tests/test.h test_tar_gnu4_LDADD = libtar.a libcompat.a test_tar_gnu4_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_gnu4_CPPFLAGS += -DTESTFILE=long-paths/gnu.tar -DLONG_NAME_TEST test_tar_gnu4_CPPFLAGS += -DTESTTS=1542909670 -test_tar_gnu5_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h +test_tar_gnu5_SOURCES = tests/tar_simple.c tests/test.h test_tar_gnu5_LDADD = libtar.a libcompat.a test_tar_gnu5_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_gnu5_CPPFLAGS += -DTESTFILE=large-mtime/gnu.tar -DTESTTS=8589934592L -test_tar_gnu6_SOURCES = tests/tar_big_file.c tests/test.h tests/test_tar.h +test_tar_gnu6_SOURCES = tests/tar_big_file.c tests/test.h test_tar_gnu6_LDADD = libtar.a libcompat.a test_tar_gnu6_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_gnu6_CPPFLAGS += -DTESTFILE=file-size/gnu.tar -test_tar_pax0_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h +test_tar_pax0_SOURCES = tests/tar_simple.c tests/test.h test_tar_pax0_LDADD = libtar.a libcompat.a test_tar_pax0_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_pax0_CPPFLAGS += -DTESTFILE=format-acceptance/pax.tar -test_tar_pax1_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h +test_tar_pax1_SOURCES = tests/tar_simple.c tests/test.h test_tar_pax1_LDADD = libtar.a libcompat.a test_tar_pax1_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar 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/tar_simple.c tests/test.h tests/test_tar.h +test_tar_pax2_SOURCES = tests/tar_simple.c tests/test.h test_tar_pax2_LDADD = libtar.a libcompat.a test_tar_pax2_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_pax2_CPPFLAGS += -DTESTFILE=large-mtime/pax.tar -DTESTTS=8589934592L -test_tar_pax3_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h +test_tar_pax3_SOURCES = tests/tar_simple.c tests/test.h test_tar_pax3_LDADD = libtar.a libcompat.a test_tar_pax3_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_pax3_CPPFLAGS += -DTESTFILE=negative-mtime/pax.tar -DTESTTS=-315622800 -test_tar_pax4_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h +test_tar_pax4_SOURCES = tests/tar_simple.c tests/test.h test_tar_pax4_LDADD = libtar.a libcompat.a test_tar_pax4_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_pax4_CPPFLAGS += -DTESTFILE=long-paths/pax.tar test_tar_pax4_CPPFLAGS += -DLONG_NAME_TEST -DTESTTS=1542909670 -test_tar_pax5_SOURCES = tests/tar_big_file.c tests/test.h tests/test_tar.h +test_tar_pax5_SOURCES = tests/tar_big_file.c tests/test.h test_tar_pax5_LDADD = libtar.a libcompat.a test_tar_pax5_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_pax5_CPPFLAGS += -DTESTFILE=file-size/pax.tar -test_tar_ustar0_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h +test_tar_ustar0_SOURCES = tests/tar_simple.c tests/test.h test_tar_ustar0_LDADD = libtar.a libcompat.a test_tar_ustar0_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_ustar0_CPPFLAGS += -DTESTFILE=format-acceptance/ustar.tar -test_tar_ustar1_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h +test_tar_ustar1_SOURCES = tests/tar_simple.c tests/test.h test_tar_ustar1_LDADD = libtar.a libcompat.a test_tar_ustar1_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_ustar1_CPPFLAGS += -DTESTFILE=format-acceptance/ustar-pre-posix.tar -test_tar_ustar2_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h +test_tar_ustar2_SOURCES = tests/tar_simple.c tests/test.h test_tar_ustar2_LDADD = libtar.a libcompat.a test_tar_ustar2_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_ustar2_CPPFLAGS += -DTESTFILE=format-acceptance/v7.tar -test_tar_ustar3_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h +test_tar_ustar3_SOURCES = tests/tar_simple.c tests/test.h test_tar_ustar3_LDADD = libtar.a libcompat.a test_tar_ustar3_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar 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/tar_simple.c tests/test.h tests/test_tar.h +test_tar_ustar4_SOURCES = tests/tar_simple.c tests/test.h test_tar_ustar4_LDADD = libtar.a libcompat.a test_tar_ustar4_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_ustar4_CPPFLAGS += -DTESTFILE=large-mtime/12-digit.tar test_tar_ustar4_CPPFLAGS += -DTESTTS=8589934592L -test_tar_ustar5_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h +test_tar_ustar5_SOURCES = tests/tar_simple.c tests/test.h test_tar_ustar5_LDADD = libtar.a libcompat.a test_tar_ustar5_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_ustar5_CPPFLAGS += -DTESTFILE=long-paths/ustar.tar test_tar_ustar5_CPPFLAGS += -DLONG_NAME_TEST -DTESTTS=1542909670 -test_tar_ustar6_SOURCES = tests/tar_big_file.c tests/test.h tests/test_tar.h +test_tar_ustar6_SOURCES = tests/tar_big_file.c tests/test.h test_tar_ustar6_LDADD = libtar.a libcompat.a test_tar_ustar6_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_ustar6_CPPFLAGS += -DTESTFILE=file-size/12-digit.tar test_tar_target_filled_SOURCES = tests/tar_target_filled.c tests/test.h -test_tar_target_filled_SOURCES += tests/test_tar.h test_tar_target_filled_LDADD = libtar.a libcompat.a test_tar_target_filled_CPPFLAGS = $(AM_CPPFLAGS) test_tar_target_filled_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar test_tar_sparse_gnu_SOURCES = tests/tar_sparse_gnu.c tests/test.h -test_tar_sparse_gnu_SOURCES += tests/test_tar.h test_tar_sparse_gnu_LDADD = libtar.a libcompat.a test_tar_sparse_gnu_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar -test_tar_sparse_gnu0_SOURCES = tests/tar_sparse.c tests/test.h tests/test_tar.h +test_tar_sparse_gnu0_SOURCES = tests/tar_sparse.c tests/test.h test_tar_sparse_gnu0_LDADD = libtar.a libcompat.a test_tar_sparse_gnu0_CPPFLAGS = $(AM_CPPFLAGS) test_tar_sparse_gnu0_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar test_tar_sparse_gnu0_CPPFLAGS += -DTESTFILE=sparse-files/pax-gnu0-0.tar -test_tar_sparse_gnu1_SOURCES = tests/tar_sparse.c tests/test.h tests/test_tar.h +test_tar_sparse_gnu1_SOURCES = tests/tar_sparse.c tests/test.h test_tar_sparse_gnu1_LDADD = libtar.a libcompat.a test_tar_sparse_gnu1_CPPFLAGS = $(AM_CPPFLAGS) test_tar_sparse_gnu1_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar test_tar_sparse_gnu1_CPPFLAGS += -DTESTFILE=sparse-files/pax-gnu0-1.tar -test_tar_sparse_gnu2_SOURCES = tests/tar_sparse.c tests/test.h tests/test_tar.h +test_tar_sparse_gnu2_SOURCES = tests/tar_sparse.c tests/test.h test_tar_sparse_gnu2_LDADD = libtar.a libcompat.a test_tar_sparse_gnu2_CPPFLAGS = $(AM_CPPFLAGS) test_tar_sparse_gnu2_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar test_tar_sparse_gnu2_CPPFLAGS += -DTESTFILE=sparse-files/pax-gnu1-0.tar -test_tar_sparse_gnu3_SOURCES = tests/tar_sparse.c tests/test.h tests/test_tar.h +test_tar_sparse_gnu3_SOURCES = tests/tar_sparse.c tests/test.h test_tar_sparse_gnu3_LDADD = libtar.a libcompat.a test_tar_sparse_gnu3_CPPFLAGS = $(AM_CPPFLAGS) test_tar_sparse_gnu3_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar test_tar_sparse_gnu3_CPPFLAGS += -DTESTFILE=sparse-files/gnu.tar -test_tar_xattr_bsd_SOURCES = tests/tar_xattr.c tests/test.h tests/test_tar.h +test_tar_xattr_bsd_SOURCES = tests/tar_xattr.c tests/test.h test_tar_xattr_bsd_LDADD = libtar.a libcompat.a test_tar_xattr_bsd_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_xattr_bsd_CPPFLAGS += -DTESTFILE=xattr/xattr-libarchive.tar -test_tar_xattr_schily_SOURCES = tests/tar_xattr.c tests/test.h tests/test_tar.h +test_tar_xattr_schily_SOURCES = tests/tar_xattr.c tests/test.h test_tar_xattr_schily_LDADD = libtar.a libcompat.a test_tar_xattr_schily_CPPFLAGS = $(AM_CPPFLAGS) test_tar_xattr_schily_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar test_tar_xattr_schily_CPPFLAGS += -DTESTFILE=xattr/xattr-schily.tar test_tar_xattr_schily_bin_SOURCES = tests/tar_xattr_bin.c tests/test.h -test_tar_xattr_schily_bin_SOURCES += tests/test_tar.h test_tar_xattr_schily_bin_LDADD = libtar.a libcompat.a test_tar_xattr_schily_bin_CPPFLAGS = $(AM_CPPFLAGS) test_tar_xattr_schily_bin_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar diff --git a/tests/fstree_from_file.c b/tests/fstree_from_file.c index c00cabf..2ad6985 100644 --- a/tests/fstree_from_file.c +++ b/tests/fstree_from_file.c @@ -9,11 +9,6 @@ #include "fstree.h" #include "test.h" -#define STR(x) #x -#define STRVALUE(x) STR(x) - -#define TEST_PATH STRVALUE(TESTPATH) - int main(void) { tree_node_t *n; diff --git a/tests/str_table.c b/tests/str_table.c index 0935c89..e185cec 100644 --- a/tests/str_table.c +++ b/tests/str_table.c @@ -10,11 +10,6 @@ #include "compat.h" #include "test.h" -#define STR(x) #x -#define STRVALUE(x) STR(x) - -#define TEST_PATH STRVALUE(TESTPATH) - static char *strings[1000]; static int read_strings(void) diff --git a/tests/tar_big_file.c b/tests/tar_big_file.c index b949f60..5f10330 100644 --- a/tests/tar_big_file.c +++ b/tests/tar_big_file.c @@ -4,7 +4,9 @@ * * Copyright (C) 2019 David Oberhollenzer */ -#include "test_tar.h" +#include "config.h" +#include "tar.h" +#include "test.h" int main(void) { diff --git a/tests/tar_simple.c b/tests/tar_simple.c index 02bd521..84c8397 100644 --- a/tests/tar_simple.c +++ b/tests/tar_simple.c @@ -4,7 +4,9 @@ * * Copyright (C) 2019 David Oberhollenzer */ -#include "test_tar.h" +#include "config.h" +#include "tar.h" +#include "test.h" #ifndef TESTUID #define TESTUID 1000 diff --git a/tests/tar_sparse.c b/tests/tar_sparse.c index 50940d0..4060aef 100644 --- a/tests/tar_sparse.c +++ b/tests/tar_sparse.c @@ -4,7 +4,9 @@ * * Copyright (C) 2019 David Oberhollenzer */ -#include "test_tar.h" +#include "config.h" +#include "tar.h" +#include "test.h" static void test_case_sparse(const char *path) { diff --git a/tests/tar_sparse_gnu.c b/tests/tar_sparse_gnu.c index 216a54a..b398462 100644 --- a/tests/tar_sparse_gnu.c +++ b/tests/tar_sparse_gnu.c @@ -4,7 +4,9 @@ * * Copyright (C) 2019 David Oberhollenzer */ -#include "test_tar.h" +#include "config.h" +#include "tar.h" +#include "test.h" int main(void) { diff --git a/tests/tar_target_filled.c b/tests/tar_target_filled.c index 4098b39..cfad71c 100644 --- a/tests/tar_target_filled.c +++ b/tests/tar_target_filled.c @@ -4,7 +4,9 @@ * * Copyright (C) 2019 David Oberhollenzer */ -#include "test_tar.h" +#include "config.h" +#include "tar.h" +#include "test.h" int main(void) { diff --git a/tests/tar_xattr.c b/tests/tar_xattr.c index 179af2e..67660fa 100644 --- a/tests/tar_xattr.c +++ b/tests/tar_xattr.c @@ -4,7 +4,9 @@ * * Copyright (C) 2019 David Oberhollenzer */ -#include "test_tar.h" +#include "config.h" +#include "tar.h" +#include "test.h" int main(void) { diff --git a/tests/tar_xattr_bin.c b/tests/tar_xattr_bin.c index ca0f918..36e97cf 100644 --- a/tests/tar_xattr_bin.c +++ b/tests/tar_xattr_bin.c @@ -4,7 +4,9 @@ * * Copyright (C) 2019 David Oberhollenzer */ -#include "test_tar.h" +#include "config.h" +#include "tar.h" +#include "test.h" static const uint8_t value[] = { 0x00, 0x00, 0x00, 0x02, diff --git a/tests/test.h b/tests/test.h index 7d38fd0..bc3ac92 100644 --- a/tests/test.h +++ b/tests/test.h @@ -13,6 +13,11 @@ #include #include +#define STR(x) #x +#define STRVALUE(x) STR(x) + +#define TEST_PATH STRVALUE(TESTPATH) + #if defined(__GNUC__) || defined(__clang__) # define ATTRIB_UNUSED __attribute__ ((unused)) #else diff --git a/tests/test_tar.h b/tests/test_tar.h deleted file mode 100644 index 9ec2b12..0000000 --- a/tests/test_tar.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -/* - * test_tar.h - * - * Copyright (C) 2019 David Oberhollenzer - */ -#ifndef TEST_TAR_H -#define TEST_TAR_H - -#include "config.h" -#include "tar.h" -#include "test.h" - -#define STR(x) #x -#define STRVALUE(x) STR(x) - -#define TEST_PATH STRVALUE(TESTPATH) - -#endif /* TEST_TAR_H */ -- cgit v1.2.3