Commit Graph

20 Commits

Author SHA1 Message Date
Philipp Maier c0a0b2562b iu_helpers: add function ranap_transp_layer_addr_decode2
Add ranap_transp_layer_addr_decode2 as AF agnostic version of
ranap_transp_layer_addr_decode.

Change-Id: Ia60e0ab671fc4185815a880377ab88fcf1b30ac9
2022-01-11 13:16:54 +00:00
Philipp Maier 45631aa04f add unittest for ranap_transp_layer_addr_decode()
The function ranap_transp_layer_addr_decode() lacks a unit test. Lets
add one.

Change-Id: I6d7427dc07c858a8dd76c1fb536ec3df3d96f1b1
2022-01-11 13:16:54 +00:00
Philipp Maier ed1537e9cb iu_helpers: make new_transp_info_(rtp|gtp) public
The functions new_transp_info_rtp and new_transp_info_gtp are needed to
generate the transport layer information struct. The functions are currently
not public since they are only used in ranap_msg_factory.c but to
reqwrite the RANAP RAB AssignmentReqtest / AssignmentResponse messages we
can reuse this code, so lets make them public.

Change-Id: I1e369718de8c4c7db1f1af1e6864562164ada6cf
Related: OS#5152
2022-01-10 14:00:29 +00:00
Pau Espin 1562225332 Introduce dynamic log category for libosmo-rua/hnbap
Same as already done for libosmo-ranap.
This allows applications setting the cateogy dynamically, and will allow
untangling library tests using hnbgw log categories in this repo.

Change-Id: I5d09b67b115ad8938e5162a23accfcbafab139d4
2022-01-04 18:57:22 +01:00
Pau Espin 4f35665b9f 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
2020-05-19 20:32:58 +00:00
Pau Espin 6f66feb42d tests: Fix trailing whitespace
Change-Id: I3ef7a3f1c3247615619a0d01c92d8f80572b0dfe
2020-05-19 20:32:58 +00:00
Harald Welte 7712808e07 Fix compilation with gcc-10
/usr/bin/ld: test_common.o:(.bss+0x0): multiple definition of `talloc_asn1_ctx'; test-helpers.o:(.bss+0x0): first defined here

See also https://alioth-lists.debian.net/pipermail/debian-mobcom-maintainers/Week-of-Mon-20200413/000652.html

Change-Id: I4ce41158bb27e6b9242613106f226fc86995c53c
2020-04-20 20:01:53 +02:00
Vadim Yanitskiy 81fd48d741 tests/test-helpers: fix endianness: do not print uint32_t as raw bytes
This unit test would not pass on big-endian machines.

Change-Id: I60dbcaa89b031c9a81c35e1dd0d9c963d486014c
2020-04-07 21:05:37 +07:00
Vadim Yanitskiy 89062aeb21 tests/test-helpers: fix some -Wpointer-sign warnings reported by GCC
Change-Id: I7ebc99fe919fe7ba515c9d8ba601dceb820bf11f
2020-04-07 21:01:12 +07:00
Neels Hofmeyr d9cb19a8fb tests: sanitize: fix mem leaks, clean after tests
Fix various mem leaks in the testing code.

Add test_common_cleanup() in test_common.c, to free talloc contexts; call in
test-{helpers,hnbap,ranap}.c. Upon talloc ctx cleanup, ensure that they are
actually empty, in order to catch newly introduced mem leaks.

If non-empty, print talloc context reports.

Change-Id: Ic66c005f2a264774e18bb54e58b87bef5944511c
2017-11-22 03:11:40 +01:00
Neels Hofmeyr d8013d1f8c ranap_parse_lai(): Fix wrong BCD decoding for MNC. Add test.
Fix the ranap_parse_lai() part that decodes the MNC: place the *10 at the
proper MNC digit.

Add a comprehensive test for ranap_parse_lai() in test-helpers.c. Because
ranap_parse_lai() logs things, add test_common.c to test-helpers compilation
and an expected stderr output to test-helpers' testsuite.at def.
2016-04-06 18:55:14 +02:00
Neels Hofmeyr 96979af054 move ranap_*.h,iu_helpers.h to include/osmocom/ranap/
A bit hacky: the ranap_ies_defs.h is generated together with the
ranap_encoder.c and ranap_decoder.c. See comments in src/Makefile.am and
include/osmocom/ranap/Makefile.am.
2016-01-05 15:37:23 +01:00
Harald Welte 056984fab1 merge (+rename) iu_helpers.c into libosmo-ranap 2016-01-03 16:31:31 +01:00
Daniel Willmann 9a12a4b992 test-helpers: Also print out hexdump of encoded bit string 2015-11-30 16:27:11 +01:00
Daniel Willmann b2548fb1e8 asn1helpers, test-helpers: Use ntoh/hton* to convert integers
Since the asn1_u32/24_to_bitstring functions need to change the source
variable change the signature to clarify that the uint32_t * will be
modified.
2015-11-30 16:24:57 +01:00
Daniel Willmann 8ea918d772 tests: Test cropping of string still is NULL-terminated 2015-11-23 15:59:02 +01:00
Daniel Willmann ec0e50e148 tests: Test asn1_strncpy function 2015-11-23 15:48:59 +01:00
Daniel Willmann 54a9a143f0 tests: Test asn1_u32_to_bitstring and asn1bitstr_to_u32 2015-11-23 14:02:38 +01:00
Harald Welte 77847ad020 add copyright statement and AGPLv3 headers to source code files 2015-10-06 22:07:04 +02:00
Harald Welte 35cbc11757 add unit test for BCD encoding/decoding 2015-09-11 17:36:59 +02:00