mirror of https://gerrit.osmocom.org/libosmocore
use osmo_init_logging2() with proper talloc ctx
Ironically, when deprecating osmo_init_logging() in I216837780e9405fdaec8059c63d10699c695b360, I forgot to change the callers within libosmocore itself, i.e. in the various regression tests. Change-Id: Ia36c248f99353d5baaa2533f46a2f60a8579bdf8
This commit is contained in:
parent
3a32147366
commit
a829b45c85
|
@ -199,7 +199,8 @@ static void test_sw_descr()
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
osmo_init_logging(&info);
|
||||
void *ctx = talloc_named_const(NULL, 0, "abis_test");
|
||||
osmo_init_logging2(ctx, &info);
|
||||
|
||||
test_sw_descr();
|
||||
test_simple_sw_config();
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
static unsigned long in_ctr = 1;
|
||||
static struct timeval tv_start;
|
||||
void *ctx = NULL;
|
||||
|
||||
int get_centisec_diff(void)
|
||||
{
|
||||
|
@ -71,7 +72,7 @@ static void test_fc(uint32_t bucket_size_max, uint32_t bucket_leak_rate,
|
|||
uint32_t max_queue_depth, uint32_t pdu_len,
|
||||
uint32_t pdu_count)
|
||||
{
|
||||
struct bssgp_flow_control *fc = talloc_zero(NULL, struct bssgp_flow_control);
|
||||
struct bssgp_flow_control *fc = talloc_zero(ctx, struct bssgp_flow_control);
|
||||
int i;
|
||||
|
||||
osmo_gettimeofday_override_time = (struct timeval){
|
||||
|
@ -133,6 +134,7 @@ int main(int argc, char **argv)
|
|||
uint32_t pdu_count = 20; /* messages */
|
||||
int c;
|
||||
void *tall_msgb_ctx;
|
||||
ctx = talloc_named_const(NULL, 0, "bssgp_fc_test");
|
||||
|
||||
static const struct option long_options[] = {
|
||||
{ "bucket-size-max", 1, 0, 's' },
|
||||
|
@ -144,11 +146,11 @@ int main(int argc, char **argv)
|
|||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
osmo_init_logging(&info);
|
||||
osmo_init_logging2(ctx, &info);
|
||||
log_set_use_color(osmo_stderr_target, 0);
|
||||
log_set_print_filename(osmo_stderr_target, 0);
|
||||
|
||||
tall_msgb_ctx = msgb_talloc_ctx_init(NULL, 0);
|
||||
tall_msgb_ctx = msgb_talloc_ctx_init(ctx, 0);
|
||||
|
||||
while ((c = getopt_long(argc, argv, "s:r:d:l:c:",
|
||||
long_options, NULL)) != -1) {
|
||||
|
|
|
@ -294,11 +294,14 @@ static struct log_info info = {};
|
|||
int main(int argc, char **argv)
|
||||
{
|
||||
struct sockaddr_in bss_peer= {0};
|
||||
void *ctx = talloc_named_const(NULL, 0, "gprs_bssgp_test");
|
||||
|
||||
osmo_init_logging(&info);
|
||||
osmo_init_logging2(ctx, &info);
|
||||
log_set_use_color(osmo_stderr_target, 0);
|
||||
log_set_print_filename(osmo_stderr_target, 0);
|
||||
|
||||
msgb_talloc_ctx_init(ctx, 0);
|
||||
|
||||
bssgp_nsi = gprs_ns_instantiate(gprs_ns_callback, NULL);
|
||||
|
||||
bss_peer.sin_family = AF_INET;
|
||||
|
|
|
@ -901,7 +901,8 @@ static struct log_info info = {};
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
osmo_init_logging(&info);
|
||||
void *ctx = talloc_named_const(NULL, 0, "gprs_ns_test");
|
||||
osmo_init_logging2(ctx, &info);
|
||||
log_set_use_color(osmo_stderr_target, 0);
|
||||
log_set_print_filename(osmo_stderr_target, 0);
|
||||
osmo_signal_register_handler(SS_L_NS, &test_signal, NULL);
|
||||
|
|
|
@ -120,7 +120,8 @@ static struct log_info info = {
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
osmo_init_logging(&info);
|
||||
void *ctx = talloc_named_const(NULL, 0, "gprs_test");
|
||||
osmo_init_logging2(ctx, &info);
|
||||
|
||||
test_gsm_03_03_apn();
|
||||
|
||||
|
|
|
@ -329,7 +329,8 @@ static struct log_info info = {
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
osmo_init_logging(&info);
|
||||
void *ctx = talloc_named_const(NULL, 0, "gsup_test");
|
||||
osmo_init_logging2(ctx, &info);
|
||||
log_set_print_filename(osmo_stderr_target, 0);
|
||||
log_set_print_timestamp(osmo_stderr_target, 0);
|
||||
log_set_use_color(osmo_stderr_target, 0);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <osmocom/gsm/rsl.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <talloc.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -759,7 +760,10 @@ static void test_lapdm_desync()
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
osmo_init_logging(&info);
|
||||
void *ctx = talloc_named_const(NULL, 0, "lapd_test");
|
||||
osmo_init_logging2(ctx, &info);
|
||||
|
||||
msgb_talloc_ctx_init(ctx, 0);
|
||||
|
||||
/* Prevent the test from segfaulting */
|
||||
dummy_l1_header_len = 0;
|
||||
|
|
|
@ -385,7 +385,9 @@ static struct log_info info = {};
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
osmo_init_logging(&info);
|
||||
void *ctx = talloc_named_const(NULL, 0, "msgb_test");
|
||||
osmo_init_logging2(ctx, &info);
|
||||
msgb_talloc_ctx_init(ctx, 0);
|
||||
|
||||
test_msgb_api();
|
||||
test_msgb_api_errors();
|
||||
|
|
|
@ -173,7 +173,9 @@ static struct log_info info = {
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
osmo_init_logging(&info);
|
||||
void *ctx = talloc_named_const(NULL, 0, "oap_test");
|
||||
osmo_init_logging2(ctx, &info);
|
||||
msgb_talloc_ctx_init(ctx, 0);
|
||||
|
||||
test_oap_messages_dec_enc();
|
||||
|
||||
|
|
|
@ -282,9 +282,10 @@ int main(int argc, char** argv)
|
|||
uint8_t septet_data[256];
|
||||
int nchars;
|
||||
char result[256];
|
||||
void *ctx = talloc_named_const(NULL, 0, "sms_test");
|
||||
|
||||
/* Fake logging. */
|
||||
osmo_init_logging(&fake_log_info);
|
||||
osmo_init_logging2(ctx, &fake_log_info);
|
||||
|
||||
/* test 7-bit encoding */
|
||||
for (i = 0; i < ARRAY_SIZE(test_encode); ++i) {
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
|
||||
#include "../config.h"
|
||||
|
||||
void *ctx = NULL;
|
||||
|
||||
static int test_sockinit(void)
|
||||
{
|
||||
int fd, rc;
|
||||
|
@ -44,7 +46,7 @@ static int test_sockinit(void)
|
|||
fd = osmo_sock_init(AF_INET, SOCK_DGRAM, IPPROTO_UDP,
|
||||
"0.0.0.0", 0, OSMO_SOCK_F_BIND);
|
||||
OSMO_ASSERT(fd >= 0);
|
||||
name = osmo_sock_get_name(NULL, fd);
|
||||
name = osmo_sock_get_name(ctx, fd);
|
||||
/* expect it to be not connected. We cannot match on INADDR_ANY,
|
||||
* as apparently that won't work on FreeBSD if there's only one
|
||||
* address (e.g. 127.0.0.1) assigned to the entire system, like
|
||||
|
@ -82,7 +84,7 @@ static int test_sockinit2(void)
|
|||
fd = osmo_sock_init2(AF_INET, SOCK_DGRAM, IPPROTO_UDP,
|
||||
"0.0.0.0", 0, NULL, 0, OSMO_SOCK_F_BIND);
|
||||
OSMO_ASSERT(fd >= 0);
|
||||
name = osmo_sock_get_name(NULL, fd);
|
||||
name = osmo_sock_get_name(ctx, fd);
|
||||
/* expect it to be not connected. We cannot match on INADDR_ANY,
|
||||
* as apparently that won't work on FreeBSD if there's only one
|
||||
* address (e.g. 127.0.0.1) assigned to the entire system, like
|
||||
|
@ -111,7 +113,7 @@ static int test_sockinit2(void)
|
|||
fd = osmo_sock_init2(AF_INET, SOCK_DGRAM, IPPROTO_UDP, "127.0.0.1", 0, "127.0.0.1", 53,
|
||||
OSMO_SOCK_F_BIND|OSMO_SOCK_F_CONNECT);
|
||||
OSMO_ASSERT(fd >= 0);
|
||||
name = osmo_sock_get_name(NULL, fd);
|
||||
name = osmo_sock_get_name(ctx, fd);
|
||||
#ifndef __FreeBSD__
|
||||
/* For some reason, on the jenkins.osmocom.org build slave with
|
||||
* FreeBSD 10 inside a jail, it fails. Works fine on laforge's
|
||||
|
@ -134,7 +136,8 @@ static struct log_info info = {
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
osmo_init_logging(&info);
|
||||
ctx = talloc_named_const(NULL, 0, "socket_test");
|
||||
osmo_init_logging2(ctx, &info);
|
||||
log_set_use_color(osmo_stderr_target, 0);
|
||||
log_set_print_filename(osmo_stderr_target, 0);
|
||||
|
||||
|
|
|
@ -277,7 +277,7 @@ static void test_tlv_repeated_ie()
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
//osmo_init_logging(&info);
|
||||
//osmo_init_logging2(ctx, &info);
|
||||
|
||||
test_tlv_shift_functions();
|
||||
test_tlv_repeated_ie();
|
||||
|
|
|
@ -122,8 +122,9 @@ int main(int argc, char **argv)
|
|||
uint16_t size;
|
||||
int i;
|
||||
struct msgb *msg;
|
||||
void *ctx = talloc_named_const(NULL, 0, "ussd_test");
|
||||
|
||||
osmo_init_logging(&info);
|
||||
osmo_init_logging2(ctx, &info);
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
gsm0480_decode_ss_request((struct gsm48_hdr *) ussd_request,
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <osmocom/vty/stats.h>
|
||||
|
||||
static enum event last_vty_connection_event = -1;
|
||||
void *ctx = NULL;
|
||||
|
||||
static void test_cmd_string_from_valstr(void)
|
||||
{
|
||||
|
@ -55,7 +56,7 @@ static void test_cmd_string_from_valstr(void)
|
|||
|
||||
/* check against character strings that could break printf */
|
||||
|
||||
cmd = vty_cmd_string_from_valstr (NULL, printf_seq_vs, "[prefix%s%s%s%s%s]", "[sep%s%s%s%s%s]", "[end%s%s%s%s%s]", 1);
|
||||
cmd = vty_cmd_string_from_valstr (ctx, printf_seq_vs, "[prefix%s%s%s%s%s]", "[sep%s%s%s%s%s]", "[end%s%s%s%s%s]", 1);
|
||||
printf ("Tested with %%s-strings, resulting cmd = '%s'\n", cmd);
|
||||
talloc_free (cmd);
|
||||
}
|
||||
|
@ -428,12 +429,15 @@ int main(int argc, char **argv)
|
|||
.cat = default_categories,
|
||||
.num_cat = ARRAY_SIZE(default_categories),
|
||||
};
|
||||
void *stats_ctx = talloc_named_const(NULL, 1, "stats test context");
|
||||
void *stats_ctx;
|
||||
|
||||
ctx = talloc_named_const(NULL, 0, "stats test context");
|
||||
stats_ctx = talloc_named_const(ctx, 1, "stats test context");
|
||||
|
||||
osmo_signal_register_handler(SS_L_VTY, vty_event_cb, NULL);
|
||||
|
||||
/* Fake logging. */
|
||||
osmo_init_logging(&log_info);
|
||||
osmo_init_logging2(ctx, &log_info);
|
||||
|
||||
/* Init stats */
|
||||
osmo_stats_init(stats_ctx);
|
||||
|
|
Loading…
Reference in New Issue