[rtems commit] sppercpudata01: Test PER_CPU_DATA_OFFSET()
Sebastian Huber
sebh at rtems.org
Fri Dec 20 12:36:06 UTC 2019
Module: rtems
Branch: master
Commit: 7c21077db6d42a8176f29e83fbe51afac6f6a717
Changeset: http://git.rtems.org/rtems/commit/?id=7c21077db6d42a8176f29e83fbe51afac6f6a717
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Dec 20 13:27:55 2019 +0100
sppercpudata01: Test PER_CPU_DATA_OFFSET()
Make sure PER_CPU_DATA_OFFSET() is tested also in uniprocessor
configurations.
---
testsuites/sptests/sppercpudata01/init.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/testsuites/sptests/sppercpudata01/init.c b/testsuites/sptests/sppercpudata01/init.c
index eec4883..3d105ee 100644
--- a/testsuites/sptests/sppercpudata01/init.c
+++ b/testsuites/sptests/sppercpudata01/init.c
@@ -25,7 +25,8 @@
const char rtems_test_name[] = "SPPERCPUDATA 1";
-static PER_CPU_DATA_ITEM(unsigned char, c) = 1;
+static RTEMS_ALIGNED(CPU_HEAP_ALIGNMENT)
+ PER_CPU_DATA_ITEM(unsigned char, c) = 1;
static PER_CPU_DATA_ITEM(unsigned char, cz);
@@ -85,6 +86,7 @@ static void test_initial_values(void)
cpu = _Per_CPU_Get_by_index(cpu_index);
off = PER_CPU_DATA_OFFSET(c);
+ rtems_test_assert(off % CPU_HEAP_ALIGNMENT == 0);
c = PER_CPU_DATA_GET_BY_OFFSET(cpu, unsigned char, off);
rtems_test_assert(*c == 1);
@@ -225,6 +227,7 @@ static void test_unique_values(unsigned int v)
rtems_test_assert(*c == (unsigned char) v);
off = PER_CPU_DATA_OFFSET(c);
+ rtems_test_assert(off % CPU_HEAP_ALIGNMENT == 0);
c = PER_CPU_DATA_GET_BY_OFFSET(cpu, unsigned char, off);
rtems_test_assert(*c == (unsigned char) v);
More information about the vc
mailing list