From: alex Date: Sun, 6 Feb 2022 07:35:29 +0000 (-0800) Subject: ... X-Git-Url: http://git.infiniteadaptability.org/?a=commitdiff_plain;h=52aaf92eeeb905e0d51288e4f0408e68b933e31e;p=seeder ... --- diff --git a/test/unit/Makefile.am b/test/unit/Makefile.am index 17fb531..83cb82f 100644 --- a/test/unit/Makefile.am +++ b/test/unit/Makefile.am @@ -30,12 +30,11 @@ torrent_SOURCES = \ $(top_srcdir)/src/file.c \ $(top_srcdir)/src/hashmap.c \ $(top_srcdir)/src/torrent/add.c \ - $(top_srcdir)/src/torrent/file.c \ $(top_srcdir)/src/torrent/free.c \ $(top_srcdir)/src/torrent/init.c \ + $(top_srcdir)/src/torrent/info.c \ $(top_srcdir)/src/torrent/infohash.c \ $(top_srcdir)/src/torrent/magnet.c \ - $(top_srcdir)/src/torrent/path.c \ $(top_srcdir)/src/torrent/piece.c \ $(top_srcdir)/src/torrent/remove.c \ $(top_srcdir)/src/tree.c @@ -67,12 +66,15 @@ feed_tests_SOURCES = \ $(top_srcdir)/src/rss/footer.c \ $(top_srcdir)/src/rss/header.c \ $(top_srcdir)/src/rss/info.c \ - $(top_srcdir)/src/rss/init.c + $(top_srcdir)/src/rss/init.c \ + $(top_srcdir)/src/torrent/file.c \ + $(top_srcdir)/src/torrent/path.c +# feed/gen.c requires overwriting of FEED_DIRECTORY for testing +# feed/path.c requires overwriting of FEED_DIRECTORY for testing feed_tests_CPPFLAGS = $(AM_CPPFLAGS) \ -DFEED_GEN_SRC_FILE="$(top_srcdir)/src/feed/gen.c" \ - -DFEED_PATH_SRC_FILE="$(top_srcdir)/src/feed/path.c" \ - -DTORRENT_INFO_SRC_FILE="$(top_srcdir)/src/torrent/info.c" + -DFEED_PATH_SRC_FILE="$(top_srcdir)/src/feed/path.c" file_tests_SOURCES = \ $(common_SOURCES) \ @@ -110,6 +112,7 @@ meta_tests_SOURCES = \ $(top_srcdir)/src/rss/free.c \ $(top_srcdir)/src/rss/init.c +# src/meta.c requires strptime dummy function defined in meta.tests.c meta_tests_CPPFLAGS = $(AM_CPPFLAGS) \ -DMETA_SRC_FILE="$(top_srcdir)/src/meta.c" @@ -135,9 +138,6 @@ opt_tests_SOURCES = \ $(top_srcdir)/src/opt/worker.c \ $(top_srcdir)/src/session.c -opt_tests_CPPFLAGS = $(AM_CPPFLAGS) \ - -DTORRENT_INFO_SRC_FILE="$(top_srcdir)/src/torrent/info.c" - rss_tests_SOURCES = \ $(common_SOURCES) \ rss.tests.c \ @@ -158,9 +158,6 @@ session_tests_SOURCES = \ $(top_srcdir)/src/hash.c \ $(top_srcdir)/src/session.c -session_tests_CPPFLAGS = $(AM_CPPFLAGS) \ - -DTORRENT_INFO_SRC_FILE="$(top_srcdir)/src/torrent/info.c" - torrent_tests_SOURCES = \ $(common_SOURCES) \ $(torrent_SOURCES) \ @@ -169,8 +166,11 @@ torrent_tests_SOURCES = \ $(top_srcdir)/src/fs/dir.c \ $(top_srcdir)/src/hash.c +# src/torrent/file.c requires TORRENT_FILE_DIRECTORY to be overwritten for testing +# src/torrent/path.c requires TORRENT_FILE_DIRECTORY to be overwritten for testing torrent_tests_CPPFLAGS = $(AM_CPPFLAGS) \ - -DTORRENT_INFO_SRC_FILE="$(top_srcdir)/src/torrent/info.c" + -DTORRENT_FILE_SRC_FILE="$(top_srcdir)/src/torrent/file.c" \ + -DTORRENT_PATH_SRC_FILE="$(top_srcdir)/src/torrent/path.c" tree_tests_SOURCES = \ $(common_SOURCES) \ diff --git a/test/unit/feed.tests.c b/test/unit/feed.tests.c index 278218f..9d3dc6b 100644 --- a/test/unit/feed.tests.c +++ b/test/unit/feed.tests.c @@ -4,7 +4,6 @@ #include INCLUDE(FEED_PATH_SRC_FILE) #include INCLUDE(FEED_GEN_SRC_FILE) -#include INCLUDE(TORRENT_INFO_SRC_FILE) int main(); static void feed_entries_basic_test(); diff --git a/test/unit/opt.tests.c b/test/unit/opt.tests.c index 8de1d24..3b8e4da 100644 --- a/test/unit/opt.tests.c +++ b/test/unit/opt.tests.c @@ -2,8 +2,6 @@ #include -#include INCLUDE(TORRENT_INFO_SRC_FILE) - pthread_t logging_thread; pthread_mutex_t logging_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -78,6 +76,7 @@ static void opt_add_watch_basic_test() { assert(-1==opt_add_watch("notarealexistingdirectorylksdjflkajsdfklajsklf")); opt_set_log_level(LOG_LEVEL_SILENT); + assert(1==session_init()); assert(1==opt_add_watch(TEST_DIRECTORY)); assert(1==defaults()); diff --git a/test/unit/session.tests.c b/test/unit/session.tests.c index 55bb859..1065ad0 100644 --- a/test/unit/session.tests.c +++ b/test/unit/session.tests.c @@ -2,8 +2,6 @@ #include -#include INCLUDE(TORRENT_INFO_SRC_FILE) - int main(); static void session_init_basic_test(); static void session_torrent_add_basic_test(); diff --git a/test/unit/torrent.tests.c b/test/unit/torrent.tests.c index 7be05b4..9fc62db 100644 --- a/test/unit/torrent.tests.c +++ b/test/unit/torrent.tests.c @@ -2,7 +2,8 @@ #include -#include INCLUDE(TORRENT_INFO_SRC_FILE) +#include INCLUDE(TORRENT_FILE_SRC_FILE) +#include INCLUDE(TORRENT_PATH_SRC_FILE) int main(); static void torrent_add_basic_test();