From 4d53bbeafb70735690058ccc8acfb81366e7f579 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 24 Oct 2019 20:16:10 -0400 Subject: [PATCH] config: make options_act*() mockable. I'll need this for testing options_trial_assign(). --- src/app/config/config.c | 10 +++++----- src/app/config/config.h | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/app/config/config.c b/src/app/config/config.c index 1041b6b6a3..b6927b8b77 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -822,7 +822,7 @@ static const config_deprecation_t option_deprecation_notes_[] = { #ifdef _WIN32 static char *get_windows_conf_root(void); #endif -static int options_act_reversible(const or_options_t *old_options, char **msg); + static int options_check_transition_cb(const void *old, const void *new, char **msg); @@ -1428,8 +1428,8 @@ static int have_low_ports = -1; * * Return 0 if all goes well, return -1 if things went badly. */ -static int -options_act_reversible(const or_options_t *old_options, char **msg) +MOCK_IMPL(STATIC int, +options_act_reversible,(const or_options_t *old_options, char **msg)) { smartlist_t *new_listeners = smartlist_new(); or_options_t *options = get_options_mutable(); @@ -1857,8 +1857,8 @@ options_transition_affects_dirauth_timing(const or_options_t *old_options, * Note: We haven't moved all the "act on new configuration" logic * here yet. Some is still in do_hup() and other places. */ -STATIC int -options_act(const or_options_t *old_options) +MOCK_IMPL(STATIC int, +options_act,(const or_options_t *old_options)) { config_line_t *cl; or_options_t *options = get_options_mutable(); diff --git a/src/app/config/config.h b/src/app/config/config.h index 2badc1af99..9cc77e2c69 100644 --- a/src/app/config/config.h +++ b/src/app/config/config.h @@ -264,7 +264,9 @@ int options_any_client_port_set(const or_options_t *options); #define CL_PORT_IS_UNIXSOCKET (1u<<6) #define CL_PORT_DFLT_GROUP_WRITABLE (1u<<7) -STATIC int options_act(const or_options_t *old_options); +MOCK_DECL(STATIC int, options_act,(const or_options_t *old_options)); +MOCK_DECL(STATIC int, options_act_reversible,(const or_options_t *old_options, + char **msg)); struct config_mgr_t; STATIC const struct config_mgr_t *get_options_mgr(void);