|
|
@@ -55,8 +55,8 @@ test_pe_initialize(void *arg)
|
|
|
rescan_periodic_events(get_options());
|
|
|
|
|
|
/* Validate that all events have been set up. */
|
|
|
- for (int i = 0; periodic_events[i].name; ++i) {
|
|
|
- periodic_event_item_t *item = &periodic_events[i];
|
|
|
+ for (int i = 0; mainloop_periodic_events[i].name; ++i) {
|
|
|
+ periodic_event_item_t *item = &mainloop_periodic_events[i];
|
|
|
tt_assert(item->ev);
|
|
|
tt_assert(item->fn);
|
|
|
tt_u64_op(item->last_action_time, OP_EQ, 0);
|
|
|
@@ -89,8 +89,8 @@ test_pe_launch(void *arg)
|
|
|
/* Hack: We'll set a dumb fn() of each events so they don't get called when
|
|
|
* dispatching them. We just want to test the state of the callbacks, not
|
|
|
* the whole code path. */
|
|
|
- for (int i = 0; periodic_events[i].name; ++i) {
|
|
|
- periodic_event_item_t *item = &periodic_events[i];
|
|
|
+ for (int i = 0; mainloop_periodic_events[i].name; ++i) {
|
|
|
+ periodic_event_item_t *item = &mainloop_periodic_events[i];
|
|
|
item->fn = dumb_event_fn;
|
|
|
}
|
|
|
|
|
|
@@ -116,8 +116,8 @@ test_pe_launch(void *arg)
|
|
|
|
|
|
int mask = PERIODIC_EVENT_ROLE_CLIENT|PERIODIC_EVENT_ROLE_ALL|
|
|
|
PERIODIC_EVENT_ROLE_NET_PARTICIPANT;
|
|
|
- for (int i = 0; periodic_events[i].name; ++i) {
|
|
|
- periodic_event_item_t *item = &periodic_events[i];
|
|
|
+ for (int i = 0; mainloop_periodic_events[i].name; ++i) {
|
|
|
+ periodic_event_item_t *item = &mainloop_periodic_events[i];
|
|
|
int should_be_enabled = !!(item->roles & mask);
|
|
|
tt_int_op(periodic_event_is_enabled(item), OP_EQ, should_be_enabled);
|
|
|
// enabled or not, the event has not yet been run.
|
|
|
@@ -134,8 +134,8 @@ test_pe_launch(void *arg)
|
|
|
PERIODIC_EVENT_ROLE_RELAY|PERIODIC_EVENT_ROLE_DIRSERVER|
|
|
|
PERIODIC_EVENT_ROLE_ALL|PERIODIC_EVENT_ROLE_NET_PARTICIPANT);
|
|
|
|
|
|
- for (int i = 0; periodic_events[i].name; ++i) {
|
|
|
- periodic_event_item_t *item = &periodic_events[i];
|
|
|
+ for (int i = 0; mainloop_periodic_events[i].name; ++i) {
|
|
|
+ periodic_event_item_t *item = &mainloop_periodic_events[i];
|
|
|
/* Only Client role should be disabled. */
|
|
|
if (item->roles == PERIODIC_EVENT_ROLE_CLIENT) {
|
|
|
tt_int_op(periodic_event_is_enabled(item), OP_EQ, 0);
|
|
|
@@ -156,8 +156,8 @@ test_pe_launch(void *arg)
|
|
|
set_network_participation(false);
|
|
|
periodic_events_on_new_options(options);
|
|
|
|
|
|
- for (int i = 0; periodic_events[i].name; ++i) {
|
|
|
- periodic_event_item_t *item = &periodic_events[i];
|
|
|
+ for (int i = 0; mainloop_periodic_events[i].name; ++i) {
|
|
|
+ periodic_event_item_t *item = &mainloop_periodic_events[i];
|
|
|
int should_be_enabled = (item->roles & PERIODIC_EVENT_ROLE_ALL) &&
|
|
|
!(item->flags & PERIODIC_EVENT_FLAG_NEED_NET);
|
|
|
tt_int_op(periodic_event_is_enabled(item), OP_EQ, should_be_enabled);
|
|
|
@@ -177,8 +177,8 @@ test_pe_launch(void *arg)
|
|
|
* trigger a rescan of the event disabling the HS service event. */
|
|
|
to_remove = &service;
|
|
|
|
|
|
- for (int i = 0; periodic_events[i].name; ++i) {
|
|
|
- periodic_event_item_t *item = &periodic_events[i];
|
|
|
+ for (int i = 0; mainloop_periodic_events[i].name; ++i) {
|
|
|
+ periodic_event_item_t *item = &mainloop_periodic_events[i];
|
|
|
tt_int_op(periodic_event_is_enabled(item), OP_EQ,
|
|
|
(item->roles != PERIODIC_EVENT_ROLE_CONTROLEV));
|
|
|
}
|
|
|
@@ -304,8 +304,8 @@ test_pe_hs_service(void *arg)
|
|
|
/* Hack: We'll set a dumb fn() of each events so they don't get called when
|
|
|
* dispatching them. We just want to test the state of the callbacks, not
|
|
|
* the whole code path. */
|
|
|
- for (int i = 0; periodic_events[i].name; ++i) {
|
|
|
- periodic_event_item_t *item = &periodic_events[i];
|
|
|
+ for (int i = 0; mainloop_periodic_events[i].name; ++i) {
|
|
|
+ periodic_event_item_t *item = &mainloop_periodic_events[i];
|
|
|
item->fn = dumb_event_fn;
|
|
|
}
|
|
|
|
|
|
@@ -318,8 +318,8 @@ test_pe_hs_service(void *arg)
|
|
|
* trigger a rescan of the event disabling the HS service event. */
|
|
|
to_remove = &service;
|
|
|
|
|
|
- for (int i = 0; periodic_events[i].name; ++i) {
|
|
|
- periodic_event_item_t *item = &periodic_events[i];
|
|
|
+ for (int i = 0; mainloop_periodic_events[i].name; ++i) {
|
|
|
+ periodic_event_item_t *item = &mainloop_periodic_events[i];
|
|
|
if (item->roles & PERIODIC_EVENT_ROLE_HS_SERVICE) {
|
|
|
tt_int_op(periodic_event_is_enabled(item), OP_EQ, 1);
|
|
|
}
|
|
|
@@ -329,8 +329,8 @@ test_pe_hs_service(void *arg)
|
|
|
/* Remove the service from the global map, it should trigger a rescan and
|
|
|
* disable the HS service events. */
|
|
|
remove_service(get_hs_service_map(), &service);
|
|
|
- for (int i = 0; periodic_events[i].name; ++i) {
|
|
|
- periodic_event_item_t *item = &periodic_events[i];
|
|
|
+ for (int i = 0; mainloop_periodic_events[i].name; ++i) {
|
|
|
+ periodic_event_item_t *item = &mainloop_periodic_events[i];
|
|
|
if (item->roles & PERIODIC_EVENT_ROLE_HS_SERVICE) {
|
|
|
tt_int_op(periodic_event_is_enabled(item), OP_EQ, 0);
|
|
|
}
|