summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDebian Mobcom Maintainers <Debian-mobcom-maintainers@lists.alioth.debian.org>2018-12-06 21:51:02 +0100
committerRuben Undheim <ruben.undheim@gmail.com>2018-12-06 21:54:14 +0100
commit2f92067616351720cfc945e58dd9108d769b2617 (patch)
tree7f860bce0af273d607b05c8cc4c380ad835ff1c7
parentd89018aa5a917de7e3237c3c908c6ba3db0e09aa (diff)
Fix test suite for big endian architectures
Gbp-Pq: Name fix_bigend_tests.patch
-rw-r--r--src/ranap_msg_factory.c6
-rw-r--r--src/tests/test-helpers.c5
2 files changed, 10 insertions, 1 deletions
diff --git a/src/ranap_msg_factory.c b/src/ranap_msg_factory.c
index c287f02..248a6d6 100644
--- a/src/ranap_msg_factory.c
+++ b/src/ranap_msg_factory.c
@@ -27,6 +27,8 @@
#include <osmocom/ranap/ranap_common.h>
#include <osmocom/ranap/ranap_ies_defs.h>
#include <osmocom/ranap/ranap_msg_factory.h>
+#include <osmocom/core/byteswap.h>
+#include <osmocom/core/endian.h>
#define DRANAP _ranap_DRANAP
@@ -122,7 +124,11 @@ struct msgb *ranap_new_msg_initial_ue(uint32_t conn_id, int is_ps,
struct msgb *msg;
uint32_t ctxidbuf;
int rc;
+#if OSMO_IS_BIG_ENDIAN == 1
+ uint16_t buf0 = 0x4223;
+#else
uint16_t buf0 = 0x2342;
+#endif
memset(&ies, 0, sizeof(ies));
if (is_ps)
diff --git a/src/tests/test-helpers.c b/src/tests/test-helpers.c
index f218a79..3799bc3 100644
--- a/src/tests/test-helpers.c
+++ b/src/tests/test-helpers.c
@@ -31,6 +31,7 @@
#include <osmocom/gsm/gsm48.h>
#include <osmocom/ranap/RANAP_LAI.h>
+#include <osmocom/core/byteswap.h>
int asn1_xer_print = 0;
void *talloc_asn1_ctx;
@@ -98,8 +99,10 @@ void test_asn1_helpers(void)
printf("Decoding back to uint32_t: 0x%x\n", res);
ASSERT(res == val1);
+ uint32_t val1_adjusted;
+ val1_adjusted = osmo_swab32(osmo_htonl(val1));
printf("Encoding %s to 24-bit asn.1 bitstring\n",
- osmo_hexdump_nospc((unsigned char*)&val1, 3));
+ osmo_hexdump_nospc((unsigned char*)&val1_adjusted, 3));
asn1_u24_to_bitstring(&enc, &tmpval, val1);
ASSERT(enc.size == 24/8);