Changeset 3899bc1a in rtems for testsuites


Ignore:
Timestamp:
Nov 24, 2018, 10:51:28 AM (13 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
1c2d178
Parents:
359a3a3
git-author:
Sebastian Huber <sebastian.huber@…> (11/24/18 10:51:28)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/07/18 13:22:01)
Message:

score: Optimize object lookup

Use the maximum ID for the ID to object translation. Using the maximum
ID gets rid of an additional load from the object information in
_Objects_Get(). In addition, object lookups fail for every ID in case
the object information is cleared to zero. This makes it a bit more
robust during system startup (see new tests in spconfig02).

The local table no longer needs a NULL pointer entry at array index
zero. Adjust all the object iteration loops accordingly.

Remove Objects_Information::minimum_id since it contains only redundant
information. Add _Objects_Get_minimum_id() to get the minimum ID.

Update #3621.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/spconfig02/init.c

    r359a3a3 r3899bc1a  
    1919#include <rtems.h>
    2020#include <rtems/score/objectimpl.h>
     21#include <rtems/sysinit.h>
    2122
    2223#include <tmacros.h>
     
    2627static const rtems_name name = rtems_build_name('N', 'A', 'M', 'E');
    2728
    28 static void test_barrier(void)
     29static void test_barrier_create(void)
    2930{
    3031  rtems_status_code sc;
     
    3536}
    3637
    37 static void test_message_queue(void)
     38static void test_barrier_delete(void)
     39{
     40  rtems_status_code sc;
     41  rtems_id id;
     42
     43  sc = rtems_barrier_delete(0);
     44  rtems_test_assert(sc == RTEMS_INVALID_ID);
     45
     46  id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_BARRIERS, 1, 0);
     47  sc = rtems_barrier_delete(id);
     48  rtems_test_assert(sc == RTEMS_INVALID_ID);
     49}
     50
     51static void test_barrier_get(void)
     52{
     53  rtems_status_code sc;
     54  rtems_id id;
     55
     56  sc = rtems_barrier_wait(0, RTEMS_NO_TIMEOUT);
     57  rtems_test_assert(sc == RTEMS_INVALID_ID);
     58
     59  id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_BARRIERS, 1, 0);
     60  sc = rtems_barrier_wait(id, RTEMS_NO_TIMEOUT);
     61  rtems_test_assert(sc == RTEMS_INVALID_ID);
     62}
     63
     64static void test_message_queue_create(void)
    3865{
    3966  rtems_status_code sc;
     
    4875  );
    4976  rtems_test_assert(sc == RTEMS_TOO_MANY);
     77}
     78
     79static void test_message_queue_delete(void)
     80{
     81  rtems_status_code sc;
     82  rtems_id id;
    5083
    5184  sc = rtems_message_queue_delete(0);
     
    5790}
    5891
    59 static void test_partition(void)
     92static void test_message_queue_get(void)
     93{
     94  rtems_status_code sc;
     95  rtems_id id;
     96  uint32_t count;
     97
     98  sc = rtems_message_queue_flush(0, &count);
     99  rtems_test_assert(sc == RTEMS_INVALID_ID);
     100
     101  id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_MESSAGE_QUEUES, 1, 0);
     102  sc = rtems_message_queue_flush(id, &count);
     103  rtems_test_assert(sc == RTEMS_INVALID_ID);
     104}
     105
     106static void test_partition_create(void)
    60107{
    61108  rtems_status_code sc;
     
    72119  );
    73120  rtems_test_assert(sc == RTEMS_TOO_MANY);
     121}
     122
     123static void test_partition_delete(void)
     124{
     125  rtems_status_code sc;
     126  rtems_id id;
    74127
    75128  sc = rtems_partition_delete(0);
     
    81134}
    82135
    83 static void test_rate_monotonic(void)
     136static void test_partition_get(void)
     137{
     138  rtems_status_code sc;
     139  rtems_id id;
     140
     141  sc = rtems_partition_return_buffer(0, NULL);
     142  rtems_test_assert(sc == RTEMS_INVALID_ID);
     143
     144  id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_PARTITIONS, 1, 0);
     145  sc = rtems_partition_return_buffer(id, NULL);
     146  rtems_test_assert(sc == RTEMS_INVALID_ID);
     147}
     148
     149static void test_rate_monotonic_create(void)
    84150{
    85151  rtems_status_code sc;
     
    88154  sc = rtems_rate_monotonic_create(name, &id);
    89155  rtems_test_assert(sc == RTEMS_TOO_MANY);
     156}
     157
     158static void test_rate_monotonic_delete(void)
     159{
     160  rtems_status_code sc;
     161  rtems_id id;
    90162
    91163  sc = rtems_rate_monotonic_delete(0);
     
    97169}
    98170
    99 static void test_region(void)
     171static void test_rate_monotonic_get(void)
     172{
     173  rtems_status_code sc;
     174  rtems_id id;
     175
     176  sc = rtems_rate_monotonic_cancel(0);
     177  rtems_test_assert(sc == RTEMS_INVALID_ID);
     178
     179  id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_PERIODS, 1, 0);
     180  sc = rtems_rate_monotonic_cancel(id);
     181  rtems_test_assert(sc == RTEMS_INVALID_ID);
     182}
     183
     184static void test_region_create(void)
    100185{
    101186  rtems_status_code sc;
     
    112197  );
    113198  rtems_test_assert(sc == RTEMS_TOO_MANY);
     199}
     200
     201static void test_region_delete(void)
     202{
     203  rtems_status_code sc;
     204  rtems_id id;
    114205
    115206  sc = rtems_region_delete(0);
     
    121212}
    122213
    123 static void test_semaphore(void)
     214static void test_region_get(void)
     215{
     216  rtems_status_code sc;
     217  rtems_id id;
     218
     219  sc = rtems_region_return_segment(0, NULL);
     220  rtems_test_assert(sc == RTEMS_INVALID_ID);
     221
     222  id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_REGIONS, 1, 0);
     223  sc = rtems_region_return_segment(id, NULL);
     224  rtems_test_assert(sc == RTEMS_INVALID_ID);
     225}
     226
     227static void test_semaphore_create(void)
    124228{
    125229  rtems_status_code sc;
     
    134238  );
    135239  rtems_test_assert(sc == RTEMS_TOO_MANY);
     240}
     241
     242static void test_semaphore_delete(void)
     243{
     244  rtems_status_code sc;
     245  rtems_id id;
    136246
    137247  sc = rtems_semaphore_delete(0);
     
    143253}
    144254
    145 static void test_task(void)
     255static void test_semaphore_get(void)
     256{
     257  rtems_status_code sc;
     258  rtems_id id;
     259
     260  sc = rtems_semaphore_release(0);
     261  rtems_test_assert(sc == RTEMS_INVALID_ID);
     262
     263  id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_SEMAPHORES, 1, 0);
     264  sc = rtems_semaphore_release(id);
     265  rtems_test_assert(sc == RTEMS_INVALID_ID);
     266}
     267
     268static void test_task_create(void)
    146269{
    147270  rtems_status_code sc;
     
    157280  );
    158281  rtems_test_assert(sc == RTEMS_TOO_MANY);
     282}
     283
     284static void test_task_delete(void)
     285{
     286  rtems_status_code sc;
     287  rtems_id id;
    159288
    160289  id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TASKS, 1, 0);
     
    163292}
    164293
    165 static void test_timer(void)
     294static void test_task_get(void)
     295{
     296  rtems_status_code sc;
     297  rtems_id id;
     298
     299  id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TASKS, 1, 0);
     300  sc = rtems_task_resume(id);
     301  rtems_test_assert(sc == RTEMS_INVALID_ID);
     302}
     303
     304static void test_timer_create(void)
    166305{
    167306  rtems_status_code sc;
     
    170309  sc = rtems_timer_create(name, &id);
    171310  rtems_test_assert(sc == RTEMS_TOO_MANY);
     311}
     312
     313static void test_timer_delete(void)
     314{
     315  rtems_status_code sc;
     316  rtems_id id;
    172317
    173318  sc = rtems_timer_delete(0);
     
    179324}
    180325
    181 static void test_user_extensions(void)
     326static void test_timer_get(void)
     327{
     328  rtems_status_code sc;
     329  rtems_id id;
     330
     331  sc = rtems_timer_reset(0);
     332  rtems_test_assert(sc == RTEMS_INVALID_ID);
     333
     334  id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TIMERS, 1, 0);
     335  sc = rtems_timer_reset(id);
     336  rtems_test_assert(sc == RTEMS_INVALID_ID);
     337}
     338
     339static void test_user_extensions_create(void)
    182340{
    183341  rtems_status_code sc;
     
    188346  sc = rtems_extension_create(name, &table, &id);
    189347  rtems_test_assert(sc == RTEMS_TOO_MANY);
     348}
     349
     350static void test_user_extensions_delete(void)
     351{
     352  rtems_status_code sc;
     353  rtems_id id;
    190354
    191355  sc = rtems_extension_delete(0);
     
    247411static void Init(rtems_task_argument arg)
    248412{
    249   rtems_print_printer_printk(&rtems_test_printer);
    250   TEST_BEGIN();
    251   test_barrier();
    252   test_message_queue();
    253   test_partition();
    254   test_rate_monotonic();
    255   test_region();
    256   test_semaphore();
    257   test_task();
    258   test_timer();
    259   test_user_extensions();
     413  test_barrier_create();
     414  test_barrier_delete();
     415  test_barrier_get();
     416  test_message_queue_create();
     417  test_message_queue_delete();
     418  test_message_queue_get();
     419  test_partition_create();
     420  test_partition_delete();
     421  test_partition_get();
     422  test_rate_monotonic_create();
     423  test_rate_monotonic_delete();
     424  test_rate_monotonic_get();
     425  test_region_create();
     426  test_region_delete();
     427  test_region_get();
     428  test_semaphore_create();
     429  test_semaphore_delete();
     430  test_semaphore_get();
     431  test_task_create();
     432  test_task_delete();
     433  test_task_get();
     434  test_timer_create();
     435  test_timer_delete();
     436  test_timer_get();
     437  test_user_extensions_create();
     438  test_user_extensions_delete();
    260439  test_some_id_to_name();
    261440  TEST_END();
     
    263442}
    264443
     444static void before_object_information_initialization(void)
     445{
     446  rtems_print_printer_printk(&rtems_test_printer);
     447  TEST_BEGIN();
     448  test_barrier_get();
     449  test_message_queue_get();
     450  test_partition_get();
     451  test_rate_monotonic_get();
     452  test_semaphore_get();
     453  test_task_get();
     454  test_timer_get();
     455}
     456
     457RTEMS_SYSINIT_ITEM(
     458  before_object_information_initialization,
     459  RTEMS_SYSINIT_INITIAL_EXTENSIONS,
     460  RTEMS_SYSINIT_ORDER_LAST
     461);
     462
    265463#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
    266464
Note: See TracChangeset for help on using the changeset viewer.