Changeset f933b65 in rtems


Ignore:
Timestamp:
Aug 7, 2020, 4:07:52 PM (6 weeks ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
20b1bdb
Parents:
e812f81
git-author:
Sebastian Huber <sebastian.huber@…> (08/07/20 16:07:52)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/07/20 16:09:56)
Message:

libtest: Improve T_check_task_context

Update #3199.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libtest/t-test-rtems-context.c

    re812f81 rf933b65  
    3030#include <rtems/test.h>
    3131
     32#include <rtems.h>
    3233#include <rtems/score/isrlevel.h>
    3334#include <rtems/score/percpu.h>
     
    3637#include <inttypes.h>
    3738
     39#ifdef RTEMS_SMP
     40static rtems_id T_runner_scheduler;
     41#endif
     42
     43static rtems_task_priority T_runner_priority;
     44
     45static void
     46T_initialize_runner_properties(void)
     47{
     48        rtems_status_code sc;
     49
     50#ifdef RTEMS_SMP
     51        sc = rtems_task_get_scheduler(RTEMS_SELF, &T_runner_scheduler);
     52        T_quiet_rsc_success(sc);
     53#endif
     54
     55        sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY,
     56            &T_runner_priority);
     57        T_quiet_rsc_success(sc);
     58}
     59
    3860static void
    3961T_do_check_task_context(void)
    4062{
     63        rtems_task_priority prio;
     64        rtems_status_code sc;
    4165        uint32_t v;
     66#ifdef RTEMS_SMP
     67        rtems_id id;
     68#endif
    4269
    4370        v = _Per_CPU_Get_snapshot()->thread_dispatch_disable_level;
     
    5279        T_check(&T_special, v == 0,
    5380            "Wrong ISR level (%" PRIu32 ")", v);
     81
     82#ifdef RTEMS_SMP
     83        id = 0;
     84        sc = rtems_task_get_scheduler(RTEMS_SELF, &id);
     85        T_quiet_rsc_success(sc);
     86        T_check(&T_special, id == T_runner_scheduler,
     87            "Wrong runner scheduler, expected ID %08" PRIx32 ", actual ID %08"
     88            PRIx32, T_runner_scheduler, id);
     89#endif
     90
     91        prio = 0;
     92        sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY,
     93            &prio);
     94        T_quiet_rsc_success(sc);
     95        T_check(&T_special, prio == T_runner_priority,
     96            "Wrong runner priority, expected %" PRIu32 ", actual %"
     97            PRIu32, T_runner_priority, prio);
    5498}
    5599
     
    61105        switch (event) {
    62106        case T_EVENT_RUN_INITIALIZE_LATE:
     107                T_initialize_runner_properties();
     108                /* Fall through */
    63109        case T_EVENT_CASE_END:
    64110                T_do_check_task_context();
Note: See TracChangeset for help on using the changeset viewer.