aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_scheduler.c
diff options
context:
space:
mode:
authorMatt Traudt <sirmatt@ksu.edu>2017-09-13 14:32:27 -0400
committerDavid Goulet <dgoulet@torproject.org>2017-09-15 11:40:59 -0400
commit4bc97c6431a7609cd7e2f5b27238338bc9d2c7cd (patch)
treea1453f0847c292a64a2dfaeed4e9ecc381968ff0 /src/test/test_scheduler.c
parent8ccb2c106afa29f5c44101574775f01cd435adbf (diff)
downloadtor-4bc97c6431a7609cd7e2f5b27238338bc9d2c7cd.tar.gz
tor-4bc97c6431a7609cd7e2f5b27238338bc9d2c7cd.zip
sched: revisist compatibility on non-linux systems
Wrap things in HAVE_KIST_SUPPORT until Tor compiles and tests cleanly on my OS X machine.
Diffstat (limited to 'src/test/test_scheduler.c')
-rw-r--r--src/test/test_scheduler.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/test_scheduler.c b/src/test/test_scheduler.c
index 680648344e..7c24bf1465 100644
--- a/src/test/test_scheduler.c
+++ b/src/test/test_scheduler.c
@@ -845,7 +845,9 @@ test_scheduler_channel_states(void *arg)
{
(void)arg;
perform_channel_state_tests(-1); // vanilla
+#ifdef HAVE_KIST_SUPPORT
perform_channel_state_tests(11); // kist
+#endif
}
static void
@@ -865,7 +867,11 @@ test_scheduler_initfree(void *arg)
tt_ptr_op(run_sched_ev, !=, NULL);
/* We have specified nothing in the torrc and there's no consensus so the
* KIST scheduler is what should be in use */
+#ifdef HAVE_KIST_SUPPORT
tt_ptr_op(the_scheduler, ==, get_kist_scheduler());
+#else
+ tt_ptr_op(the_scheduler, ==, get_vanilla_scheduler());
+#endif
tt_int_op(sched_run_interval, ==, 10);
scheduler_free_all();
@@ -901,7 +907,11 @@ test_scheduler_should_use_kist(void *arg)
mocked_options.KISTSchedRunInterval = 1234;
res_should = scheduler_should_use_kist();
res_freq = kist_scheduler_run_interval(NULL);
+#ifdef HAVE_KIST_SUPPORT
tt_int_op(res_should, ==, 1);
+#else /* HAVE_KIST_SUPPORT */
+ tt_int_op(res_should, ==, 0);
+#endif /* HAVE_KIST_SUPPORT */
tt_int_op(res_freq, ==, 1234);
/* Test defer to consensus, but no consensus available */
@@ -909,7 +919,11 @@ test_scheduler_should_use_kist(void *arg)
mocked_options.KISTSchedRunInterval = 0;
res_should = scheduler_should_use_kist();
res_freq = kist_scheduler_run_interval(NULL);
+#ifdef HAVE_KIST_SUPPORT
tt_int_op(res_should, ==, 1);
+#else /* HAVE_KIST_SUPPORT */
+ tt_int_op(res_should, ==, 0);
+#endif /* HAVE_KIST_SUPPORT */
tt_int_op(res_freq, ==, 10);
/* Test defer to consensus, and kist consensus available */
@@ -918,7 +932,11 @@ test_scheduler_should_use_kist(void *arg)
mocked_options.KISTSchedRunInterval = 0;
res_should = scheduler_should_use_kist();
res_freq = kist_scheduler_run_interval(NULL);
+#ifdef HAVE_KIST_SUPPORT
tt_int_op(res_should, ==, 1);
+#else /* HAVE_KIST_SUPPORT */
+ tt_int_op(res_should, ==, 0);
+#endif /* HAVE_KIST_SUPPORT */
tt_int_op(res_freq, ==, 12);
UNMOCK(networkstatus_get_param);
@@ -961,7 +979,11 @@ test_scheduler_ns_changed(void *arg)
MOCK(networkstatus_get_param, mock_kist_networkstatus_get_param);
scheduler_notify_networkstatus_changed(NULL, NULL);
UNMOCK(networkstatus_get_param);
+#ifdef HAVE_KIST_SUPPORT
tt_ptr_op(the_scheduler, ==, get_kist_scheduler());
+#else
+ tt_ptr_op(the_scheduler, ==, get_vanilla_scheduler());
+#endif
/* Change from kist to vanilla via consensus */
the_scheduler = get_kist_scheduler();
@@ -975,7 +997,11 @@ test_scheduler_ns_changed(void *arg)
MOCK(networkstatus_get_param, mock_kist_networkstatus_get_param);
scheduler_notify_networkstatus_changed(NULL, NULL);
UNMOCK(networkstatus_get_param);
+#ifdef HAVE_KIST_SUPPORT
tt_ptr_op(the_scheduler, ==, get_kist_scheduler());
+#else
+ tt_ptr_op(the_scheduler, ==, get_vanilla_scheduler());
+#endif
/* Doesn't change when using vanilla */
the_scheduler = get_vanilla_scheduler();