summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recipes-devtools/ion/ion-tests/0001-map_test-Replace-PAGE_SIZE-with-local-variable-name.patch69
-rw-r--r--recipes-devtools/ion/ion-tests_git.bb1
2 files changed, 70 insertions, 0 deletions
diff --git a/recipes-devtools/ion/ion-tests/0001-map_test-Replace-PAGE_SIZE-with-local-variable-name.patch b/recipes-devtools/ion/ion-tests/0001-map_test-Replace-PAGE_SIZE-with-local-variable-name.patch
new file mode 100644
index 00000000..8915c642
--- /dev/null
+++ b/recipes-devtools/ion/ion-tests/0001-map_test-Replace-PAGE_SIZE-with-local-variable-name.patch
@@ -0,0 +1,69 @@
1From f045cbf9aae0053e9e785e32b772e473aa892443 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 6 Oct 2019 16:08:36 -0700
4Subject: [PATCH] map_test: Replace PAGE_SIZE with local variable name
5
6PAGE_SIZE is already a define in libc implementations global namespace
7e.g. in musl. Therefore its best to use a unique variable name to not
8stamp on the global definition.
9
10Fixes
11src/map_test.cpp:59:23: error: expected unqualified-id
12unsigned long PAGE_SIZE = sysconf(_SC_PAGESIZE);
13^
14/usr/include/limits.h:89:19: note: expanded from macro 'PAGE_SIZE'
15^
16/usr/include/bits/limits.h:3:18: note: expanded from macro 'PAGESIZE'
17^
18
19Upstream-Status: Submitted [https://github.com/glneo/ion-tests/pull/1]
20
21Signed-off-by: Khem Raj <raj.khem@gmail.com>
22---
23 src/map_test.cpp | 18 +++++++++---------
24 1 file changed, 9 insertions(+), 9 deletions(-)
25
26diff --git a/src/map_test.cpp b/src/map_test.cpp
27index a7ce2c9..7b5746d 100644
28--- a/src/map_test.cpp
29+++ b/src/map_test.cpp
30@@ -56,27 +56,27 @@ TEST_F(Map, MapOffset)
31 SCOPED_TRACE(::testing::Message() << "heap " << heapMask);
32 int map_fd = -1;
33
34- unsigned long PAGE_SIZE = sysconf(_SC_PAGESIZE);
35+ unsigned long psize = sysconf(_SC_PAGESIZE);
36
37- ASSERT_EQ(0, ion_alloc(m_ionFd, PAGE_SIZE * 2, heapMask, 0, &map_fd));
38+ ASSERT_EQ(0, ion_alloc(m_ionFd, psize * 2, heapMask, 0, &map_fd));
39 ASSERT_GE(map_fd, 0);
40
41 unsigned char *ptr;
42- ptr = (unsigned char *)mmap(NULL, PAGE_SIZE * 2, PROT_READ | PROT_WRITE, MAP_SHARED, map_fd, 0);
43+ ptr = (unsigned char *)mmap(NULL, psize * 2, PROT_READ | PROT_WRITE, MAP_SHARED, map_fd, 0);
44 ASSERT_TRUE(ptr != NULL);
45
46- memset(ptr, 0, PAGE_SIZE);
47- memset(ptr + PAGE_SIZE, 0xaa, PAGE_SIZE);
48+ memset(ptr, 0, psize);
49+ memset(ptr + psize, 0xaa, psize);
50
51- ASSERT_EQ(0, munmap(ptr, PAGE_SIZE * 2));
52+ ASSERT_EQ(0, munmap(ptr, psize * 2));
53
54- ptr = (unsigned char *)mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, map_fd, PAGE_SIZE);
55+ ptr = (unsigned char *)mmap(NULL, psize, PROT_READ | PROT_WRITE, MAP_SHARED, map_fd, psize);
56 ASSERT_TRUE(ptr != NULL);
57
58 ASSERT_EQ(ptr[0], 0xaa);
59- ASSERT_EQ(ptr[PAGE_SIZE - 1], 0xaa);
60+ ASSERT_EQ(ptr[psize - 1], 0xaa);
61
62- ASSERT_EQ(0, munmap(ptr, PAGE_SIZE));
63+ ASSERT_EQ(0, munmap(ptr, psize));
64
65 ASSERT_EQ(0, close(map_fd));
66 }
67--
682.23.0
69
diff --git a/recipes-devtools/ion/ion-tests_git.bb b/recipes-devtools/ion/ion-tests_git.bb
index 831f5e8c..52346f1c 100644
--- a/recipes-devtools/ion/ion-tests_git.bb
+++ b/recipes-devtools/ion/ion-tests_git.bb
@@ -8,6 +8,7 @@ PV = "1.0"
8BRANCH = "master" 8BRANCH = "master"
9SRC_URI = "git://github.com/glneo/ion-tests.git;protocol=git;branch=${BRANCH} \ 9SRC_URI = "git://github.com/glneo/ion-tests.git;protocol=git;branch=${BRANCH} \
10 file://0001-CMakeLists.txt-disable-phys-addr-for-now.patch \ 10 file://0001-CMakeLists.txt-disable-phys-addr-for-now.patch \
11 file://0001-map_test-Replace-PAGE_SIZE-with-local-variable-name.patch \
11" 12"
12SRCREV = "70d730cebca29e6fd37b21d9beac82ae645f3900" 13SRCREV = "70d730cebca29e6fd37b21d9beac82ae645f3900"
13 14