mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
Use subsystems manager for subsystems used in tests.
This commit is contained in:
parent
a0ee54549f
commit
05b54f6a6a
@ -65,4 +65,8 @@ typedef struct subsys_fns_t {
|
||||
#define MIN_SUBSYS_LEVEL -100
|
||||
#define MAX_SUBSYS_LEVEL 100
|
||||
|
||||
/* All tor "libraries" (in src/libs) should have a subsystem level equal to or
|
||||
* less than this value. */
|
||||
#define SUBSYS_LEVEL_LIBS -10
|
||||
|
||||
#endif
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "core/or/circuitlist.h"
|
||||
#include "app/config/config.h"
|
||||
#include "app/main/subsysmgr.h"
|
||||
#include "lib/crypt_ops/crypto_curve25519.h"
|
||||
#include "lib/crypt_ops/crypto_dh.h"
|
||||
#include "core/crypto/onion_ntor.h"
|
||||
@ -690,9 +691,10 @@ main(int argc, const char **argv)
|
||||
char *errmsg;
|
||||
or_options_t *options;
|
||||
|
||||
tor_threads_init();
|
||||
subsystems_init_upto(SUBSYS_LEVEL_LIBS);
|
||||
flush_log_messages_from_startup();
|
||||
|
||||
tor_compress_init();
|
||||
init_logging(1);
|
||||
|
||||
if (argc == 4 && !strcmp(argv[1], "diff")) {
|
||||
const int N = 200;
|
||||
@ -739,7 +741,6 @@ main(int argc, const char **argv)
|
||||
|
||||
init_protocol_warning_severity_level();
|
||||
options = options_new();
|
||||
init_logging(1);
|
||||
options->command = CMD_RUN_UNITTESTS;
|
||||
options->DataDirectory = tor_strdup("");
|
||||
options->KeyDirectory = tor_strdup("");
|
||||
|
@ -3,6 +3,7 @@
|
||||
#define CRYPTO_ED25519_PRIVATE
|
||||
#include "orconfig.h"
|
||||
#include "core/or/or.h"
|
||||
#include "app/main/subsysmgr.h"
|
||||
#include "lib/err/backtrace.h"
|
||||
#include "app/config/config.h"
|
||||
#include "test/fuzz/fuzzing.h"
|
||||
@ -95,12 +96,10 @@ disable_signature_checking(void)
|
||||
static void
|
||||
global_init(void)
|
||||
{
|
||||
tor_threads_init();
|
||||
tor_compress_init();
|
||||
subsystems_init_upto(SUBSYS_LEVEL_LIBS);
|
||||
flush_log_messages_from_startup();
|
||||
|
||||
/* Initialise logging first */
|
||||
init_logging(1);
|
||||
configure_backtrace_handler(get_version());
|
||||
tor_compress_init();
|
||||
|
||||
if (crypto_global_init(0, NULL, NULL) < 0)
|
||||
abort();
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "lib/evloop/compat_libevent.h"
|
||||
#include "lib/crypt_ops/crypto_init.h"
|
||||
#include "lib/version/torversion.h"
|
||||
#include "app/main/subsysmgr.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_FCNTL_H
|
||||
@ -251,12 +252,9 @@ main(int c, const char **v)
|
||||
int loglevel = LOG_ERR;
|
||||
int accel_crypto = 0;
|
||||
|
||||
/* We must initialise logs before we call tor_assert() */
|
||||
init_logging(1);
|
||||
subsystems_init_upto(SUBSYS_LEVEL_LIBS);
|
||||
|
||||
update_approx_time(time(NULL));
|
||||
options = options_new();
|
||||
tor_threads_init();
|
||||
tor_compress_init();
|
||||
|
||||
network_init();
|
||||
@ -268,7 +266,6 @@ main(int c, const char **v)
|
||||
tor_libevent_initialize(&cfg);
|
||||
|
||||
control_initialize_event_queue();
|
||||
configure_backtrace_handler(get_version());
|
||||
|
||||
for (i_out = i = 1; i < c; ++i) {
|
||||
if (!strcmp(v[i], "--warn")) {
|
||||
@ -295,6 +292,7 @@ main(int c, const char **v)
|
||||
s.masks[LOG_WARN-LOG_ERR] |= LD_BUG;
|
||||
add_stream_log(&s, "", fileno(stdout));
|
||||
}
|
||||
flush_log_messages_from_startup();
|
||||
init_protocol_warning_severity_level();
|
||||
|
||||
options->command = CMD_RUN_UNITTESTS;
|
||||
|
Loading…
Reference in New Issue
Block a user