summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bgpd/test_aspath.c4
-rw-r--r--tests/bgpd/test_capability.c4
-rw-r--r--tests/bgpd/test_ecommunity.c2
-rw-r--r--tests/bgpd/test_mp_attr.c4
-rw-r--r--tests/bgpd/test_mpath.c6
-rw-r--r--tests/bgpd/test_packet.c6
-rw-r--r--tests/bgpd/test_peer_attr.c6
-rw-r--r--tests/helpers/c/main.c20
-rw-r--r--tests/isisd/test_common.c2
-rw-r--r--tests/isisd/test_common.h2
-rw-r--r--tests/isisd/test_fuzz_isis_tlv.c2
-rw-r--r--tests/isisd/test_isis_spf.c12
-rw-r--r--tests/lib/cli/common_cli.c14
-rw-r--r--tests/lib/cli/common_cli.h2
-rw-r--r--tests/lib/cli/test_commands.c2
-rw-r--r--tests/lib/cxxcompat.c2
-rw-r--r--tests/lib/fuzz_zlog.c2
-rw-r--r--tests/lib/northbound/test_oper_data.c14
-rw-r--r--tests/lib/test_assert.c6
-rw-r--r--tests/lib/test_buffer.c2
-rw-r--r--tests/lib/test_checksum.c2
-rw-r--r--tests/lib/test_grpc.cpp26
-rw-r--r--tests/lib/test_heavy.c2
-rw-r--r--tests/lib/test_heavy_thread.c16
-rw-r--r--tests/lib/test_heavy_wq.c4
-rw-r--r--tests/lib/test_memory.c2
-rw-r--r--tests/lib/test_nexthop_iter.c2
-rw-r--r--tests/lib/test_privs.c2
-rw-r--r--tests/lib/test_resolver.c2
-rw-r--r--tests/lib/test_segv.c8
-rw-r--r--tests/lib/test_sig.c10
-rw-r--r--tests/lib/test_srcdest_table.c2
-rw-r--r--tests/lib/test_stream.c4
-rw-r--r--tests/lib/test_table.c2
-rw-r--r--tests/lib/test_timer_correctness.c24
-rw-r--r--tests/lib/test_timer_performance.c22
-rw-r--r--tests/lib/test_zmq.c22
-rw-r--r--tests/ospfd/common.c2
-rw-r--r--tests/ospfd/common.h2
-rw-r--r--tests/ospfd/test_ospf_spf.c12
40 files changed, 141 insertions, 141 deletions
diff --git a/tests/bgpd/test_aspath.c b/tests/bgpd/test_aspath.c
index 926097f571..57aa2af9de 100644
--- a/tests/bgpd/test_aspath.c
+++ b/tests/bgpd/test_aspath.c
@@ -26,7 +26,7 @@
/* need these to link in libbgp */
struct zebra_privs_t bgpd_privs = {};
-struct thread_master *master = NULL;
+struct event_loop *master = NULL;
static int failed = 0;
@@ -1405,7 +1405,7 @@ int main(void)
{
int i = 0;
qobj_init();
- bgp_master_init(thread_master_create(NULL), BGP_SOCKET_SNDBUF_SIZE,
+ bgp_master_init(event_master_create(NULL), BGP_SOCKET_SNDBUF_SIZE,
list_new());
master = bm->master;
bgp_option_set(BGP_OPT_NO_LISTEN);
diff --git a/tests/bgpd/test_capability.c b/tests/bgpd/test_capability.c
index 8ef5748671..da17471fd1 100644
--- a/tests/bgpd/test_capability.c
+++ b/tests/bgpd/test_capability.c
@@ -30,7 +30,7 @@
/* need these to link in libbgp */
struct zebra_privs_t bgpd_privs = {};
-struct thread_master *master = NULL;
+struct event_loop *master = NULL;
static int failed = 0;
static int tty = 0;
@@ -925,7 +925,7 @@ int main(void)
term_bgp_debug_as4 = -1UL;
qobj_init();
- master = thread_master_create(NULL);
+ master = event_master_create(NULL);
bgp_master_init(master, BGP_SOCKET_SNDBUF_SIZE, list_new());
vrf_init(NULL, NULL, NULL, NULL);
bgp_option_set(BGP_OPT_NO_LISTEN);
diff --git a/tests/bgpd/test_ecommunity.c b/tests/bgpd/test_ecommunity.c
index bb360722c8..49322d3e2d 100644
--- a/tests/bgpd/test_ecommunity.c
+++ b/tests/bgpd/test_ecommunity.c
@@ -16,7 +16,7 @@
/* need these to link in libbgp */
struct zebra_privs_t bgpd_privs = {};
-struct thread_master *master = NULL;
+struct event_loop *master = NULL;
static int failed = 0;
diff --git a/tests/bgpd/test_mp_attr.c b/tests/bgpd/test_mp_attr.c
index b1f3314f1f..54596dbdfb 100644
--- a/tests/bgpd/test_mp_attr.c
+++ b/tests/bgpd/test_mp_attr.c
@@ -35,7 +35,7 @@
/* need these to link in libbgp */
struct zebra_privs_t bgpd_privs = {};
-struct thread_master *master = NULL;
+struct event_loop *master = NULL;
static int failed = 0;
static int tty = 0;
@@ -1070,7 +1070,7 @@ int main(void)
qobj_init();
cmd_init(0);
bgp_vty_init();
- master = thread_master_create("test mp attr");
+ master = event_master_create("test mp attr");
bgp_master_init(master, BGP_SOCKET_SNDBUF_SIZE, list_new());
vrf_init(NULL, NULL, NULL, NULL);
bgp_option_set(BGP_OPT_NO_LISTEN);
diff --git a/tests/bgpd/test_mpath.c b/tests/bgpd/test_mpath.c
index 3662805971..0124ad9b22 100644
--- a/tests/bgpd/test_mpath.c
+++ b/tests/bgpd/test_mpath.c
@@ -61,7 +61,7 @@ struct testcase_t__ {
};
/* need these to link in libbgp */
-struct thread_master *master = NULL;
+struct event_loop *master = NULL;
extern struct zclient *zclient;
struct zebra_privs_t bgpd_privs = {
.user = NULL,
@@ -378,7 +378,7 @@ int all_tests_count = array_size(all_tests);
static int global_test_init(void)
{
qobj_init();
- master = thread_master_create(NULL);
+ master = event_master_create(NULL);
zclient = zclient_new(master, &zclient_options_default, NULL, 0);
bgp_master_init(master, BGP_SOCKET_SNDBUF_SIZE, list_new());
vrf_init(NULL, NULL, NULL, NULL);
@@ -393,7 +393,7 @@ static int global_test_cleanup(void)
{
if (zclient != NULL)
zclient_free(zclient);
- thread_master_free(master);
+ event_master_free(master);
return 0;
}
diff --git a/tests/bgpd/test_packet.c b/tests/bgpd/test_packet.c
index aeebbd9a35..94c3feaa93 100644
--- a/tests/bgpd/test_packet.c
+++ b/tests/bgpd/test_packet.c
@@ -25,7 +25,7 @@
/* need these to link in libbgp */
struct zebra_privs_t bgpd_privs = {};
-struct thread_master *master = NULL;
+struct event_loop *master = NULL;
static struct bgp *bgp;
static as_t asn = 100;
@@ -41,11 +41,11 @@ int main(int argc, char *argv[])
{
struct peer *peer;
int i, j;
- struct thread t;
+ struct event t;
qobj_init();
bgp_attr_init();
- master = thread_master_create(NULL);
+ master = event_master_create(NULL);
bgp_master_init(master, BGP_SOCKET_SNDBUF_SIZE, list_new());
vrf_init(NULL, NULL, NULL, NULL);
bgp_option_set(BGP_OPT_NO_LISTEN);
diff --git a/tests/bgpd/test_peer_attr.c b/tests/bgpd/test_peer_attr.c
index dde38c8693..bc6eba9069 100644
--- a/tests/bgpd/test_peer_attr.c
+++ b/tests/bgpd/test_peer_attr.c
@@ -106,7 +106,7 @@
/* Required variables to link in libbgp */
struct zebra_privs_t bgpd_privs = {0};
-struct thread_master *master;
+struct event_loop *master;
enum test_state {
TEST_SUCCESS,
@@ -1363,7 +1363,7 @@ static void bgp_startup(void)
zprivs_preinit(&bgpd_privs);
zprivs_init(&bgpd_privs);
- master = thread_master_create(NULL);
+ master = event_master_create(NULL);
nb_init(master, NULL, 0, false);
bgp_master_init(master, BGP_SOCKET_SNDBUF_SIZE, list_new());
bgp_option_set(BGP_OPT_NO_LISTEN);
@@ -1412,7 +1412,7 @@ static void bgp_shutdown(void)
nb_terminate();
yang_terminate();
zprivs_terminate(&bgpd_privs);
- thread_master_free(master);
+ event_master_free(master);
master = NULL;
}
diff --git a/tests/helpers/c/main.c b/tests/helpers/c/main.c
index bb8acd2c44..cd2b5665e2 100644
--- a/tests/helpers/c/main.c
+++ b/tests/helpers/c/main.c
@@ -6,7 +6,7 @@
#include <lib/version.h>
#include "getopt.h"
-#include "thread.h"
+#include "frrevent.h"
#include "vty.h"
#include "command.h"
#include "memory.h"
@@ -14,7 +14,7 @@
extern void test_init(void);
-struct thread_master *master;
+struct event_loop *master;
struct option longopts[] = {{"daemon", no_argument, NULL, 'd'},
{"config_file", required_argument, NULL, 'f'},
@@ -33,17 +33,17 @@ DEFUN (daemon_exit,
}
static int timer_count;
-static void test_timer(struct thread *thread)
+static void test_timer(struct event *thread)
{
- int *count = THREAD_ARG(thread);
+ int *count = EVENT_ARG(thread);
printf("run %d of timer\n", (*count)++);
- thread_add_timer(master, test_timer, count, 5, NULL);
+ event_add_timer(master, test_timer, count, 5, NULL);
}
static void test_timer_init(void)
{
- thread_add_timer(master, test_timer, &timer_count, 10, NULL);
+ event_add_timer(master, test_timer, &timer_count, 10, NULL);
}
static void test_vty_init(void)
@@ -82,7 +82,7 @@ int main(int argc, char **argv)
int vty_port = 4000;
int daemon_mode = 0;
char *progname;
- struct thread thread;
+ struct event thread;
char *config_file = NULL;
/* Set umask before anything for security */
@@ -92,7 +92,7 @@ int main(int argc, char **argv)
progname = ((p = strrchr(argv[0], '/')) ? ++p : argv[0]);
/* master init. */
- master = thread_master_create(NULL);
+ master = event_master_create(NULL);
while (1) {
int opt;
@@ -164,8 +164,8 @@ int main(int argc, char **argv)
test_init();
/* Fetch next active thread. */
- while (thread_fetch(master, &thread))
- thread_call(&thread);
+ while (event_fetch(master, &thread))
+ event_call(&thread);
/* Not reached. */
exit(0);
diff --git a/tests/isisd/test_common.c b/tests/isisd/test_common.c
index 0f37752ce2..d0288f600d 100644
--- a/tests/isisd/test_common.c
+++ b/tests/isisd/test_common.c
@@ -12,7 +12,7 @@
#include "test_common.h"
-struct thread_master *master;
+struct event_loop *master;
struct zebra_privs_t isisd_privs;
int isis_sock_init(struct isis_circuit *circuit)
diff --git a/tests/isisd/test_common.h b/tests/isisd/test_common.h
index 9b83b30ba7..f0c5493c9d 100644
--- a/tests/isisd/test_common.h
+++ b/tests/isisd/test_common.h
@@ -65,7 +65,7 @@ extern int test_topology_load(const struct isis_topology *topology,
struct lspdb_head lspdb[]);
/* Global variables. */
-extern struct thread_master *master;
+extern struct event_loop *master;
extern struct zebra_privs_t isisd_privs;
extern struct isis_topology test_topologies[];
diff --git a/tests/isisd/test_fuzz_isis_tlv.c b/tests/isisd/test_fuzz_isis_tlv.c
index 8f0b92d0fc..627ccfee6f 100644
--- a/tests/isisd/test_fuzz_isis_tlv.c
+++ b/tests/isisd/test_fuzz_isis_tlv.c
@@ -9,7 +9,7 @@
#include "memory.h"
#include "sbuf.h"
#include "stream.h"
-#include "thread.h"
+#include "frrevent.h"
#include "isisd/isis_circuit.h"
#include "isisd/isis_tlvs.h"
diff --git a/tests/isisd/test_isis_spf.c b/tests/isisd/test_isis_spf.c
index 0cccf05678..85ddfea5b5 100644
--- a/tests/isisd/test_isis_spf.c
+++ b/tests/isisd/test_isis_spf.c
@@ -8,7 +8,7 @@
#include <lib/version.h>
#include "getopt.h"
-#include "thread.h"
+#include "frrevent.h"
#include "vty.h"
#include "command.h"
#include "log.h"
@@ -455,7 +455,7 @@ static void vty_do_exit(int isexit)
cmd_terminate();
vty_terminate();
yang_terminate();
- thread_master_free(master);
+ event_master_free(master);
log_memstats(stderr, "test-isis-spf");
if (!isexit)
@@ -488,7 +488,7 @@ int main(int argc, char **argv)
{
char *p;
char *progname;
- struct thread thread;
+ struct event thread;
bool debug = false;
/* Set umask before anything for security */
@@ -521,7 +521,7 @@ int main(int argc, char **argv)
}
/* master init. */
- master = thread_master_create(NULL);
+ master = event_master_create(NULL);
isis_master_init(master);
/* Library inits. */
@@ -549,8 +549,8 @@ int main(int argc, char **argv)
vty_stdio(vty_do_exit);
/* Fetch next active thread. */
- while (thread_fetch(master, &thread))
- thread_call(&thread);
+ while (event_fetch(master, &thread))
+ event_call(&thread);
/* Not reached. */
exit(0);
diff --git a/tests/lib/cli/common_cli.c b/tests/lib/cli/common_cli.c
index 29dad7d80f..e0981b991a 100644
--- a/tests/lib/cli/common_cli.c
+++ b/tests/lib/cli/common_cli.c
@@ -8,7 +8,7 @@
#include <zebra.h>
-#include "thread.h"
+#include "frrevent.h"
#include "vty.h"
#include "command.h"
#include "memory.h"
@@ -17,7 +17,7 @@
#include "common_cli.h"
-struct thread_master *master;
+struct event_loop *master;
int dump_args(struct vty *vty, const char *descr, int argc,
struct cmd_token *argv[])
@@ -39,7 +39,7 @@ static void vty_do_exit(int isexit)
vty_terminate();
nb_terminate();
yang_terminate();
- thread_master_free(master);
+ event_master_free(master);
log_memstats(stderr, "testcli");
if (!isexit)
@@ -52,14 +52,14 @@ int test_log_prio = ZLOG_DISABLED;
/* main routine. */
int main(int argc, char **argv)
{
- struct thread thread;
+ struct event thread;
size_t yangcount;
/* Set umask before anything for security */
umask(0027);
/* master init. */
- master = thread_master_create(NULL);
+ master = event_master_create(NULL);
zlog_aux_init("NONE: ", test_log_prio);
@@ -81,8 +81,8 @@ int main(int argc, char **argv)
vty_stdio(vty_do_exit);
/* Fetch next active thread. */
- while (thread_fetch(master, &thread))
- thread_call(&thread);
+ while (event_fetch(master, &thread))
+ event_call(&thread);
/* Not reached. */
exit(0);
diff --git a/tests/lib/cli/common_cli.h b/tests/lib/cli/common_cli.h
index 7ef4d860bd..4a1de940df 100644
--- a/tests/lib/cli/common_cli.h
+++ b/tests/lib/cli/common_cli.h
@@ -22,7 +22,7 @@ extern void test_init(int argc, char **argv);
/* functions provided by common cli
* (includes main())
*/
-extern struct thread_master *master;
+extern struct event_loop *master;
extern int test_log_prio;
diff --git a/tests/lib/cli/test_commands.c b/tests/lib/cli/test_commands.c
index 54db795757..ea84120fc1 100644
--- a/tests/lib/cli/test_commands.c
+++ b/tests/lib/cli/test_commands.c
@@ -30,7 +30,7 @@ extern vector cmdvec;
extern struct cmd_node vty_node;
extern void test_init_cmd(void); /* provided in test-commands-defun.c */
-struct thread_master *master; /* dummy for libfrr*/
+struct event_loop *master; /* dummy for libfrr*/
static vector test_cmds;
static char test_buf[32768];
diff --git a/tests/lib/cxxcompat.c b/tests/lib/cxxcompat.c
index 7aab88eeb9..8f54856186 100644
--- a/tests/lib/cxxcompat.c
+++ b/tests/lib/cxxcompat.c
@@ -78,7 +78,7 @@
#include "lib/stream.h"
#include "lib/table.h"
#include "lib/termtable.h"
-#include "lib/thread.h"
+#include "frrevent.h"
#include "lib/typesafe.h"
#include "lib/typerb.h"
#include "lib/vector.h"
diff --git a/tests/lib/fuzz_zlog.c b/tests/lib/fuzz_zlog.c
index ad9677a718..d308f8eb2f 100644
--- a/tests/lib/fuzz_zlog.c
+++ b/tests/lib/fuzz_zlog.c
@@ -94,7 +94,7 @@ int main(int argc, char **argv)
cfg->fd = fd;
cmd_hostname_set("TEST");
- cfg->master = thread_master_create("TEST");
+ cfg->master = event_master_create("TEST");
zlog_5424_apply_dst(cfg);
diff --git a/tests/lib/northbound/test_oper_data.c b/tests/lib/northbound/test_oper_data.c
index 3abda75f40..f82eddd3bf 100644
--- a/tests/lib/northbound/test_oper_data.c
+++ b/tests/lib/northbound/test_oper_data.c
@@ -6,7 +6,7 @@
#include <zebra.h>
-#include "thread.h"
+#include "frrevent.h"
#include "vty.h"
#include "command.h"
#include "memory.h"
@@ -14,7 +14,7 @@
#include "log.h"
#include "northbound.h"
-static struct thread_master *master;
+static struct event_loop *master;
struct troute {
struct prefix_ipv4 prefix;
@@ -351,7 +351,7 @@ static void vty_do_exit(int isexit)
vty_terminate();
nb_terminate();
yang_terminate();
- thread_master_free(master);
+ event_master_free(master);
log_memstats(stderr, "test-nb-oper-data");
if (!isexit)
@@ -361,7 +361,7 @@ static void vty_do_exit(int isexit)
/* main routine. */
int main(int argc, char **argv)
{
- struct thread thread;
+ struct event thread;
unsigned int num_vrfs = 2;
unsigned int num_interfaces = 4;
unsigned int num_routes = 6;
@@ -377,7 +377,7 @@ int main(int argc, char **argv)
umask(0027);
/* master init. */
- master = thread_master_create(NULL);
+ master = event_master_create(NULL);
zlog_aux_init("NONE: ", ZLOG_DISABLED);
@@ -395,8 +395,8 @@ int main(int argc, char **argv)
vty_stdio(vty_do_exit);
/* Fetch next active thread. */
- while (thread_fetch(master, &thread))
- thread_call(&thread);
+ while (event_fetch(master, &thread))
+ event_call(&thread);
/* Not reached. */
exit(0);
diff --git a/tests/lib/test_assert.c b/tests/lib/test_assert.c
index d68ee8a819..4440075b41 100644
--- a/tests/lib/test_assert.c
+++ b/tests/lib/test_assert.c
@@ -22,13 +22,13 @@ static void func_for_bt(int number)
#include <zebra.h>
#include "lib/zlog.h"
-#include "lib/thread.h"
+#include "frrevent.h"
#include "lib/sigevent.h"
int main(int argc, char **argv)
{
int number = 10;
- struct thread_master *master;
+ struct event_loop *master;
zlog_aux_init("NONE: ", LOG_DEBUG);
@@ -39,7 +39,7 @@ int main(int argc, char **argv)
assertf(number > 1, "(B) the number was %d", number);
/* set up SIGABRT handler */
- master = thread_master_create("test");
+ master = event_master_create("test");
signal_init(master, 0, NULL);
func_for_bt(number);
diff --git a/tests/lib/test_buffer.c b/tests/lib/test_buffer.c
index 9f501f4e35..bfb4600848 100644
--- a/tests/lib/test_buffer.c
+++ b/tests/lib/test_buffer.c
@@ -8,7 +8,7 @@
#include <lib_vty.h>
#include <buffer.h>
-struct thread_master *master;
+struct event_loop *master;
int main(int argc, char **argv)
{
diff --git a/tests/lib/test_checksum.c b/tests/lib/test_checksum.c
index fcb79ee28d..329ae6087e 100644
--- a/tests/lib/test_checksum.c
+++ b/tests/lib/test_checksum.c
@@ -11,7 +11,7 @@
#include "network.h"
#include "prng.h"
-struct thread_master *master;
+struct event_loop *master;
struct acc_vals {
int c0;
diff --git a/tests/lib/test_grpc.cpp b/tests/lib/test_grpc.cpp
index 282161c3df..fd30f04346 100644
--- a/tests/lib/test_grpc.cpp
+++ b/tests/lib/test_grpc.cpp
@@ -14,7 +14,7 @@
#include "libfrr.h"
#include "routing_nb.h"
#include "northbound_cli.h"
-#include "thread.h"
+#include "frrevent.h"
#include "vrf.h"
#include "vty.h"
@@ -34,13 +34,13 @@
#include <grpcpp/security/credentials.h>
#include "grpc/frr-northbound.grpc.pb.h"
-DEFINE_HOOK(frr_late_init, (struct thread_master * tm), (tm));
+DEFINE_HOOK(frr_late_init, (struct event_loop * tm), (tm));
DEFINE_KOOH(frr_fini, (), ());
struct vty *vty;
bool mpls_enabled;
-struct thread_master *master;
+struct event_loop *master;
struct zebra_privs_t static_privs = {0};
struct frrmod_runtime *grpc_module;
char binpath[2 * MAXPATHLEN + 1];
@@ -66,7 +66,7 @@ static const struct frr_yang_module_info *const staticd_yang_modules[] = {
&frr_staticd_info, &frr_vrf_info,
};
-static void grpc_thread_stop(struct thread *thread);
+static void grpc_thread_stop(struct event *thread);
static void _err_print(const void *cookie, const char *errstr)
{
@@ -97,7 +97,7 @@ static void static_startup(void)
static_debug_init();
- master = thread_master_create(NULL);
+ master = event_master_create(NULL);
nb_init(master, staticd_yang_modules, array_size(staticd_yang_modules),
false);
@@ -139,7 +139,7 @@ static void static_shutdown(void)
cmd_terminate();
nb_terminate();
yang_terminate();
- thread_master_free(master);
+ event_master_free(master);
master = NULL;
}
@@ -479,14 +479,14 @@ void *grpc_client_test_start(void *arg)
// Signal FRR event loop to stop
test_debug("client: pthread: adding event to stop us");
- thread_add_event(master, grpc_thread_stop, NULL, 0, NULL);
+ event_add_event(master, grpc_thread_stop, NULL, 0, NULL);
test_debug("client: pthread: DONE (returning)");
return NULL;
}
-static void grpc_thread_start(struct thread *thread)
+static void grpc_thread_start(struct event *thread)
{
struct frr_pthread_attr client = {
.start = grpc_client_test_start,
@@ -498,7 +498,7 @@ static void grpc_thread_start(struct thread *thread)
frr_pthread_wait_running(pth);
}
-static void grpc_thread_stop(struct thread *thread)
+static void grpc_thread_stop(struct event *thread)
{
std::cout << __func__ << ": frr_pthread_stop_all" << std::endl;
frr_pthread_stop_all();
@@ -542,12 +542,12 @@ int main(int argc, char **argv)
static_startup();
- thread_add_event(master, grpc_thread_start, NULL, 0, NULL);
+ event_add_event(master, grpc_thread_start, NULL, 0, NULL);
/* Event Loop */
- struct thread thread;
- while (thread_fetch(master, &thread))
- thread_call(&thread);
+ struct event thread;
+ while (event_fetch(master, &thread))
+ event_call(&thread);
return 0;
}
diff --git a/tests/lib/test_heavy.c b/tests/lib/test_heavy.c
index 2d54fe6c68..1e56940831 100644
--- a/tests/lib/test_heavy.c
+++ b/tests/lib/test_heavy.c
@@ -13,7 +13,7 @@
*/
#include <zebra.h>
-#include "thread.h"
+#include "frrevent.h"
#include "vty.h"
#include "command.h"
#include "memory.h"
diff --git a/tests/lib/test_heavy_thread.c b/tests/lib/test_heavy_thread.c
index afbd205451..4fb9ebfa3a 100644
--- a/tests/lib/test_heavy_thread.c
+++ b/tests/lib/test_heavy_thread.c
@@ -14,7 +14,7 @@
#include <zebra.h>
#include <math.h>
-#include "thread.h"
+#include "frrevent.h"
#include "vty.h"
#include "command.h"
#include "memory.h"
@@ -22,7 +22,7 @@
#include "tests.h"
-extern struct thread_master *master;
+extern struct event_loop *master;
enum { ITERS_FIRST = 0,
ITERS_ERR = 100,
@@ -56,9 +56,9 @@ static void slow_func(struct vty *vty, const char *str, const int i)
printf("%s did %d, x = %g\n", str, i, x);
}
-static void clear_something(struct thread *thread)
+static void clear_something(struct event *thread)
{
- struct work_state *ws = THREAD_ARG(thread);
+ struct work_state *ws = EVENT_ARG(thread);
/* this could be like iterating through 150k of route_table
* or worse, iterating through a list of peers, to bgp_stop them with
@@ -67,9 +67,9 @@ static void clear_something(struct thread *thread)
while (ws->i < ITERS_MAX) {
slow_func(ws->vty, ws->str, ws->i);
ws->i++;
- if (thread_should_yield(thread)) {
- thread_add_timer_msec(master, clear_something, ws, 0,
- NULL);
+ if (event_should_yield(thread)) {
+ event_add_timer_msec(master, clear_something, ws, 0,
+ NULL);
return;
}
}
@@ -102,7 +102,7 @@ DEFUN (clear_foo,
ws->vty = vty;
ws->i = ITERS_FIRST;
- thread_add_timer_msec(master, clear_something, ws, 0, NULL);
+ event_add_timer_msec(master, clear_something, ws, 0, NULL);
return CMD_SUCCESS;
}
diff --git a/tests/lib/test_heavy_wq.c b/tests/lib/test_heavy_wq.c
index 9b2cfa5730..225573ae92 100644
--- a/tests/lib/test_heavy_wq.c
+++ b/tests/lib/test_heavy_wq.c
@@ -13,7 +13,7 @@
*/
#include <zebra.h>
-#include "thread.h"
+#include "frrevent.h"
#include "vty.h"
#include "command.h"
#include "memory.h"
@@ -27,7 +27,7 @@ DEFINE_MGROUP(TEST_HEAVYWQ, "heavy-wq test");
DEFINE_MTYPE_STATIC(TEST_HEAVYWQ, WQ_NODE, "heavy_wq_node");
DEFINE_MTYPE_STATIC(TEST_HEAVYWQ, WQ_NODE_STR, "heavy_wq_node->str");
-extern struct thread_master *master;
+extern struct event_loop *master;
static struct work_queue *heavy_wq;
struct heavy_wq_node {
diff --git a/tests/lib/test_memory.c b/tests/lib/test_memory.c
index e4423b0b5b..aba4c3589c 100644
--- a/tests/lib/test_memory.c
+++ b/tests/lib/test_memory.c
@@ -15,7 +15,7 @@ DEFINE_MTYPE_STATIC(TEST_MEMORY, TEST, "generic test mtype");
* CVS
*/
-struct thread_master *master;
+struct event_loop *master;
#if 0 /* set to 1 to use system alloc directly */
#undef XMALLOC
diff --git a/tests/lib/test_nexthop_iter.c b/tests/lib/test_nexthop_iter.c
index 2bb0b1233c..91380f1111 100644
--- a/tests/lib/test_nexthop_iter.c
+++ b/tests/lib/test_nexthop_iter.c
@@ -13,7 +13,7 @@
#include "zebra/rib.h"
#include "prng.h"
-struct thread_master *master;
+struct event_loop *master;
static int verbose;
static void str_append(char **buf, const char *repr)
diff --git a/tests/lib/test_privs.c b/tests/lib/test_privs.c
index d7bc0b3153..e26754857b 100644
--- a/tests/lib/test_privs.c
+++ b/tests/lib/test_privs.c
@@ -50,7 +50,7 @@ Report bugs to %s\n",
exit(status);
}
-struct thread_master *master;
+struct event_loop *master;
/* main routine. */
int main(int argc, char **argv)
{
diff --git a/tests/lib/test_resolver.c b/tests/lib/test_resolver.c
index b4d8992b95..d72ff4f5a1 100644
--- a/tests/lib/test_resolver.c
+++ b/tests/lib/test_resolver.c
@@ -26,7 +26,7 @@
#include "tests/lib/cli/common_cli.h"
-extern struct thread_master *master;
+extern struct event_loop *master;
static void resolver_result(struct resolver_query *resq, const char *errstr,
int numaddrs, union sockunion *addr)
diff --git a/tests/lib/test_segv.c b/tests/lib/test_segv.c
index 8532da7c2d..af5f3aec63 100644
--- a/tests/lib/test_segv.c
+++ b/tests/lib/test_segv.c
@@ -17,7 +17,7 @@
struct frr_signal_t sigs[] = {};
-struct thread_master *master;
+struct event_loop *master;
void func1(int *arg);
void func3(void);
@@ -49,19 +49,19 @@ void func3(void)
func2(6, buf);
}
-static void threadfunc(struct thread *thread)
+static void threadfunc(struct event *thread)
{
func3();
}
int main(void)
{
- master = thread_master_create(NULL);
+ master = event_master_create(NULL);
signal_init(master, array_size(sigs), sigs);
zlog_aux_init("NONE: ", LOG_DEBUG);
- thread_execute(master, threadfunc, 0, 0);
+ event_execute(master, threadfunc, 0, 0);
exit(0);
}
diff --git a/tests/lib/test_sig.c b/tests/lib/test_sig.c
index 897e004b40..2bd7f30976 100644
--- a/tests/lib/test_sig.c
+++ b/tests/lib/test_sig.c
@@ -35,18 +35,18 @@ struct frr_signal_t sigs[] = {{
.handler = &sigusr2,
}};
-struct thread_master *master;
-struct thread t;
+struct event_loop *master;
+struct event t;
int main(void)
{
- master = thread_master_create(NULL);
+ master = event_master_create(NULL);
signal_init(master, array_size(sigs), sigs);
zlog_aux_init("NONE: ", LOG_DEBUG);
- while (thread_fetch(master, &t))
- thread_call(&t);
+ while (event_fetch(master, &t))
+ event_call(&t);
exit(0);
}
diff --git a/tests/lib/test_srcdest_table.c b/tests/lib/test_srcdest_table.c
index c1235fe857..6d6c5156a7 100644
--- a/tests/lib/test_srcdest_table.c
+++ b/tests/lib/test_srcdest_table.c
@@ -24,7 +24,7 @@
#define s6_addr32 __u6_addr.__u6_addr32
#endif /*s6_addr32*/
-struct thread_master *master;
+struct event_loop *master;
/* This structure is copied from lib/srcdest_table.c to which it is
* private as far as other parts of Quagga are concerned.
diff --git a/tests/lib/test_stream.c b/tests/lib/test_stream.c
index 015dc41db1..d38dfe0eb0 100644
--- a/tests/lib/test_stream.c
+++ b/tests/lib/test_stream.c
@@ -6,12 +6,12 @@
#include <zebra.h>
#include <stream.h>
-#include <thread.h>
+#include "frrevent.h"
#include "printfrr.h"
static unsigned long long ham = 0xdeadbeefdeadbeef;
-struct thread_master *master;
+struct event_loop *master;
static void print_stream(struct stream *s)
{
diff --git a/tests/lib/test_table.c b/tests/lib/test_table.c
index 41d7003956..51bfda2345 100644
--- a/tests/lib/test_table.c
+++ b/tests/lib/test_table.c
@@ -25,7 +25,7 @@ typedef struct test_node_t_ {
char *prefix_str;
} test_node_t;
-struct thread_master *master;
+struct event_loop *master;
/*
* add_node
diff --git a/tests/lib/test_timer_correctness.c b/tests/lib/test_timer_correctness.c
index 37eb4939a1..04c0516889 100644
--- a/tests/lib/test_timer_correctness.c
+++ b/tests/lib/test_timer_correctness.c
@@ -16,14 +16,14 @@
#include "memory.h"
#include "prng.h"
-#include "thread.h"
+#include "frrevent.h"
#define SCHEDULE_TIMERS 800
#define REMOVE_TIMERS 200
#define TIMESTR_LEN strlen("4294967296.999999")
-struct thread_master *master;
+struct event_loop *master;
static size_t log_buf_len;
static size_t log_buf_pos;
@@ -35,7 +35,7 @@ static char *expected_buf;
static struct prng *prng;
-static struct thread **timers;
+static struct event **timers;
static int timers_pending;
@@ -54,7 +54,7 @@ static void terminate_test(void)
exit_code = 0;
}
- thread_master_free(master);
+ event_master_free(master);
XFREE(MTYPE_TMP, log_buf);
XFREE(MTYPE_TMP, expected_buf);
prng_free(prng);
@@ -63,7 +63,7 @@ static void terminate_test(void)
exit(exit_code);
}
-static void timer_func(struct thread *thread)
+static void timer_func(struct event *thread)
{
int rv;
@@ -94,10 +94,10 @@ static int cmp_timeval(const void *a, const void *b)
int main(int argc, char **argv)
{
int i, j;
- struct thread t;
+ struct event t;
struct timeval **alarms;
- master = thread_master_create(NULL);
+ master = event_master_create(NULL);
log_buf_len = SCHEDULE_TIMERS * (TIMESTR_LEN + 1) + 1;
log_buf_pos = 0;
@@ -119,8 +119,8 @@ int main(int argc, char **argv)
/* Schedule timers to expire in 0..5 seconds */
interval_msec = prng_rand(prng) % 5000;
arg = XMALLOC(MTYPE_TMP, TIMESTR_LEN + 1);
- thread_add_timer_msec(master, timer_func, arg, interval_msec,
- &timers[i]);
+ event_add_timer_msec(master, timer_func, arg, interval_msec,
+ &timers[i]);
ret = snprintf(arg, TIMESTR_LEN + 1, "%lld.%06lld",
(long long)timers[i]->u.sands.tv_sec,
(long long)timers[i]->u.sands.tv_usec);
@@ -137,7 +137,7 @@ int main(int argc, char **argv)
continue;
XFREE(MTYPE_TMP, timers[index]->arg);
- thread_cancel(&timers[index]);
+ event_cancel(&timers[index]);
timers_pending--;
}
@@ -166,8 +166,8 @@ int main(int argc, char **argv)
}
XFREE(MTYPE_TMP, alarms);
- while (thread_fetch(master, &t))
- thread_call(&t);
+ while (event_fetch(master, &t))
+ event_call(&t);
return 0;
}
diff --git a/tests/lib/test_timer_performance.c b/tests/lib/test_timer_performance.c
index 21976e8d31..3ace076b43 100644
--- a/tests/lib/test_timer_performance.c
+++ b/tests/lib/test_timer_performance.c
@@ -14,15 +14,15 @@
#include <stdio.h>
#include <unistd.h>
-#include "thread.h"
+#include "frrevent.h"
#include "prng.h"
#define SCHEDULE_TIMERS 1000000
#define REMOVE_TIMERS 500000
-struct thread_master *master;
+struct event_loop *master;
-static void dummy_func(struct thread *thread)
+static void dummy_func(struct event *thread)
{
}
@@ -30,21 +30,21 @@ int main(int argc, char **argv)
{
struct prng *prng;
int i;
- struct thread **timers;
+ struct event **timers;
struct timeval tv_start, tv_lap, tv_stop;
unsigned long t_schedule, t_remove;
- master = thread_master_create(NULL);
+ master = event_master_create(NULL);
prng = prng_new(0);
timers = calloc(SCHEDULE_TIMERS, sizeof(*timers));
/* create thread structures so they won't be allocated during the
* time measurement */
for (i = 0; i < SCHEDULE_TIMERS; i++) {
- thread_add_timer_msec(master, dummy_func, NULL, 0, &timers[i]);
+ event_add_timer_msec(master, dummy_func, NULL, 0, &timers[i]);
}
for (i = 0; i < SCHEDULE_TIMERS; i++)
- thread_cancel(&timers[i]);
+ event_cancel(&timers[i]);
monotime(&tv_start);
@@ -52,8 +52,8 @@ int main(int argc, char **argv)
long interval_msec;
interval_msec = prng_rand(prng) % (100 * SCHEDULE_TIMERS);
- thread_add_timer_msec(master, dummy_func, NULL, interval_msec,
- &timers[i]);
+ event_add_timer_msec(master, dummy_func, NULL, interval_msec,
+ &timers[i]);
}
monotime(&tv_lap);
@@ -62,7 +62,7 @@ int main(int argc, char **argv)
int index;
index = prng_rand(prng) % SCHEDULE_TIMERS;
- thread_cancel(&timers[index]);
+ event_cancel(&timers[index]);
}
monotime(&tv_stop);
@@ -80,7 +80,7 @@ int main(int argc, char **argv)
fflush(stdout);
free(timers);
- thread_master_free(master);
+ event_master_free(master);
prng_free(prng);
return 0;
}
diff --git a/tests/lib/test_zmq.c b/tests/lib/test_zmq.c
index 59a596e1c8..2cd9d47cb4 100644
--- a/tests/lib/test_zmq.c
+++ b/tests/lib/test_zmq.c
@@ -12,7 +12,7 @@
DEFINE_MTYPE_STATIC(LIB, TESTBUF, "zmq test buffer");
DEFINE_MTYPE_STATIC(LIB, ZMQMSG, "zmq message");
-static struct thread_master *master;
+static struct event_loop *master;
static void msg_buf_free(void *data, void *hint)
{
@@ -212,8 +212,8 @@ static void serverpartfn(void *arg, void *zmqsock, zmq_msg_t *msg,
printf("server recv: %s\n", buf);
fflush(stdout);
- frrzmq_thread_add_write_msg(master, serverwritefn, NULL, msg_id,
- zmqsock, &cb);
+ frrzmq_event_add_write_msg(master, serverwritefn, NULL, msg_id, zmqsock,
+ &cb);
}
static void serverfn(void *arg, void *zmqsock)
@@ -242,8 +242,8 @@ static void serverfn(void *arg, void *zmqsock)
frrzmq_thread_cancel(&cb, &cb->read);
frrzmq_thread_cancel(&cb, &cb->write);
- frrzmq_thread_add_read_part(master, serverpartfn, NULL, NULL, zmqsock,
- &cb);
+ frrzmq_event_add_read_part(master, serverpartfn, NULL, NULL, zmqsock,
+ &cb);
}
static void sigchld(void)
@@ -264,9 +264,9 @@ static void run_server(int syncfd)
{
void *zmqsock;
char dummy = 0;
- struct thread t;
+ struct event t;
- master = thread_master_create(NULL);
+ master = event_master_create(NULL);
signal_init(master, array_size(sigs), sigs);
frrzmq_init();
@@ -276,15 +276,15 @@ static void run_server(int syncfd)
exit(1);
}
- frrzmq_thread_add_read_msg(master, serverfn, NULL, NULL, zmqsock, &cb);
+ frrzmq_event_add_read_msg(master, serverfn, NULL, NULL, zmqsock, &cb);
write(syncfd, &dummy, sizeof(dummy));
- while (thread_fetch(master, &t))
- thread_call(&t);
+ while (event_fetch(master, &t))
+ event_call(&t);
zmq_close(zmqsock);
frrzmq_finish();
- thread_master_free(master);
+ event_master_free(master);
log_memstats_stderr("test");
}
diff --git a/tests/ospfd/common.c b/tests/ospfd/common.c
index ef5e3ed177..e3941865ab 100644
--- a/tests/ospfd/common.c
+++ b/tests/ospfd/common.c
@@ -17,7 +17,7 @@
#include "common.h"
-struct thread_master *master;
+struct event_loop *master;
struct zebra_privs_t ospfd_privs;
diff --git a/tests/ospfd/common.h b/tests/ospfd/common.h
index 6d3e63e359..18e412bd3c 100644
--- a/tests/ospfd/common.h
+++ b/tests/ospfd/common.h
@@ -30,7 +30,7 @@ extern int topology_load(struct vty *vty, struct ospf_topology *topology,
struct ospf_test_node *root, struct ospf *ospf);
/* Global variables. */
-extern struct thread_master *master;
+extern struct event_loop *master;
extern struct ospf_topology topo1;
extern struct ospf_topology topo2;
extern struct ospf_topology topo3;
diff --git a/tests/ospfd/test_ospf_spf.c b/tests/ospfd/test_ospf_spf.c
index b8a2aef69e..fc6b8e89ec 100644
--- a/tests/ospfd/test_ospf_spf.c
+++ b/tests/ospfd/test_ospf_spf.c
@@ -1,7 +1,7 @@
#include <zebra.h>
#include "getopt.h"
-#include "thread.h"
+#include "frrevent.h"
#include <lib/version.h>
#include "vty.h"
#include "command.h"
@@ -208,7 +208,7 @@ static void vty_do_exit(int isexit)
cmd_terminate();
vty_terminate();
- thread_master_free(master);
+ event_master_free(master);
if (!isexit)
exit(0);
@@ -240,7 +240,7 @@ int main(int argc, char **argv)
{
char *p;
char *progname;
- struct thread thread;
+ struct event thread;
bool debug = false;
/* Set umask before anything for security */
@@ -273,7 +273,7 @@ int main(int argc, char **argv)
}
/* master init. */
- master = thread_master_create(NULL);
+ master = event_master_create(NULL);
/* Library inits. */
cmd_init(1);
@@ -297,8 +297,8 @@ int main(int argc, char **argv)
vty_stdio(vty_do_exit);
/* Fetch next active thread. */
- while (thread_fetch(master, &thread))
- thread_call(&thread);
+ while (event_fetch(master, &thread))
+ event_call(&thread);
/* Not reached. */
exit(0);