aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-05-18 10:34:43 +0200
committerlaforge <laforge@osmocom.org>2020-05-19 20:32:58 +0000
commit4f35665b9faecb4705f58dcf9938f087ae3e5a5a (patch)
treee8dfd62c29275210f09d9ab5420d9ea75de5008d /src
parent6f66feb42d0cd68f23a1ae4fff55f58a278820d6 (diff)
Fix OneDefinitionRule Asan violation in tests and osmo-hnbgw
With new gcc 10.1.0, tests failed at runtime when built with ASAN enabled, since some global variables where defined multiple times. See OS#4556 for a sample Asan error. Fixes: OS#4556 Change-Id: I12a667ea8a9f16404c13c9218b246d2e3acfe3e8
Diffstat (limited to 'src')
-rw-r--r--src/hnbap_common.c4
-rw-r--r--src/tests/dummy_cn_sua.c3
-rw-r--r--src/tests/test-helpers.c3
-rw-r--r--src/tests/test-ranap.c4
-rw-r--r--src/tests/test_common.c2
5 files changed, 6 insertions, 10 deletions
diff --git a/src/hnbap_common.c b/src/hnbap_common.c
index f8cfb13..4e79467 100644
--- a/src/hnbap_common.c
+++ b/src/hnbap_common.c
@@ -106,10 +106,6 @@ char *hnbap_cause_str(Cause_t *cause)
return buf;
}
-
-int asn_debug = 0;
-int asn1_xer_print = 0;
-
static struct msgb *hnbap_msgb_alloc(void)
{
return msgb_alloc(1024, "HNBAP Tx");
diff --git a/src/tests/dummy_cn_sua.c b/src/tests/dummy_cn_sua.c
index aba6c8a..6e14562 100644
--- a/src/tests/dummy_cn_sua.c
+++ b/src/tests/dummy_cn_sua.c
@@ -26,7 +26,6 @@
#include <osmocom/ranap/ranap_msg_factory.h>
#include <osmocom/iuh/hnbgw.h>
-int asn1_xer_print = 1;
const char *cmdline_bind_addr = "127.0.0.1";
struct ue_conn_ctx {
@@ -364,6 +363,8 @@ int main(int argc, char **argv)
int rc;
int port = 14001;
+ asn1_xer_print = 1;
+
osmo_sua_set_log_area(DSUA);
ranap_set_log_area(DRANAP);
diff --git a/src/tests/test-helpers.c b/src/tests/test-helpers.c
index aafe815..cfe2140 100644
--- a/src/tests/test-helpers.c
+++ b/src/tests/test-helpers.c
@@ -32,7 +32,6 @@
#include <osmocom/ranap/RANAP_LAI.h>
-int asn1_xer_print = 0;
extern void *talloc_asn1_ctx;
/* use odd number of digits */
@@ -207,6 +206,8 @@ void test_ranap_common(void)
int main(int argc, char **argv)
{
+ asn1_xer_print = 0;
+
test_common_init();
test_iu_helpers();
diff --git a/src/tests/test-ranap.c b/src/tests/test-ranap.c
index efa2241..a6df186 100644
--- a/src/tests/test-ranap.c
+++ b/src/tests/test-ranap.c
@@ -34,8 +34,6 @@
#include <osmocom/iuh/hnbgw.h>
-int asn1_xer_print = 1;
-
extern void *tall_msgb_ctx;
static void test_aper_int(uint32_t inp)
@@ -95,6 +93,8 @@ int main(int argc, char **argv)
uint8_t ck[16] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 };
int i;
+ asn1_xer_print = 1;
+
//asn_debug = 1;
test_common_init();
diff --git a/src/tests/test_common.c b/src/tests/test_common.c
index 701d581..7c6f62a 100644
--- a/src/tests/test_common.c
+++ b/src/tests/test_common.c
@@ -41,8 +41,6 @@
#include <osmocom/iuh/hnbgw.h>
-void *talloc_asn1_ctx;
-
static const struct log_info_cat log_cat[] = {
[DMAIN] = {
.name = "DMAIN", .loglevel = LOGL_INFO, .enabled = 1,