Changeset 8ba76b9 in rtems


Ignore:
Timestamp:
Oct 12, 2018, 3:20:39 PM (6 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
01595a4
Parents:
8d81622
git-author:
Sebastian Huber <sebastian.huber@…> (10/12/18 15:20:39)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/22/18 06:08:10)
Message:

tmonetoone: Add yield test case

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/tmtests/tmonetoone/init.c

    r8d81622 r8ba76b9  
    1717#endif
    1818
     19#include <sched.h>
     20
    1921#include <rtems.h>
    2022#include <rtems/test.h>
     
    2628
    2729typedef enum {
     30  TEST_YIELD,
    2831  TEST_EVENTS,
    2932  TEST_BSEM,
     
    5255static test_context test_instance;
    5356
     57static void test_yield(task_context *tc)
     58{
     59  rtems_event_set events;
     60  uint32_t counter;
     61
     62  (void)rtems_event_receive(
     63    RTEMS_EVENT_0,
     64    RTEMS_WAIT | RTEMS_EVENT_ALL,
     65    RTEMS_NO_TIMEOUT,
     66    &events
     67  );
     68
     69  counter = 0;
     70
     71  while (true) {
     72    (void)sched_yield();
     73    ++counter;
     74    tc->counter = counter;
     75  }
     76}
     77
    5478static void test_events(task_context *tc)
    5579{
     
    134158
    135159  switch (tc->variant) {
     160    case TEST_YIELD:
     161      test_yield(tc);
     162      break;
    136163    case TEST_EVENTS:
    137164      test_events(tc);
     
    191218
    192219static const char * const variant_names[] = {
     220  "yield",
    193221  "event",
    194222  "self-contained binary semaphore",
     
    249277  ctx->b.other_classic_prio_bsem = ctx->a.classic_prio_bsem;
    250278
     279  prepare(ctx, TEST_YIELD);
     280
     281  sc = rtems_event_send(ctx->a.task, RTEMS_EVENT_0);
     282  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     283
     284  sc = rtems_event_send(ctx->b.task, RTEMS_EVENT_0);
     285  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     286
     287  run(ctx);
    251288  prepare(ctx, TEST_EVENTS);
    252289
Note: See TracChangeset for help on using the changeset viewer.