File: 0004-Fix-tests-on-big-endian.patch

package info (click to toggle)
unicorn-engine 2.1.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,912 kB
  • sloc: ansic: 379,830; python: 9,213; sh: 9,011; java: 8,609; ruby: 4,241; pascal: 1,805; haskell: 1,379; xml: 490; cs: 424; makefile: 348; cpp: 298; asm: 64
file content (46 lines) | stat: -rw-r--r-- 1,404 bytes parent folder | download | duplicates (2)
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
42
43
44
45
46
From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
Date: Wed, 15 Oct 2025 23:43:11 +0200
Subject: Fix tests on big endian

---
 tests/unit/test_mem.c | 4 ++--
 tests/unit/test_x86.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/unit/test_mem.c b/tests/unit/test_mem.c
index 081cbad..8094a0d 100644
--- a/tests/unit/test_mem.c
+++ b/tests/unit/test_mem.c
@@ -567,7 +567,7 @@ static void test_virtual_write(void)
 {
     uc_engine *uc;
     uc_hook hook;
-    uint64_t rax = 21;
+    uint64_t rax = LEINT64(21);
     uint64_t res = 0;
     /*
      * mov rax, [0x2000]
@@ -584,7 +584,7 @@ static void test_virtual_write(void)
 
     OK(uc_emu_start(uc, 0x1000, 0x1000 + sizeof(code) - 1, 0, 1));
     OK(uc_reg_read(uc, UC_X86_REG_RAX, &res));
-    TEST_CHECK(rax == res);
+    TEST_CHECK(res == 21);
 
     OK(uc_close(uc));
 }
diff --git a/tests/unit/test_x86.c b/tests/unit/test_x86.c
index 8eedc31..085b7c0 100644
--- a/tests/unit/test_x86.c
+++ b/tests/unit/test_x86.c
@@ -1690,8 +1690,8 @@ static void test_x86_read_virtual(void)
     uc_assert_err(
         UC_ERR_READ_PROT,
         uc_vmem_read(uc, 0x1000, UC_PROT_WRITE, &tmp, sizeof(tmp)));
-    TEST_CHECK(parrent == 60);
-    TEST_CHECK(child == 42);
+    TEST_CHECK(LEINT64(parrent) == 60);
+    TEST_CHECK(LEINT64(child) == 42);
 }
 
 static bool test_x86_vtlb_callback(uc_engine *uc, uint64_t addr,