From 123b65bf406783a7bc997c76cd7796b15c8bdb14 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sun, 1 Nov 2026 01:51:42 +0100 Subject: Add some tests for the actual trackerlogic, something I put off for too long --- tests/stubs.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'tests/stubs.c') diff --git a/tests/stubs.c b/tests/stubs.c index a8e6962..5999e2d 100644 --- a/tests/stubs.c +++ b/tests/stubs.c @@ -8,11 +8,9 @@ behaviour should be supplied here rather than the test weakened. */ /* Opentracker */ +#include "ot_stats.h" #include "trackerlogic.h" -/* ot_vector.c calls this from vector_clean_list, which no test drives yet. */ -void free_peerlist(ot_peerlist *peer_list) { (void)peer_list; } - /* ot_accesslist.c is built with WANT_ACCESSLIST_BLACK so that the hash parser is reachable. These two belong to accesslist_readfile and the reload worker, neither of which any test drives. */ @@ -26,3 +24,32 @@ long io_trywrite(long d, const char *buf, long len) { (void)buf; return len; } + +/* trackerlogic.c is under test, and starting it up starts every module it + leans on. None of them is driven by these tests, so they are answered here + rather than linked in and left to run threads of their own. */ +void clean_init(void) {} +void clean_deinit(void) {} +int clean_single_torrent(ot_torrent *torrent) { + (void)torrent; + return 0; +} +void fullscrape_init(void) {} +void fullscrape_deinit(void) {} +void livesync_init(void) {} +void livesync_deinit(void) {} +void livesync_tell(struct ot_workstruct *ws) { (void)ws; } +void stats_init(void) {} +void stats_deinit(void) {} +void stats_issue_event(struct ot_workstruct *ws, ot_status_event event, PROTO_FLAG proto, uintptr_t event_data) { + (void)ws; + (void)event; + (void)proto; + (void)event_data; +} +void stats_counters_register(struct ot_workstruct *ws) { (void)ws; } +void stats_counters_retire(struct ot_workstruct *ws) { (void)ws; } + +const char *g_stats_path; +ssize_t g_stats_path_len; +uint32_t g_tracker_id; -- cgit v1.3