tests: accelerate DM retries and TTL with synchronized clocks
This commit is contained in:
1 parent
414d40c00c
commit
39594ad800
6 files changed
+54
-17
No files matched your search
+5
-2
@@ -29,6 +29,7 @@
|
||||
#include "../lib/mem.h"
|
||||
#include "../lib/platform_compat.h"
|
||||
#include "test_utils.h"
|
||||
#include "test_clock.h"
|
||||
|
||||
#include <sqlite3.h>
|
||||
#define OPENSSL_API_COMPAT 0x10100000L
|
||||
@@ -656,6 +657,7 @@ static void dm2_tick(void* arg) {
|
||||
int main(int argc, char** argv) {
|
||||
(void)argc; (void)argv;
|
||||
debug_config_init(); debug_set_level(DEBUG_LEVEL_ERROR);
|
||||
test_clock_init(1000); test_clock_sync_wall_time();
|
||||
if (getenv("UTUN_TEST_DEBUG")) {
|
||||
debug_set_category_level_by_name("dm", "trace");
|
||||
debug_set_category_level_by_name("chat_sync", "info");
|
||||
@@ -706,7 +708,7 @@ int main(int argc, char** argv) {
|
||||
utun_instance_init(t.inst[IDX_B]);
|
||||
|
||||
t.timer = uasync_set_timeout(ua, TICK_TB, &t, dm_tick, "dm_tick");
|
||||
uasync_mainloop(ua);
|
||||
test_clock_mainloop(ua);
|
||||
|
||||
int ok = (t.result == 1);
|
||||
|
||||
@@ -756,7 +758,7 @@ int main(int argc, char** argv) {
|
||||
utun_instance_init(t.inst[IDX_B]);
|
||||
|
||||
t.timer = uasync_set_timeout(ua, TICK_TB, &t, dm2_tick, "dm2_tick");
|
||||
uasync_mainloop(ua);
|
||||
test_clock_mainloop(ua);
|
||||
|
||||
int ok = (t.result == 1);
|
||||
|
||||
@@ -771,5 +773,6 @@ int main(int argc, char** argv) {
|
||||
snprintf(cmd, sizeof(cmd), "rm -rf %s", dir2); (void)!system(cmd);
|
||||
|
||||
printf("\n%d/%d passed, %d failed\n", G_PASSED, G_TOTAL, G_FAILED);
|
||||
test_clock_finish();
|
||||
return G_FAILED > 0 ? 1 : 0;
|
||||
}
|
||||
Reference in new issue
Block a user