diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-12-19 09:18:03 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-12-19 09:19:02 -0500 |
commit | bc0f1076d53e57d1a4ba19170a1c27d9eaee34e8 (patch) | |
tree | 0ae2be62abb3a0af7a7df6f238eb05d80cdf34fc /src/test/opts_test_helpers.c | |
parent | 7d5e360c3b74e52ecc997a6accefd39fbbd6f092 (diff) | |
download | tor-bc0f1076d53e57d1a4ba19170a1c27d9eaee34e8.tar.gz tor-bc0f1076d53e57d1a4ba19170a1c27d9eaee34e8.zip |
Move get_foo_options() test helpers into a new test module.
Some of these helpers will be needed in multiple places in the unit
tests, so we should move them now.
Diffstat (limited to 'src/test/opts_test_helpers.c')
-rw-r--r-- | src/test/opts_test_helpers.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/test/opts_test_helpers.c b/src/test/opts_test_helpers.c new file mode 100644 index 0000000000..619ca40733 --- /dev/null +++ b/src/test/opts_test_helpers.c @@ -0,0 +1,38 @@ +/* Copyright (c) 2001 Matej Pfajfar. + * Copyright (c) 2001-2004, Roger Dingledine. + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. + * Copyright (c) 2007-2019, The Tor Project, Inc. */ +/* See LICENSE for licensing information */ + +/** + * @file opts_testing_helpers.c + * @brief Helper functions to access module-specific config options. + **/ + +#include "orconfig.h" +#include "test/opts_test_helpers.h" + +#define CONFIG_PRIVATE +#include "core/or/or.h" +#include "lib/confmgt/confmgt.h" +#include "app/main/subsysmgr.h" +#include "app/config/config.h" + +#include "lib/crypt_ops/crypto_sys.h" +#include "feature/dirauth/dirauth_sys.h" + +struct dirauth_options_t * +get_dirauth_options(struct or_options_t *opt) +{ + int idx = subsystems_get_options_idx(&sys_dirauth); + tor_assert(idx >= 0); + return config_mgr_get_obj_mutable(get_options_mgr(), opt, idx); +} + +struct crypto_options_t * +get_crypto_options(struct or_options_t *opt) +{ + int idx = subsystems_get_options_idx(&sys_crypto); + tor_assert(idx >= 0); + return config_mgr_get_obj_mutable(get_options_mgr(), opt, idx); +} |