aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-12-04 21:12:06 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-12-05 10:32:01 +0100
commit8297b3faf8606762b176d57637f2ec5f84601e0d (patch)
tree0b30ab78333f6f04adb1ab1ed56113246a17198e /tests
parent2b8eb19a4de81db470f7ff5021a8a4822cc8c80d (diff)
Fix: unit test and sample program Windows build
Now that there is a wrapper for main() on Windows, all executable programs must use a common, cannonical signature for main(). Furthermore, the Windows version of the epoch test needs wrappers for setenv/unsetenv. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests')
-rw-r--r--tests/libfstream/get_line.c4
-rw-r--r--tests/libfstream/uncompress.c3
-rw-r--r--tests/libfstree/Makemodule.am4
-rw-r--r--tests/libfstree/add_by_path.c3
-rw-r--r--tests/libfstree/canonicalize_name.c3
-rw-r--r--tests/libfstree/filename_sane.c3
-rw-r--r--tests/libfstree/fstree_from_dir.c3
-rw-r--r--tests/libfstree/fstree_from_file.c3
-rw-r--r--tests/libfstree/fstree_glob1.c3
-rw-r--r--tests/libfstree/fstree_init.c3
-rw-r--r--tests/libfstree/fstree_sort.c4
-rw-r--r--tests/libfstree/gen_inode_numbers.c3
-rw-r--r--tests/libfstree/get_path.c3
-rw-r--r--tests/libfstree/mknode_dir.c3
-rw-r--r--tests/libfstree/mknode_reg.c3
-rw-r--r--tests/libfstree/mknode_simple.c3
-rw-r--r--tests/libfstree/mknode_slink.c3
-rw-r--r--tests/libsqfs/Makemodule.am6
-rw-r--r--tests/libsqfs/abi.c3
-rw-r--r--tests/libsqfs/table.c3
-rw-r--r--tests/libsqfs/xattr_writer.c3
-rw-r--r--tests/libtar/tar_big_file.c3
-rw-r--r--tests/libtar/tar_simple.c3
-rw-r--r--tests/libtar/tar_sparse.c3
-rw-r--r--tests/libtar/tar_sparse_gnu.c3
-rw-r--r--tests/libtar/tar_target_filled.c3
-rw-r--r--tests/libtar/tar_xattr.c3
-rw-r--r--tests/libtar/tar_xattr_bin.c3
-rw-r--r--tests/libutil/is_memory_zero.c3
-rw-r--r--tests/libutil/rbtree.c3
-rw-r--r--tests/libutil/str_table.c3
-rw-r--r--tests/libutil/threadpool.c3
-rw-r--r--tests/libutil/xxhash.c3
33 files changed, 70 insertions, 35 deletions
diff --git a/tests/libfstream/get_line.c b/tests/libfstream/get_line.c
index a2f6d85..7d9a26a 100644
--- a/tests/libfstream/get_line.c
+++ b/tests/libfstream/get_line.c
@@ -143,8 +143,10 @@ static const line_t lines_no_empty_trim[] = {
{ 10, "dog" },
};
-int main(void)
+int main(int argc, char **argv)
{
+ (void)argc; (void)argv;
+
run_test_case(lines_raw, 11, 0);
run_test_case(lines_ltrim, 11, ISTREAM_LINE_LTRIM);
run_test_case(lines_rtrim, 11, ISTREAM_LINE_RTRIM);
diff --git a/tests/libfstream/uncompress.c b/tests/libfstream/uncompress.c
index 3e4679d..5f0cbec 100644
--- a/tests/libfstream/uncompress.c
+++ b/tests/libfstream/uncompress.c
@@ -384,13 +384,14 @@ static istream_t memstream = {
.get_filename = get_filename,
};
-int main(void)
+int main(int argc, char **argv)
{
char buffer[2 * (sizeof(orig) / sizeof(orig[0]))];
const char *name;
istream_t *xfrm;
size_t orig_sz;
int ret;
+ (void)argc; (void)argv;
/* XXX: null terminator not included in the compressed blob */
orig_sz = (sizeof(orig) / sizeof(orig[0])) - 1;
diff --git a/tests/libfstree/Makemodule.am b/tests/libfstree/Makemodule.am
index 8248f5c..022b8e4 100644
--- a/tests/libfstree/Makemodule.am
+++ b/tests/libfstree/Makemodule.am
@@ -2,7 +2,7 @@ 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
+test_canonicalize_name_LDADD = libfstree.a libcompat.a
test_mknode_simple_SOURCES = tests/libfstree/mknode_simple.c tests/test.h
test_mknode_simple_LDADD = libfstree.a libcompat.a
@@ -50,10 +50,12 @@ test_fstree_init_LDADD = libfstree.a libfstream.a libcompat.a
test_filename_sane_SOURCES = tests/libfstree/filename_sane.c
test_filename_sane_SOURCES += lib/fstree/filename_sane.c
+test_filename_sane_LDADD = libcompat.a
test_filename_sane_w32_SOURCES = tests/libfstree/filename_sane.c
test_filename_sane_w32_SOURCES += lib/fstree/filename_sane.c
test_filename_sane_w32_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_WIN32=1
+test_filename_sane_w32_LDADD = libcompat.a
fstree_fuzz_SOURCES = tests/libfstree/fstree_fuzz.c
fstree_fuzz_LDADD = libfstree.a libfstream.a libcompat.a
diff --git a/tests/libfstree/add_by_path.c b/tests/libfstree/add_by_path.c
index 94c0dc9..b21c696 100644
--- a/tests/libfstree/add_by_path.c
+++ b/tests/libfstree/add_by_path.c
@@ -9,12 +9,13 @@
#include "fstree.h"
#include "../test.h"
-int main(void)
+int main(int argc, char **argv)
{
tree_node_t *a, *b;
struct stat sb;
fstree_t fs;
char *opts;
+ (void)argc; (void)argv;
opts = strdup("mode=0755,uid=21,gid=42");
TEST_ASSERT(fstree_init(&fs, opts) == 0);
diff --git a/tests/libfstree/canonicalize_name.c b/tests/libfstree/canonicalize_name.c
index 37b07e3..f1eb1c1 100644
--- a/tests/libfstree/canonicalize_name.c
+++ b/tests/libfstree/canonicalize_name.c
@@ -40,10 +40,11 @@ static const char *must_not_work[] = {
"foo/bar/../",
};
-int main(void)
+int main(int argc, char **argv)
{
char buffer[512];
size_t i;
+ (void)argc; (void)argv;
for (i = 0; i < sizeof(must_work) / sizeof(must_work[0]); ++i) {
strcpy(buffer, must_work[i].in);
diff --git a/tests/libfstree/filename_sane.c b/tests/libfstree/filename_sane.c
index 4d25b33..11f27da 100644
--- a/tests/libfstree/filename_sane.c
+++ b/tests/libfstree/filename_sane.c
@@ -40,9 +40,10 @@ static const char *must_not_work_here[] = {
NULL,
};
-int main(void)
+int main(int argc, char **argv)
{
size_t i;
+ (void)argc; (void)argv;
for (i = 0; must_work[i] != NULL; ++i) {
if (!is_filename_sane(must_work[i], false)) {
diff --git a/tests/libfstree/fstree_from_dir.c b/tests/libfstree/fstree_from_dir.c
index 7db1b74..845586f 100644
--- a/tests/libfstree/fstree_from_dir.c
+++ b/tests/libfstree/fstree_from_dir.c
@@ -313,11 +313,12 @@ static void check_hierarchy(tree_node_t *root, bool recursive)
TEST_NULL(n);
}
-int main(void)
+int main(int argc, char **argv)
{
struct stat sb;
tree_node_t *n;
fstree_t fs;
+ (void)argc; (void)argv;
/* recursively scan into root */
TEST_ASSERT(fstree_init(&fs, NULL) == 0);
diff --git a/tests/libfstree/fstree_from_file.c b/tests/libfstree/fstree_from_file.c
index 5d37960..08277e6 100644
--- a/tests/libfstree/fstree_from_file.c
+++ b/tests/libfstree/fstree_from_file.c
@@ -9,10 +9,11 @@
#include "fstree.h"
#include "../test.h"
-int main(void)
+int main(int argc, char **argv)
{
tree_node_t *n;
fstree_t fs;
+ (void)argc; (void)argv;
TEST_ASSERT(fstree_init(&fs, NULL) == 0);
TEST_ASSERT(fstree_from_file(&fs, TEST_PATH, NULL) == 0);
diff --git a/tests/libfstree/fstree_glob1.c b/tests/libfstree/fstree_glob1.c
index 708b0e8..08e39bd 100644
--- a/tests/libfstree/fstree_glob1.c
+++ b/tests/libfstree/fstree_glob1.c
@@ -204,10 +204,11 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
TEST_NULL(n);
}
-int main(void)
+int main(int argc, char **argv)
{
fstree_t fs;
int ret;
+ (void)argc; (void)argv;
/* first test case, directory tree only */
ret = fstree_init(&fs, NULL);
diff --git a/tests/libfstree/fstree_init.c b/tests/libfstree/fstree_init.c
index a101143..5f701cb 100644
--- a/tests/libfstree/fstree_init.c
+++ b/tests/libfstree/fstree_init.c
@@ -10,10 +10,11 @@
#include "internal.h"
#include "../test.h"
-int main(void)
+int main(int argc, char **argv)
{
fstree_t fs;
char *str;
+ (void)argc; (void)argv;
str = strdup("mtime=1337,uid=1000,gid=100,mode=0321");
TEST_NOT_NULL(str);
diff --git a/tests/libfstree/fstree_sort.c b/tests/libfstree/fstree_sort.c
index 6fc7543..618ae9f 100644
--- a/tests/libfstree/fstree_sort.c
+++ b/tests/libfstree/fstree_sort.c
@@ -10,11 +10,13 @@
#include "internal.h"
#include "../test.h"
-int main(void)
+int main(int argc, char **argv)
{
tree_node_t *a, *b, *c, *d;
struct stat sb;
fstree_t fs;
+ int ret;
+ (void)argc; (void)argv;
memset(&fs, 0, sizeof(fs));
memset(&sb, 0, sizeof(sb));
diff --git a/tests/libfstree/gen_inode_numbers.c b/tests/libfstree/gen_inode_numbers.c
index 8ee2315..eef5678 100644
--- a/tests/libfstree/gen_inode_numbers.c
+++ b/tests/libfstree/gen_inode_numbers.c
@@ -44,10 +44,11 @@ static void check_children_continuous(tree_node_t *root)
check_children_continuous(n);
}
-int main(void)
+int main(int argc, char **argv)
{
tree_node_t *a, *b, *c;
fstree_t fs;
+ (void)argc; (void)argv;
// inode table for the empty tree
TEST_ASSERT(fstree_init(&fs, NULL) == 0);
diff --git a/tests/libfstree/get_path.c b/tests/libfstree/get_path.c
index 9bf618b..26dd9ea 100644
--- a/tests/libfstree/get_path.c
+++ b/tests/libfstree/get_path.c
@@ -9,12 +9,13 @@
#include "fstree.h"
#include "../test.h"
-int main(void)
+int main(int argc, char **argv)
{
tree_node_t *a, *b, *c, *d;
struct stat sb;
fstree_t fs;
char *str;
+ (void)argc; (void)argv;
TEST_ASSERT(fstree_init(&fs, NULL) == 0);
diff --git a/tests/libfstree/mknode_dir.c b/tests/libfstree/mknode_dir.c
index be1156f..900edaa 100644
--- a/tests/libfstree/mknode_dir.c
+++ b/tests/libfstree/mknode_dir.c
@@ -9,11 +9,12 @@
#include "fstree.h"
#include "../test.h"
-int main(void)
+int main(int argc, char **argv)
{
tree_node_t *root, *a, *b;
struct stat sb;
fstree_t fs;
+ (void)argc; (void)argv;
memset(&fs, 0, sizeof(fs));
memset(&sb, 0, sizeof(sb));
diff --git a/tests/libfstree/mknode_reg.c b/tests/libfstree/mknode_reg.c
index 1f7ec88..debecd9 100644
--- a/tests/libfstree/mknode_reg.c
+++ b/tests/libfstree/mknode_reg.c
@@ -9,11 +9,12 @@
#include "fstree.h"
#include "../test.h"
-int main(void)
+int main(int argc, char **argv)
{
tree_node_t *node;
struct stat sb;
fstree_t fs;
+ (void)argc; (void)argv;
memset(&fs, 0, sizeof(fs));
diff --git a/tests/libfstree/mknode_simple.c b/tests/libfstree/mknode_simple.c
index b8505ed..4e8978c 100644
--- a/tests/libfstree/mknode_simple.c
+++ b/tests/libfstree/mknode_simple.c
@@ -9,11 +9,12 @@
#include "fstree.h"
#include "../test.h"
-int main(void)
+int main(int argc, char **argv)
{
tree_node_t *node;
struct stat sb;
fstree_t fs;
+ (void)argc; (void)argv;
memset(&fs, 0, sizeof(fs));
memset(&sb, 0, sizeof(sb));
diff --git a/tests/libfstree/mknode_slink.c b/tests/libfstree/mknode_slink.c
index 29f2679..4b23951 100644
--- a/tests/libfstree/mknode_slink.c
+++ b/tests/libfstree/mknode_slink.c
@@ -9,11 +9,12 @@
#include "fstree.h"
#include "../test.h"
-int main(void)
+int main(int argc, char **argv)
{
tree_node_t *node;
struct stat sb;
fstree_t fs;
+ (void)argc; (void)argv;
memset(&fs, 0, sizeof(fs));
memset(&sb, 0, sizeof(sb));
diff --git a/tests/libsqfs/Makemodule.am b/tests/libsqfs/Makemodule.am
index 33567b0..514571d 100644
--- a/tests/libsqfs/Makemodule.am
+++ b/tests/libsqfs/Makemodule.am
@@ -1,11 +1,11 @@
test_abi_SOURCES = tests/libsqfs/abi.c tests/test.h
-test_abi_LDADD = libsquashfs.la
+test_abi_LDADD = libsquashfs.la libcompat.a
test_table_SOURCES = tests/libsqfs/table.c tests/test.h
-test_table_LDADD = libsquashfs.la
+test_table_LDADD = libsquashfs.la libcompat.a
test_xattr_writer_SOURCES = tests/libsqfs/xattr_writer.c tests/test.h
-test_xattr_writer_LDADD = libsquashfs.la
+test_xattr_writer_LDADD = libsquashfs.la libcompat.a
xattr_benchmark_SOURCES = tests/libsqfs/xattr_benchmark.c
xattr_benchmark_LDADD = libcommon.a libsquashfs.la libcompat.a
diff --git a/tests/libsqfs/abi.c b/tests/libsqfs/abi.c
index d409f67..3bdc4f5 100644
--- a/tests/libsqfs/abi.c
+++ b/tests/libsqfs/abi.c
@@ -163,8 +163,9 @@ static void test_blockproc_desc(void)
(4 * sizeof(sqfs_u32) + 4 * sizeof(void *)));
}
-int main(void)
+int main(int argc, char **argv)
{
+ (void)argc; (void)argv;
test_compressor_opt_struct();
test_compressor_names();
test_blockproc_stats();
diff --git a/tests/libsqfs/table.c b/tests/libsqfs/table.c
index 0b1ab93..5f240cc 100644
--- a/tests/libsqfs/table.c
+++ b/tests/libsqfs/table.c
@@ -111,12 +111,13 @@ static sqfs_compressor_t dummy_uncompressor = {
static sqfs_u64 table[4000];
-int main(void)
+int main(int argc, char **argv)
{
sqfs_u64 start, value, locations[4], *copy;
sqfs_u16 hdr;
size_t i;
int ret;
+ (void)argc; (void)argv;
/* fill the table with data */
for (i = 0; i < sizeof(table) / sizeof(table[0]); ++i)
diff --git a/tests/libsqfs/xattr_writer.c b/tests/libsqfs/xattr_writer.c
index 8860f42..6fa0355 100644
--- a/tests/libsqfs/xattr_writer.c
+++ b/tests/libsqfs/xattr_writer.c
@@ -71,7 +71,7 @@ static sqfs_compressor_t dummy_compressor = {
/*****************************************************************************/
-int main(void)
+int main(int argc, char **argv)
{
size_t offset, ool_value_offset, id_offset;
sqfs_xattr_id_table_t idtbl;
@@ -85,6 +85,7 @@ int main(void)
sqfs_u64 ref;
sqfs_u32 id;
int ret;
+ (void)argc; (void)argv;
/* setup */
xwr = sqfs_xattr_writer_create(0);
diff --git a/tests/libtar/tar_big_file.c b/tests/libtar/tar_big_file.c
index 69263ef..abea1ef 100644
--- a/tests/libtar/tar_big_file.c
+++ b/tests/libtar/tar_big_file.c
@@ -8,10 +8,11 @@
#include "tar.h"
#include "../test.h"
-int main(void)
+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);
diff --git a/tests/libtar/tar_simple.c b/tests/libtar/tar_simple.c
index ffaafea..54b06c8 100644
--- a/tests/libtar/tar_simple.c
+++ b/tests/libtar/tar_simple.c
@@ -33,12 +33,13 @@ static const char *fname =
static const char *fname = STRVALUE(TESTFNAME);
#endif
-int main(void)
+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);
diff --git a/tests/libtar/tar_sparse.c b/tests/libtar/tar_sparse.c
index c4e1c71..c4313f0 100644
--- a/tests/libtar/tar_sparse.c
+++ b/tests/libtar/tar_sparse.c
@@ -78,8 +78,9 @@ static void test_case_sparse(const char *path)
sqfs_destroy(fp);
}
-int main(void)
+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
index 1405026..06f79f1 100644
--- a/tests/libtar/tar_sparse_gnu.c
+++ b/tests/libtar/tar_sparse_gnu.c
@@ -8,11 +8,12 @@
#include "tar.h"
#include "../test.h"
-int main(void)
+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);
diff --git a/tests/libtar/tar_target_filled.c b/tests/libtar/tar_target_filled.c
index 0028e5e..f0f4026 100644
--- a/tests/libtar/tar_target_filled.c
+++ b/tests/libtar/tar_target_filled.c
@@ -8,11 +8,12 @@
#include "tar.h"
#include "../test.h"
-int main(void)
+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);
diff --git a/tests/libtar/tar_xattr.c b/tests/libtar/tar_xattr.c
index 70329fe..633c3a2 100644
--- a/tests/libtar/tar_xattr.c
+++ b/tests/libtar/tar_xattr.c
@@ -8,11 +8,12 @@
#include "tar.h"
#include "../test.h"
-int main(void)
+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);
diff --git a/tests/libtar/tar_xattr_bin.c b/tests/libtar/tar_xattr_bin.c
index 52c407c..f44e26f 100644
--- a/tests/libtar/tar_xattr_bin.c
+++ b/tests/libtar/tar_xattr_bin.c
@@ -16,11 +16,12 @@ static const uint8_t value[] = {
0x00, 0x00, 0x00, 0x00,
};
-int main(void)
+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);
diff --git a/tests/libutil/is_memory_zero.c b/tests/libutil/is_memory_zero.c
index 20bd93f..0d10dd8 100644
--- a/tests/libutil/is_memory_zero.c
+++ b/tests/libutil/is_memory_zero.c
@@ -9,10 +9,11 @@
#include "../test.h"
#include "util.h"
-int main(void)
+int main(int argc, char **argv)
{
unsigned char temp[1024];
size_t i, j;
+ (void)argc; (void)argv;
memset(temp, 0, sizeof(temp));
diff --git a/tests/libutil/rbtree.c b/tests/libutil/rbtree.c
index c430d67..05f7aa3 100644
--- a/tests/libutil/rbtree.c
+++ b/tests/libutil/rbtree.c
@@ -151,7 +151,7 @@ static int check_subtrees_equal(const rbtree_node_t *lhs,
return 0;
}
-int main(void)
+int main(int argc, char **argv)
{
size_t count, blkdepth, mind, maxd;
sqfs_s32 key, key2;
@@ -159,6 +159,7 @@ int main(void)
rbtree_node_t *n;
sqfs_u64 value;
int ret;
+ (void)argc; (void)argv;
TEST_ASSERT(rbtree_init(&rb, sizeof(sqfs_s32),
sizeof(sqfs_u64), key_compare) == 0);
diff --git a/tests/libutil/str_table.c b/tests/libutil/str_table.c
index 9baba27..b75bb91 100644
--- a/tests/libutil/str_table.c
+++ b/tests/libutil/str_table.c
@@ -34,11 +34,12 @@ static int read_strings(void)
return 0;
}
-int main(void)
+int main(int argc, char **argv)
{
str_table_t table;
size_t i, j, idx;
const char *str;
+ (void)argc; (void)argv;
TEST_ASSERT(chdir(TEST_PATH) == 0);
diff --git a/tests/libutil/threadpool.c b/tests/libutil/threadpool.c
index 566239f..cd52ad3 100644
--- a/tests/libutil/threadpool.c
+++ b/tests/libutil/threadpool.c
@@ -40,13 +40,14 @@ static int worker(void *user, void *work_item)
return 0;
}
-int main(void)
+int main(int argc, char **argv)
{
unsigned int values[10];
thread_pool_t *pool;
unsigned int *ptr;
size_t i, count;
int ret;
+ (void)argc; (void)argv;
pool = thread_pool_create(10, worker);
TEST_NOT_NULL(pool);
diff --git a/tests/libutil/xxhash.c b/tests/libutil/xxhash.c
index 6e17097..b0b1bac 100644
--- a/tests/libutil/xxhash.c
+++ b/tests/libutil/xxhash.c
@@ -44,10 +44,11 @@ static const struct {
},
};
-int main(void)
+int main(int argc, char **argv)
{
sqfs_u32 hash;
size_t i;
+ (void)argc; (void)argv;
for (i = 0; i < sizeof(test_vectors) / sizeof(test_vectors[0]); ++i) {
hash = xxh32(test_vectors[i].plaintext, test_vectors[i].psize);