|
|
|
|
@ -16,7 +16,6 @@
|
|
|
|
|
#include "../transport_layer/etcp.h" |
|
|
|
|
#include "../config_parser.h" |
|
|
|
|
#include "../config_updater.h" |
|
|
|
|
#include "test_utils.h" |
|
|
|
|
#include "../routing_layer/topo_group.h" |
|
|
|
|
#include "../routing_layer/topo_node.h" |
|
|
|
|
#include "../lib/u_async.h" |
|
|
|
|
@ -59,6 +58,21 @@ static char* gv(const char* p, const char* k) {
|
|
|
|
|
free_config(c); return r; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void test_mkdtemp(char* tmpl) { |
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
char tmp_path[512]; GetTempPathA(sizeof(tmp_path), tmp_path); |
|
|
|
|
snprintf(tmpl, 256, "%s\\utun_test_%08x", tmp_path, (unsigned)rand()); |
|
|
|
|
_mkdir(tmpl); |
|
|
|
|
#else |
|
|
|
|
(void)!mkdtemp(tmpl); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void test_unlink(const char* p) { unlink(p); } |
|
|
|
|
static void test_rmdir(const char* p) { |
|
|
|
|
char cmd[512]; snprintf(cmd, sizeof(cmd), "rm -rf %s", p); system(cmd); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* ── helpers ── */ |
|
|
|
|
|
|
|
|
|
static int count_rows(sqlite3* db, const char* tbl, const char* where, uint64_t val) { |
|
|
|
|
@ -297,6 +311,6 @@ done:
|
|
|
|
|
if (g_a) { g_a->running = 0; utun_instance_destroy(g_a); g_a = NULL; } |
|
|
|
|
if (g_b) { g_b->running = 0; utun_instance_destroy(g_b); g_b = NULL; } |
|
|
|
|
if (g_ua) { uasync_destroy(g_ua, 0); g_ua = NULL; } |
|
|
|
|
{ char cmd[512]; snprintf(cmd, sizeof(cmd), "rm -rf %s", g_tdir); system(cmd); } |
|
|
|
|
test_rmdir(g_tdir); |
|
|
|
|
return g_failed > 0 ? 1 : 0; |
|
|
|
|
} |
|
|
|
|
|