summaryrefslogtreecommitdiffstats
path: root/testsuites/tmtests
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-10-12 17:20:39 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-10-22 08:08:10 +0200
commit8ba76b9e28cd3f1d6020ebcb2ce6a4cbfd2144a1 (patch)
treebf61f93859d2d689abf424f894483baea2d7614f /testsuites/tmtests
parentposix: Provide non-thread functions by default (diff)
downloadrtems-8ba76b9e28cd3f1d6020ebcb2ce6a4cbfd2144a1.tar.bz2
tmonetoone: Add yield test case
Diffstat (limited to 'testsuites/tmtests')
-rw-r--r--testsuites/tmtests/tmonetoone/init.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/testsuites/tmtests/tmonetoone/init.c b/testsuites/tmtests/tmonetoone/init.c
index 756a1eabf1..b721a8c531 100644
--- a/testsuites/tmtests/tmonetoone/init.c
+++ b/testsuites/tmtests/tmonetoone/init.c
@@ -16,6 +16,8 @@
#include "config.h"
#endif
+#include <sched.h>
+
#include <rtems.h>
#include <rtems/test.h>
#include <rtems/thread.h>
@@ -25,6 +27,7 @@
const char rtems_test_name[] = "TMONETOONE";
typedef enum {
+ TEST_YIELD,
TEST_EVENTS,
TEST_BSEM,
TEST_CLASSIC_FIFO_BSEM,
@@ -51,6 +54,27 @@ typedef struct {
static test_context test_instance;
+static void test_yield(task_context *tc)
+{
+ rtems_event_set events;
+ uint32_t counter;
+
+ (void)rtems_event_receive(
+ RTEMS_EVENT_0,
+ RTEMS_WAIT | RTEMS_EVENT_ALL,
+ RTEMS_NO_TIMEOUT,
+ &events
+ );
+
+ counter = 0;
+
+ while (true) {
+ (void)sched_yield();
+ ++counter;
+ tc->counter = counter;
+ }
+}
+
static void test_events(task_context *tc)
{
uint32_t counter;
@@ -133,6 +157,9 @@ static void worker_task(rtems_task_argument arg)
tc = (task_context *) arg;
switch (tc->variant) {
+ case TEST_YIELD:
+ test_yield(tc);
+ break;
case TEST_EVENTS:
test_events(tc);
break;
@@ -190,6 +217,7 @@ static void create_task(task_context *tc)
}
static const char * const variant_names[] = {
+ "yield",
"event",
"self-contained binary semaphore",
"Classic binary semaphore (FIFO)",
@@ -248,6 +276,15 @@ static void Init(rtems_task_argument arg)
ctx->b.other_classic_fifo_bsem = ctx->a.classic_fifo_bsem;
ctx->b.other_classic_prio_bsem = ctx->a.classic_prio_bsem;
+ prepare(ctx, TEST_YIELD);
+
+ sc = rtems_event_send(ctx->a.task, RTEMS_EVENT_0);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_event_send(ctx->b.task, RTEMS_EVENT_0);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ run(ctx);
prepare(ctx, TEST_EVENTS);
sc = rtems_event_send(ctx->a.task, RTEMS_EVENT_0);