summaryrefslogtreecommitdiff
path: root/debian/patches/0003-Test-fix-for-big-endian.patch
blob: e1e39aec7ff001d97314d6c77ac777a89e087daf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From: Ruben Undheim <ruben.undheim@gmail.com>
Date: Thu, 6 Dec 2018 20:46:11 +0100
Subject: Test fix for big-endian

---
 tests/lib/in46a_test.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/lib/in46a_test.c b/tests/lib/in46a_test.c
index 407ac5d..caba155 100644
--- a/tests/lib/in46a_test.c
+++ b/tests/lib/in46a_test.c
@@ -12,13 +12,19 @@
 #include <osmocom/core/logging.h>
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/bits.h>
+#include <osmocom/core/endian.h>
 
 #include "../../lib/in46_addr.h"
 #include "../../lib/syserr.h"
 
 static const struct in46_addr g_ia4 = {
 	.len = 4,
+#if OSMO_IS_LITTLE_ENDIAN == 1
 	.v4.s_addr = 0x0d0c0b0a,
+#else
+	.v4.s_addr = 0x0a0b0c0d,
+#endif
+
 };
 
 static void test_in46a_to_af(void)
@@ -141,7 +147,7 @@ static void test_in46a_to_eua(void)
 	OSMO_ASSERT(in46a_to_eua(&g_ia4, 1, &eua) == 0);
 	OSMO_ASSERT(eua.v[0] == PDP_EUA_ORG_IETF);
 	OSMO_ASSERT(eua.v[1] == PDP_EUA_TYPE_v4);
-	OSMO_ASSERT(osmo_load32le(&eua.v[2]) == g_ia4.v4.s_addr);
+	OSMO_ASSERT(*((uint32_t*)(&eua.v[2])) == g_ia4.v4.s_addr);
 }
 
 static void test_in46a_from_eua(void)