Changeset a5d31fe in rtems


Ignore:
Timestamp:
Jun 12, 2017, 1:47:18 AM (2 years ago)
Author:
Joel Sherrill <joel@…>
Branches:
master
Children:
5700d8ba
Parents:
d30c2cc
git-author:
Joel Sherrill <joel@…> (06/12/17 01:47:18)
git-committer:
Joel Sherrill <joel@…> (06/21/17 17:50:29)
Message:

rbheap01/init.c: Fix PAGE_SIZE redefined warning

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/libtests/rbheap01/init.c

    rd30c2cc ra5d31fe  
    2929static rtems_task Init(rtems_task_argument argument);
    3030
    31 #define PAGE_SIZE 1024
    32 
    33 #define PAGE_COUNT 8
    34 
    35 static char area [PAGE_SIZE * PAGE_COUNT + PAGE_SIZE - 1];
    36 
    37 static rtems_rbheap_chunk chunks [PAGE_COUNT];
     31#define TEST_PAGE_SIZE 1024
     32
     33#define TEST_PAGE_COUNT 8
     34
     35static char area [TEST_PAGE_SIZE * TEST_PAGE_COUNT + TEST_PAGE_SIZE - 1];
     36
     37static rtems_rbheap_chunk chunks [TEST_PAGE_COUNT];
    3838
    3939static void extend_descriptors(rtems_rbheap_control *control)
     
    5050    chain,
    5151    chunks,
    52     PAGE_COUNT,
     52    TEST_PAGE_COUNT,
    5353    sizeof(chunks [0])
    5454  );
     
    5858{
    5959  uintptr_t base = (uintptr_t) area;
    60   uintptr_t excess = base % PAGE_SIZE;
     60  uintptr_t excess = base % TEST_PAGE_SIZE;
    6161
    6262  if (excess > 0) {
    63     base += PAGE_SIZE - excess;
     63    base += TEST_PAGE_SIZE - excess;
    6464  }
    6565
    66   return (chunk->begin - base) / PAGE_SIZE;
     66  return (chunk->begin - base) / TEST_PAGE_SIZE;
    6767}
    6868
     
    103103  sc = rtems_rbheap_initialize(
    104104    &control,
    105     (void *) PAGE_SIZE,
    106     (uintptr_t) -PAGE_SIZE,
    107     PAGE_SIZE,
     105    (void *) TEST_PAGE_SIZE,
     106    (uintptr_t) -TEST_PAGE_SIZE,
     107    TEST_PAGE_SIZE,
    108108    extend_descriptors,
    109109    NULL
     
    119119  sc = rtems_rbheap_initialize(
    120120    &control,
    121     (void *) -(PAGE_SIZE / 2),
    122     PAGE_SIZE,
    123     PAGE_SIZE,
     121    (void *) -(TEST_PAGE_SIZE / 2),
     122    TEST_PAGE_SIZE,
     123    TEST_PAGE_SIZE,
    124124    extend_descriptors,
    125125    NULL
     
    135135  sc = rtems_rbheap_initialize(
    136136    &control,
    137     (void *) PAGE_SIZE,
    138     PAGE_SIZE / 2,
    139     PAGE_SIZE,
     137    (void *) TEST_PAGE_SIZE,
     138    TEST_PAGE_SIZE / 2,
     139    TEST_PAGE_SIZE,
    140140    extend_descriptors,
    141141    NULL
     
    151151  sc = rtems_rbheap_initialize(
    152152    &control,
    153     (void *) PAGE_SIZE,
    154     PAGE_SIZE,
    155     PAGE_SIZE,
     153    (void *) TEST_PAGE_SIZE,
     154    TEST_PAGE_SIZE,
     155    TEST_PAGE_SIZE,
    156156    rtems_rbheap_extend_descriptors_never,
    157157    NULL
     
    173173  rtems_test_assert(
    174174    rtems_chain_node_count_unprotected(&control->spare_descriptor_chain)
    175       == PAGE_COUNT - chunk_count
     175      == TEST_PAGE_COUNT - chunk_count
    176176  );
    177177
     
    202202    area,
    203203    sizeof(area),
    204     PAGE_SIZE,
     204    TEST_PAGE_SIZE,
    205205    extend_descriptors,
    206206    NULL
     
    215215  static const chunk_descriptor chunks_0 [] = {
    216216    { 0, true },
    217     { PAGE_COUNT - 1, false }
     217    { TEST_PAGE_COUNT - 1, false }
    218218  };
    219219  static const chunk_descriptor chunks_1 [] = {
     
    227227  test_init_successful(&control);
    228228
    229   ptr = rtems_rbheap_allocate(&control, PAGE_SIZE);
     229  ptr = rtems_rbheap_allocate(&control, TEST_PAGE_SIZE);
    230230  rtems_test_assert(ptr != NULL);
    231231
     
    266266  test_init_successful(&control);
    267267
    268   ptr = rtems_rbheap_allocate(&control, (PAGE_COUNT + 1) * PAGE_SIZE);
     268  ptr = rtems_rbheap_allocate(&control, (TEST_PAGE_COUNT + 1) * TEST_PAGE_SIZE);
    269269  rtems_test_assert(ptr == NULL);
    270270
     
    287287  test_init_successful(&control);
    288288
    289   ptr = rtems_rbheap_allocate(&control, PAGE_COUNT * PAGE_SIZE);
     289  ptr = rtems_rbheap_allocate(&control, TEST_PAGE_COUNT * TEST_PAGE_SIZE);
    290290  rtems_test_assert(ptr != NULL);
    291291
     
    316316  rtems_status_code sc = RTEMS_SUCCESSFUL;
    317317  rtems_rbheap_control control;
    318   void *ptr [PAGE_COUNT];
     318  void *ptr [TEST_PAGE_COUNT];
    319319  void *null = NULL;
    320320  int i = 0;
     
    322322  test_init_successful(&control);
    323323
    324   for (i = 0; i < PAGE_COUNT; ++i) {
    325     ptr [i] = rtems_rbheap_allocate(&control, PAGE_SIZE);
     324  for (i = 0; i < TEST_PAGE_COUNT; ++i) {
     325    ptr [i] = rtems_rbheap_allocate(&control, TEST_PAGE_SIZE);
    326326    rtems_test_assert(ptr [i] != NULL);
    327327  }
     
    329329  TEST_PAGE_TREE(&control, chunks_0);
    330330
    331   null = rtems_rbheap_allocate(&control, PAGE_SIZE);
     331  null = rtems_rbheap_allocate(&control, TEST_PAGE_SIZE);
    332332  rtems_test_assert(null == NULL);
    333333
    334334  TEST_PAGE_TREE(&control, chunks_0);
    335335
    336   for (i = 0; i < PAGE_COUNT; ++i) {
     336  for (i = 0; i < TEST_PAGE_COUNT; ++i) {
    337337    sc = rtems_rbheap_free(&control, ptr [i]);
    338338    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     
    349349  test_init_successful(&control);
    350350
    351   p = rtems_rbheap_allocate(&control, PAGE_SIZE - 1);
     351  p = rtems_rbheap_allocate(&control, TEST_PAGE_SIZE - 1);
    352352  rtems_test_assert(p != NULL);
    353353}
     
    364364    area,
    365365    sizeof(area),
    366     PAGE_SIZE,
     366    TEST_PAGE_SIZE,
    367367    rtems_rbheap_extend_descriptors_with_malloc,
    368368    NULL
     
    372372  opaque = rtems_heap_greedy_allocate(NULL, 0);
    373373
    374   p = rtems_rbheap_allocate(&control, PAGE_SIZE);
     374  p = rtems_rbheap_allocate(&control, TEST_PAGE_SIZE);
    375375  rtems_test_assert(p == NULL);
    376376
    377377  rtems_heap_greedy_free(opaque);
    378378
    379   p = rtems_rbheap_allocate(&control, PAGE_SIZE);
     379  p = rtems_rbheap_allocate(&control, TEST_PAGE_SIZE);
    380380  rtems_test_assert(p != NULL);
    381381}
     
    411411  test_init_successful(&control);
    412412
    413   ptr = rtems_rbheap_allocate(&control, PAGE_COUNT * PAGE_SIZE);
     413  ptr = rtems_rbheap_allocate(&control, TEST_PAGE_COUNT * TEST_PAGE_SIZE);
    414414  rtems_test_assert(ptr != NULL);
    415415
     
    479479
    480480  for (i = sizeof(ptr) / sizeof(ptr [0]) - 1; i >= 0; --i) {
    481     ptr [i] = rtems_rbheap_allocate(&control, PAGE_SIZE);
     481    ptr [i] = rtems_rbheap_allocate(&control, TEST_PAGE_SIZE);
    482482    rtems_test_assert(ptr [i] != NULL);
    483483  }
Note: See TracChangeset for help on using the changeset viewer.