From 86a947b9446b9b5d881d1a974cfe1bcde9d08f2f Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sat, 2 Jul 2022 20:40:41 +0200 Subject: Cleanup: move test.h to libutil Signed-off-by: David Oberhollenzer --- tests/libfstree/Makemodule.am | 24 ++++--- tests/libfstree/add_by_path.c | 2 +- tests/libfstree/canonicalize_name.c | 2 +- tests/libfstree/epoch.c | 2 +- tests/libfstree/filename_sane.c | 2 +- tests/libfstree/fstree_from_dir.c | 2 +- tests/libfstree/fstree_from_file.c | 2 +- tests/libfstree/fstree_glob1.c | 2 +- tests/libfstree/fstree_init.c | 2 +- tests/libfstree/fstree_sort.c | 2 +- tests/libfstree/gen_inode_numbers.c | 2 +- tests/libfstree/get_path.c | 2 +- tests/libfstree/mknode_dir.c | 2 +- tests/libfstree/mknode_reg.c | 2 +- tests/libfstree/mknode_simple.c | 2 +- tests/libfstree/mknode_slink.c | 2 +- tests/libfstree/sort_file.c | 2 +- tests/libio/Makemodule.am | 16 ++--- tests/libio/get_line.c | 2 +- tests/libio/uncompress.c | 2 +- tests/libsqfs/Makemodule.am | 6 +- tests/libsqfs/abi.c | 2 +- tests/libsqfs/table.c | 2 +- tests/libsqfs/xattr_writer.c | 2 +- tests/libtar/Makemodule.am | 58 ++++++++--------- tests/libtar/tar_big_file.c | 2 +- tests/libtar/tar_simple.c | 2 +- tests/libtar/tar_sparse.c | 2 +- tests/libtar/tar_sparse_gnu.c | 2 +- tests/libtar/tar_target_filled.c | 2 +- tests/libtar/tar_xattr.c | 2 +- tests/libtar/tar_xattr_bin.c | 2 +- tests/libutil/Makemodule.am | 4 +- tests/libutil/is_memory_zero.c | 2 +- tests/libutil/rbtree.c | 2 +- tests/libutil/str_table.c | 2 +- tests/libutil/threadpool.c | 2 +- tests/libutil/xxhash.c | 2 +- tests/test.h | 125 ------------------------------------ 39 files changed, 86 insertions(+), 213 deletions(-) delete mode 100644 tests/test.h (limited to 'tests') diff --git a/tests/libfstree/Makemodule.am b/tests/libfstree/Makemodule.am index 6b45ece..a79d670 100644 --- a/tests/libfstree/Makemodule.am +++ b/tests/libfstree/Makemodule.am @@ -1,50 +1,48 @@ FSTDATADIR=$(top_srcdir)/tests/libfstree test_canonicalize_name_SOURCES = tests/libfstree/canonicalize_name.c -test_canonicalize_name_SOURCES += tests/test.h test_canonicalize_name_LDADD = libfstree.a libcompat.a -test_mknode_simple_SOURCES = tests/libfstree/mknode_simple.c tests/test.h +test_mknode_simple_SOURCES = tests/libfstree/mknode_simple.c test_mknode_simple_LDADD = libfstree.a libcompat.a -test_mknode_slink_SOURCES = tests/libfstree/mknode_slink.c tests/test.h +test_mknode_slink_SOURCES = tests/libfstree/mknode_slink.c test_mknode_slink_LDADD = libfstree.a libcompat.a -test_mknode_reg_SOURCES = tests/libfstree/mknode_reg.c tests/test.h +test_mknode_reg_SOURCES = tests/libfstree/mknode_reg.c test_mknode_reg_LDADD = libfstree.a libcompat.a -test_mknode_dir_SOURCES = tests/libfstree/mknode_dir.c tests/test.h +test_mknode_dir_SOURCES = tests/libfstree/mknode_dir.c test_mknode_dir_LDADD = libfstree.a libcompat.a test_gen_inode_numbers_SOURCES = tests/libfstree/gen_inode_numbers.c -test_gen_inode_numbers_SOURCES += tests/test.h test_gen_inode_numbers_LDADD = libfstree.a libcompat.a -test_add_by_path_SOURCES = tests/libfstree/add_by_path.c tests/test.h +test_add_by_path_SOURCES = tests/libfstree/add_by_path.c test_add_by_path_LDADD = libfstree.a libcompat.a -test_get_path_SOURCES = tests/libfstree/get_path.c tests/test.h +test_get_path_SOURCES = tests/libfstree/get_path.c test_get_path_LDADD = libfstree.a libcompat.a -test_fstree_sort_SOURCES = tests/libfstree/fstree_sort.c tests/test.h +test_fstree_sort_SOURCES = tests/libfstree/fstree_sort.c test_fstree_sort_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/lib/fstree test_fstree_sort_LDADD = libfstree.a libio.a libcompat.a -test_fstree_from_file_SOURCES = tests/libfstree/fstree_from_file.c tests/test.h +test_fstree_from_file_SOURCES = tests/libfstree/fstree_from_file.c test_fstree_from_file_CPPFLAGS = $(AM_CPPFLAGS) test_fstree_from_file_CPPFLAGS += -DTESTPATH=$(FSTDATADIR)/fstree1.txt test_fstree_from_file_LDADD = libfstree.a libio.a libcompat.a -test_fstree_glob1_SOURCES = tests/libfstree/fstree_glob1.c tests/test.h +test_fstree_glob1_SOURCES = tests/libfstree/fstree_glob1.c test_fstree_glob1_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(FSTDATADIR) test_fstree_glob1_LDADD = libfstree.a libio.a libcompat.a -test_fstree_from_dir_SOURCES = tests/libfstree/fstree_from_dir.c tests/test.h +test_fstree_from_dir_SOURCES = tests/libfstree/fstree_from_dir.c test_fstree_from_dir_CPPFLAGS = $(AM_CPPFLAGS) test_fstree_from_dir_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/libtar/data test_fstree_from_dir_LDADD = libfstree.a libcompat.a -test_fstree_init_SOURCES = tests/libfstree/fstree_init.c tests/test.h +test_fstree_init_SOURCES = tests/libfstree/fstree_init.c test_fstree_init_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/lib/fstree test_fstree_init_LDADD = libfstree.a libio.a libcompat.a diff --git a/tests/libfstree/add_by_path.c b/tests/libfstree/add_by_path.c index b21c696..97e5a60 100644 --- a/tests/libfstree/add_by_path.c +++ b/tests/libfstree/add_by_path.c @@ -7,7 +7,7 @@ #include "config.h" #include "fstree.h" -#include "../test.h" +#include "util/test.h" int main(int argc, char **argv) { diff --git a/tests/libfstree/canonicalize_name.c b/tests/libfstree/canonicalize_name.c index f1eb1c1..f117a0d 100644 --- a/tests/libfstree/canonicalize_name.c +++ b/tests/libfstree/canonicalize_name.c @@ -6,7 +6,7 @@ */ #include "config.h" #include "fstree.h" -#include "../test.h" +#include "util/test.h" static const struct { const char *in; diff --git a/tests/libfstree/epoch.c b/tests/libfstree/epoch.c index 354a33f..ce7e120 100644 --- a/tests/libfstree/epoch.c +++ b/tests/libfstree/epoch.c @@ -6,7 +6,7 @@ */ #include "config.h" #include "internal.h" -#include "../test.h" +#include "util/test.h" #if defined(_WIN32) || defined(__WINDOWS__) static void setenv(const char *key, const char *value, int overwrite) diff --git a/tests/libfstree/filename_sane.c b/tests/libfstree/filename_sane.c index 11f27da..a1dc79c 100644 --- a/tests/libfstree/filename_sane.c +++ b/tests/libfstree/filename_sane.c @@ -6,7 +6,7 @@ */ #include "config.h" #include "fstree.h" -#include "../test.h" +#include "util/test.h" static const char *must_work[] = { "foobar", diff --git a/tests/libfstree/fstree_from_dir.c b/tests/libfstree/fstree_from_dir.c index 845586f..438e357 100644 --- a/tests/libfstree/fstree_from_dir.c +++ b/tests/libfstree/fstree_from_dir.c @@ -7,7 +7,7 @@ #include "config.h" #include "fstree.h" -#include "../test.h" +#include "util/test.h" static void check_hierarchy(tree_node_t *root, bool recursive) { diff --git a/tests/libfstree/fstree_from_file.c b/tests/libfstree/fstree_from_file.c index 08277e6..184c011 100644 --- a/tests/libfstree/fstree_from_file.c +++ b/tests/libfstree/fstree_from_file.c @@ -7,7 +7,7 @@ #include "config.h" #include "fstree.h" -#include "../test.h" +#include "util/test.h" int main(int argc, char **argv) { diff --git a/tests/libfstree/fstree_glob1.c b/tests/libfstree/fstree_glob1.c index 08e39bd..3aff21a 100644 --- a/tests/libfstree/fstree_glob1.c +++ b/tests/libfstree/fstree_glob1.c @@ -7,7 +7,7 @@ #include "config.h" #include "fstree.h" -#include "../test.h" +#include "util/test.h" static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive) { diff --git a/tests/libfstree/fstree_init.c b/tests/libfstree/fstree_init.c index 5f701cb..92bbc19 100644 --- a/tests/libfstree/fstree_init.c +++ b/tests/libfstree/fstree_init.c @@ -8,7 +8,7 @@ #include "fstree.h" #include "internal.h" -#include "../test.h" +#include "util/test.h" int main(int argc, char **argv) { diff --git a/tests/libfstree/fstree_sort.c b/tests/libfstree/fstree_sort.c index 6db607d..7df85f5 100644 --- a/tests/libfstree/fstree_sort.c +++ b/tests/libfstree/fstree_sort.c @@ -7,7 +7,7 @@ #include "config.h" #include "fstree.h" -#include "../test.h" +#include "util/test.h" int main(int argc, char **argv) { diff --git a/tests/libfstree/gen_inode_numbers.c b/tests/libfstree/gen_inode_numbers.c index eef5678..5403580 100644 --- a/tests/libfstree/gen_inode_numbers.c +++ b/tests/libfstree/gen_inode_numbers.c @@ -7,7 +7,7 @@ #include "config.h" #include "fstree.h" -#include "../test.h" +#include "util/test.h" static tree_node_t *gen_node(tree_node_t *parent, const char *name) { diff --git a/tests/libfstree/get_path.c b/tests/libfstree/get_path.c index 26dd9ea..61001e9 100644 --- a/tests/libfstree/get_path.c +++ b/tests/libfstree/get_path.c @@ -7,7 +7,7 @@ #include "config.h" #include "fstree.h" -#include "../test.h" +#include "util/test.h" int main(int argc, char **argv) { diff --git a/tests/libfstree/mknode_dir.c b/tests/libfstree/mknode_dir.c index 63e01c1..dd7eba7 100644 --- a/tests/libfstree/mknode_dir.c +++ b/tests/libfstree/mknode_dir.c @@ -7,7 +7,7 @@ #include "config.h" #include "fstree.h" -#include "../test.h" +#include "util/test.h" int main(int argc, char **argv) { diff --git a/tests/libfstree/mknode_reg.c b/tests/libfstree/mknode_reg.c index debecd9..368720f 100644 --- a/tests/libfstree/mknode_reg.c +++ b/tests/libfstree/mknode_reg.c @@ -7,7 +7,7 @@ #include "config.h" #include "fstree.h" -#include "../test.h" +#include "util/test.h" int main(int argc, char **argv) { diff --git a/tests/libfstree/mknode_simple.c b/tests/libfstree/mknode_simple.c index 4e8978c..c7efb49 100644 --- a/tests/libfstree/mknode_simple.c +++ b/tests/libfstree/mknode_simple.c @@ -7,7 +7,7 @@ #include "config.h" #include "fstree.h" -#include "../test.h" +#include "util/test.h" int main(int argc, char **argv) { diff --git a/tests/libfstree/mknode_slink.c b/tests/libfstree/mknode_slink.c index 4b23951..c50a0ba 100644 --- a/tests/libfstree/mknode_slink.c +++ b/tests/libfstree/mknode_slink.c @@ -7,7 +7,7 @@ #include "config.h" #include "fstree.h" -#include "../test.h" +#include "util/test.h" int main(int argc, char **argv) { diff --git a/tests/libfstree/sort_file.c b/tests/libfstree/sort_file.c index 686ee68..93d60e0 100644 --- a/tests/libfstree/sort_file.c +++ b/tests/libfstree/sort_file.c @@ -8,7 +8,7 @@ #include "sqfs/block.h" #include "fstree.h" -#include "../test.h" +#include "util/test.h" static const char *listing = "dir /bin 0755 0 0\n" diff --git a/tests/libio/Makemodule.am b/tests/libio/Makemodule.am index 86f2e3a..df2e9d3 100644 --- a/tests/libio/Makemodule.am +++ b/tests/libio/Makemodule.am @@ -1,39 +1,39 @@ -test_get_line_SOURCES = tests/libio/get_line.c tests/test.h +test_get_line_SOURCES = tests/libio/get_line.c test_get_line_LDADD = libio.a libcompat.a test_get_line_CPPFLAGS = $(AM_CPPFLAGS) test_get_line_CPPFLAGS += -DTESTFILE=$(top_srcdir)/tests/libio/get_line.txt -test_xfrm_bzip2_SOURCES = tests/libio/uncompress.c tests/test.h +test_xfrm_bzip2_SOURCES = tests/libio/uncompress.c test_xfrm_bzip2_LDADD = libio.a libcompat.a $(BZIP2_LIBS) $(ZLIB_LIBS) test_xfrm_bzip2_LDADD += $(XZ_LIBS) $(ZSTD_LIBS) test_xfrm_bzip2_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_BZIP2=1 -test_xfrm_bzip22_SOURCES = tests/libio/uncompress.c tests/test.h +test_xfrm_bzip22_SOURCES = tests/libio/uncompress.c test_xfrm_bzip22_LDADD = libio.a libcompat.a $(BZIP2_LIBS) $(ZLIB_LIBS) test_xfrm_bzip22_LDADD += $(XZ_LIBS) $(ZSTD_LIBS) test_xfrm_bzip22_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_BZIP22=1 -test_xfrm_xz_SOURCES = tests/libio/uncompress.c tests/test.h +test_xfrm_xz_SOURCES = tests/libio/uncompress.c test_xfrm_xz_LDADD = libio.a libcompat.a $(BZIP2_LIBS) $(ZLIB_LIBS) test_xfrm_xz_LDADD += $(XZ_LIBS) $(ZSTD_LIBS) test_xfrm_xz_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_XZ=1 -test_xfrm_xz2_SOURCES = tests/libio/uncompress.c tests/test.h +test_xfrm_xz2_SOURCES = tests/libio/uncompress.c test_xfrm_xz2_LDADD = libio.a libcompat.a $(BZIP2_LIBS) $(ZLIB_LIBS) test_xfrm_xz2_LDADD += $(XZ_LIBS) $(ZSTD_LIBS) test_xfrm_xz2_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_XZ2=1 -test_xfrm_gzip_SOURCES = tests/libio/uncompress.c tests/test.h +test_xfrm_gzip_SOURCES = tests/libio/uncompress.c test_xfrm_gzip_LDADD = libio.a libcompat.a $(BZIP2_LIBS) $(ZLIB_LIBS) test_xfrm_gzip_LDADD += $(XZ_LIBS) $(ZSTD_LIBS) test_xfrm_gzip_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_GZIP=1 -test_xfrm_zstd_SOURCES = tests/libio/uncompress.c tests/test.h +test_xfrm_zstd_SOURCES = tests/libio/uncompress.c test_xfrm_zstd_LDADD = libio.a libcompat.a $(BZIP2_LIBS) $(ZLIB_LIBS) test_xfrm_zstd_LDADD += $(XZ_LIBS) $(ZSTD_LIBS) test_xfrm_zstd_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_ZSTD=1 -test_xfrm_zstd2_SOURCES = tests/libio/uncompress.c tests/test.h +test_xfrm_zstd2_SOURCES = tests/libio/uncompress.c test_xfrm_zstd2_LDADD = libio.a libcompat.a $(BZIP2_LIBS) $(ZLIB_LIBS) test_xfrm_zstd2_LDADD += $(XZ_LIBS) $(ZSTD_LIBS) test_xfrm_zstd2_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_ZSTD2=1 diff --git a/tests/libio/get_line.c b/tests/libio/get_line.c index 66fced5..eec53f4 100644 --- a/tests/libio/get_line.c +++ b/tests/libio/get_line.c @@ -7,7 +7,7 @@ #include "config.h" #include "io/file.h" -#include "../test.h" +#include "util/test.h" typedef struct { size_t line_num; diff --git a/tests/libio/uncompress.c b/tests/libio/uncompress.c index 9476877..0b877d8 100644 --- a/tests/libio/uncompress.c +++ b/tests/libio/uncompress.c @@ -6,7 +6,7 @@ */ #include "io/istream.h" #include "io/xfrm.h" -#include "../test.h" +#include "util/test.h" static sqfs_u8 data_in[] = { #if defined(TEST_BZIP2) diff --git a/tests/libsqfs/Makemodule.am b/tests/libsqfs/Makemodule.am index 514571d..ca24caf 100644 --- a/tests/libsqfs/Makemodule.am +++ b/tests/libsqfs/Makemodule.am @@ -1,10 +1,10 @@ -test_abi_SOURCES = tests/libsqfs/abi.c tests/test.h +test_abi_SOURCES = tests/libsqfs/abi.c test_abi_LDADD = libsquashfs.la libcompat.a -test_table_SOURCES = tests/libsqfs/table.c tests/test.h +test_table_SOURCES = tests/libsqfs/table.c test_table_LDADD = libsquashfs.la libcompat.a -test_xattr_writer_SOURCES = tests/libsqfs/xattr_writer.c tests/test.h +test_xattr_writer_SOURCES = tests/libsqfs/xattr_writer.c test_xattr_writer_LDADD = libsquashfs.la libcompat.a xattr_benchmark_SOURCES = tests/libsqfs/xattr_benchmark.c diff --git a/tests/libsqfs/abi.c b/tests/libsqfs/abi.c index 3bdc4f5..0eaf5df 100644 --- a/tests/libsqfs/abi.c +++ b/tests/libsqfs/abi.c @@ -9,7 +9,7 @@ #include "sqfs/block_processor.h" #include "sqfs/compressor.h" #include "sqfs/block.h" -#include "../test.h" +#include "util/test.h" #include diff --git a/tests/libsqfs/table.c b/tests/libsqfs/table.c index 5f240cc..ed373a7 100644 --- a/tests/libsqfs/table.c +++ b/tests/libsqfs/table.c @@ -6,7 +6,7 @@ */ #include "config.h" #include "compat.h" -#include "../test.h" +#include "util/test.h" #include "sqfs/compressor.h" #include "sqfs/error.h" diff --git a/tests/libsqfs/xattr_writer.c b/tests/libsqfs/xattr_writer.c index 6fa0355..dfc8966 100644 --- a/tests/libsqfs/xattr_writer.c +++ b/tests/libsqfs/xattr_writer.c @@ -6,7 +6,7 @@ */ #include "config.h" #include "compat.h" -#include "../test.h" +#include "util/test.h" #include "sqfs/xattr_writer.h" #include "sqfs/compressor.h" diff --git a/tests/libtar/Makemodule.am b/tests/libtar/Makemodule.am index b042f74..145481a 100644 --- a/tests/libtar/Makemodule.am +++ b/tests/libtar/Makemodule.am @@ -1,154 +1,154 @@ TARDATADIR=$(top_srcdir)/tests/libtar/data -test_tar_gnu0_SOURCES = tests/libtar/tar_simple.c tests/test.h +test_tar_gnu0_SOURCES = tests/libtar/tar_simple.c test_tar_gnu0_LDADD = libtar.a libio.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 tests/test.h +test_tar_gnu1_SOURCES = tests/libtar/tar_simple.c test_tar_gnu1_LDADD = libtar.a libio.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 tests/test.h +test_tar_gnu2_SOURCES = tests/libtar/tar_simple.c test_tar_gnu2_LDADD = libtar.a libio.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 tests/test.h +test_tar_gnu3_SOURCES = tests/libtar/tar_simple.c test_tar_gnu3_LDADD = libtar.a libio.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 tests/test.h +test_tar_gnu4_SOURCES = tests/libtar/tar_simple.c test_tar_gnu4_LDADD = libtar.a libio.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 tests/test.h +test_tar_gnu5_SOURCES = tests/libtar/tar_simple.c test_tar_gnu5_LDADD = libtar.a libio.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 tests/test.h +test_tar_gnu6_SOURCES = tests/libtar/tar_big_file.c test_tar_gnu6_LDADD = libtar.a libio.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 tests/test.h +test_tar_pax0_SOURCES = tests/libtar/tar_simple.c test_tar_pax0_LDADD = libtar.a libio.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 tests/test.h +test_tar_pax1_SOURCES = tests/libtar/tar_simple.c test_tar_pax1_LDADD = libtar.a libio.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 tests/test.h +test_tar_pax2_SOURCES = tests/libtar/tar_simple.c test_tar_pax2_LDADD = libtar.a libio.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 tests/test.h +test_tar_pax3_SOURCES = tests/libtar/tar_simple.c test_tar_pax3_LDADD = libtar.a libio.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 tests/test.h +test_tar_pax4_SOURCES = tests/libtar/tar_simple.c test_tar_pax4_LDADD = libtar.a libio.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 tests/test.h +test_tar_pax5_SOURCES = tests/libtar/tar_big_file.c test_tar_pax5_LDADD = libtar.a libio.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 tests/test.h +test_tar_ustar0_SOURCES = tests/libtar/tar_simple.c test_tar_ustar0_LDADD = libtar.a libio.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 tests/test.h +test_tar_ustar1_SOURCES = tests/libtar/tar_simple.c test_tar_ustar1_LDADD = libtar.a libio.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 tests/test.h +test_tar_ustar2_SOURCES = tests/libtar/tar_simple.c test_tar_ustar2_LDADD = libtar.a libio.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 tests/test.h +test_tar_ustar3_SOURCES = tests/libtar/tar_simple.c test_tar_ustar3_LDADD = libtar.a libio.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 tests/test.h +test_tar_ustar4_SOURCES = tests/libtar/tar_simple.c test_tar_ustar4_LDADD = libtar.a libio.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 tests/test.h +test_tar_ustar5_SOURCES = tests/libtar/tar_simple.c test_tar_ustar5_LDADD = libtar.a libio.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 tests/test.h +test_tar_ustar6_SOURCES = tests/libtar/tar_big_file.c test_tar_ustar6_LDADD = libtar.a libio.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 tests/test.h +test_tar_target_filled_SOURCES = tests/libtar/tar_target_filled.c test_tar_target_filled_LDADD = libtar.a libio.a libcompat.a test_tar_target_filled_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_sparse_gnu_SOURCES = tests/libtar/tar_sparse_gnu.c tests/test.h +test_tar_sparse_gnu_SOURCES = tests/libtar/tar_sparse_gnu.c test_tar_sparse_gnu_LDADD = libtar.a libio.a libcompat.a test_tar_sparse_gnu_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) -test_tar_sparse_gnu0_SOURCES = tests/libtar/tar_sparse.c tests/test.h +test_tar_sparse_gnu0_SOURCES = tests/libtar/tar_sparse.c test_tar_sparse_gnu0_LDADD = libtar.a libio.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 tests/test.h +test_tar_sparse_gnu1_SOURCES = tests/libtar/tar_sparse.c test_tar_sparse_gnu1_LDADD = libtar.a libio.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 tests/test.h +test_tar_sparse_gnu2_SOURCES = tests/libtar/tar_sparse.c test_tar_sparse_gnu2_LDADD = libtar.a libio.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 tests/test.h +test_tar_sparse_gnu3_SOURCES = tests/libtar/tar_sparse.c test_tar_sparse_gnu3_LDADD = libtar.a libio.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 tests/test.h +test_tar_xattr_bsd_SOURCES = tests/libtar/tar_xattr.c test_tar_xattr_bsd_LDADD = libtar.a libio.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 tests/test.h +test_tar_xattr_schily_SOURCES = tests/libtar/tar_xattr.c test_tar_xattr_schily_LDADD = libtar.a libio.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 tests/test.h +test_tar_xattr_schily_bin_SOURCES = tests/libtar/tar_xattr_bin.c test_tar_xattr_schily_bin_LDADD = libtar.a libio.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 diff --git a/tests/libtar/tar_big_file.c b/tests/libtar/tar_big_file.c index 47332b7..dbeefac 100644 --- a/tests/libtar/tar_big_file.c +++ b/tests/libtar/tar_big_file.c @@ -7,7 +7,7 @@ #include "config.h" #include "tar/tar.h" #include "io/file.h" -#include "../test.h" +#include "util/test.h" int main(int argc, char **argv) { diff --git a/tests/libtar/tar_simple.c b/tests/libtar/tar_simple.c index d72044a..8879f05 100644 --- a/tests/libtar/tar_simple.c +++ b/tests/libtar/tar_simple.c @@ -7,7 +7,7 @@ #include "config.h" #include "io/file.h" #include "tar/tar.h" -#include "../test.h" +#include "util/test.h" #ifndef TESTUID #define TESTUID 1000 diff --git a/tests/libtar/tar_sparse.c b/tests/libtar/tar_sparse.c index 305e5e7..511c7ba 100644 --- a/tests/libtar/tar_sparse.c +++ b/tests/libtar/tar_sparse.c @@ -7,7 +7,7 @@ #include "config.h" #include "io/file.h" #include "tar/tar.h" -#include "../test.h" +#include "util/test.h" static void test_case_sparse(const char *path) { diff --git a/tests/libtar/tar_sparse_gnu.c b/tests/libtar/tar_sparse_gnu.c index 2ce7975..37167d3 100644 --- a/tests/libtar/tar_sparse_gnu.c +++ b/tests/libtar/tar_sparse_gnu.c @@ -7,7 +7,7 @@ #include "config.h" #include "io/file.h" #include "tar/tar.h" -#include "../test.h" +#include "util/test.h" int main(int argc, char **argv) { diff --git a/tests/libtar/tar_target_filled.c b/tests/libtar/tar_target_filled.c index 13b089f..6c83170 100644 --- a/tests/libtar/tar_target_filled.c +++ b/tests/libtar/tar_target_filled.c @@ -7,7 +7,7 @@ #include "config.h" #include "io/file.h" #include "tar/tar.h" -#include "../test.h" +#include "util/test.h" int main(int argc, char **argv) { diff --git a/tests/libtar/tar_xattr.c b/tests/libtar/tar_xattr.c index 5fc7064..4b3ed21 100644 --- a/tests/libtar/tar_xattr.c +++ b/tests/libtar/tar_xattr.c @@ -7,7 +7,7 @@ #include "config.h" #include "io/file.h" #include "tar/tar.h" -#include "../test.h" +#include "util/test.h" int main(int argc, char **argv) { diff --git a/tests/libtar/tar_xattr_bin.c b/tests/libtar/tar_xattr_bin.c index 8679c2d..b5644a1 100644 --- a/tests/libtar/tar_xattr_bin.c +++ b/tests/libtar/tar_xattr_bin.c @@ -7,7 +7,7 @@ #include "config.h" #include "io/file.h" #include "tar/tar.h" -#include "../test.h" +#include "util/test.h" static const uint8_t value[] = { 0x00, 0x00, 0x00, 0x02, diff --git a/tests/libutil/Makemodule.am b/tests/libutil/Makemodule.am index 557a65c..95fb8ab 100644 --- a/tests/libutil/Makemodule.am +++ b/tests/libutil/Makemodule.am @@ -1,8 +1,8 @@ -test_str_table_SOURCES = tests/libutil/str_table.c tests/test.h +test_str_table_SOURCES = tests/libutil/str_table.c test_str_table_LDADD = libutil.a libio.a libcompat.a test_str_table_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/libutil -test_rbtree_SOURCES = tests/libutil/rbtree.c tests/test.h +test_rbtree_SOURCES = tests/libutil/rbtree.c test_rbtree_LDADD = libutil.a libcompat.a test_xxhash_SOURCES = tests/libutil/xxhash.c diff --git a/tests/libutil/is_memory_zero.c b/tests/libutil/is_memory_zero.c index 967e2e8..f62b0bb 100644 --- a/tests/libutil/is_memory_zero.c +++ b/tests/libutil/is_memory_zero.c @@ -6,7 +6,7 @@ */ #include "config.h" -#include "../test.h" +#include "util/test.h" #include "util/util.h" int main(int argc, char **argv) diff --git a/tests/libutil/rbtree.c b/tests/libutil/rbtree.c index d7b475a..ca01c0d 100644 --- a/tests/libutil/rbtree.c +++ b/tests/libutil/rbtree.c @@ -7,7 +7,7 @@ #include "config.h" #include "util/rbtree.h" -#include "../test.h" +#include "util/test.h" static int key_compare(const void *ctx, const void *a, const void *b) { diff --git a/tests/libutil/str_table.c b/tests/libutil/str_table.c index 509594c..9424581 100644 --- a/tests/libutil/str_table.c +++ b/tests/libutil/str_table.c @@ -9,7 +9,7 @@ #include "util/str_table.h" #include "io/file.h" #include "compat.h" -#include "../test.h" +#include "util/test.h" static char *strings[1000]; diff --git a/tests/libutil/threadpool.c b/tests/libutil/threadpool.c index 4b07935..8d1bda5 100644 --- a/tests/libutil/threadpool.c +++ b/tests/libutil/threadpool.c @@ -7,7 +7,7 @@ #include "config.h" #include "util/threadpool.h" -#include "../test.h" +#include "util/test.h" #if defined(_WIN32) || defined(__WINDOWS__) #define WIN32_LEAN_AND_MEAN diff --git a/tests/libutil/xxhash.c b/tests/libutil/xxhash.c index cccbb68..17374fd 100644 --- a/tests/libutil/xxhash.c +++ b/tests/libutil/xxhash.c @@ -7,7 +7,7 @@ #include "config.h" #include "util/util.h" -#include "../test.h" +#include "util/test.h" static const struct { const char *plaintext; diff --git a/tests/test.h b/tests/test.h deleted file mode 100644 index bc3ac92..0000000 --- a/tests/test.h +++ /dev/null @@ -1,125 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -/* - * test.h - * - * Copyright (C) 2019 David Oberhollenzer - */ -#ifndef TEST_H -#define TEST_H - -#include -#include -#include -#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 -# define ATTRIB_UNUSED -#endif - -static ATTRIB_UNUSED FILE *test_open_read(const char *path) -{ - FILE *fp = fopen(path, "rb"); - - if (fp == NULL) { - perror(path); - abort(); - } - - return fp; -} - -static ATTRIB_UNUSED void test_assert(const char *expr, int value, - int linenum) -{ - if (value == 0) { - fprintf(stderr, "%d: '%s' is false!\n", linenum, expr); - abort(); - } -} - -static ATTRIB_UNUSED void test_str_equal(const char *expr, const char *value, - const char *ref, int linenum) -{ - if (strcmp(value, ref) != 0) { - fprintf(stderr, - "%d: '%s' should be '%s', but actually is '%s'!\n", - linenum, expr, ref, value); - abort(); - } -} - -static ATTRIB_UNUSED void test_not_null(const void *value, const char *expr, - int linenum) -{ - if (value == NULL) { - fprintf(stderr, "%d: '%s' should not be NULL, but is!\n", - linenum, expr); - abort(); - } -} - -static ATTRIB_UNUSED void test_null(const void *value, const char *expr, - int linenum) -{ - if (value != NULL) { - fprintf(stderr, "%d: '%s' should be NULL, but is!\n", - linenum, expr); - abort(); - } -} - -static ATTRIB_UNUSED void test_equal_ul(const char *lhs, const char *rhs, - unsigned long lval, unsigned long rval, - int linenum) -{ - if (lval != rval) { - fprintf(stderr, "%d: %s (%lu) does not equal %s (%lu)!\n", - linenum, lhs, lval, rhs, rval); - abort(); - } -} - -static ATTRIB_UNUSED void test_equal_sl(const char *lhs, const char *rhs, - long lval, long rval, int linenum) -{ - if (lval != rval) { - fprintf(stderr, "%d: %s (%ld) does not equal %s (%ld)!\n", - linenum, lhs, lval, rhs, rval); - abort(); - } -} - -static ATTRIB_UNUSED void test_lt_ul(const char *lhs, const char *rhs, - unsigned long lval, unsigned long rval, - int linenum) -{ - if (lval >= rval) { - fprintf(stderr, "%d: %s (%lu) is not less than %s (%lu)!\n", - linenum, lhs, lval, rhs, rval); - abort(); - } -} - -#define TEST_STR_EQUAL(str, ref) test_str_equal(#str, str, ref, __LINE__) - -#define TEST_NULL(expr) test_null(expr, #expr, __LINE__) - -#define TEST_NOT_NULL(expr) test_not_null(expr, #expr, __LINE__) - -#define TEST_EQUAL_I(a, b) test_equal_sl(#a, #b, a, b, __LINE__) - -#define TEST_EQUAL_UI(a, b) test_equal_ul(#a, #b, a, b, __LINE__) - -#define TEST_LESS_THAN_UI(a, b) test_lt_ul(#a, #b, a, b, __LINE__) - -#define TEST_ASSERT(expr) test_assert(#expr, (expr), __LINE__) - -#endif /* TEST_H */ -- cgit v1.2.3