[rtems commit] smptests/smpmutex01: Use test case functions

Sebastian Huber sebh at rtems.org
Wed Sep 21 07:06:17 UTC 2016


Module:    rtems
Branch:    master
Commit:    6ae309ec85845f05a6143ade79d6f67bc6898df6
Changeset: http://git.rtems.org/rtems/commit/?id=6ae309ec85845f05a6143ade79d6f67bc6898df6

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Sep  9 10:01:06 2016 +0200

smptests/smpmutex01: Use test case functions

---

 testsuites/smptests/smpmutex01/init.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/testsuites/smptests/smpmutex01/init.c b/testsuites/smptests/smpmutex01/init.c
index 93c059e..c6b1b48 100644
--- a/testsuites/smptests/smpmutex01/init.c
+++ b/testsuites/smptests/smpmutex01/init.c
@@ -215,9 +215,8 @@ static void worker(rtems_task_argument arg)
   }
 }
 
-static void test(void)
+static void test_init(test_context *ctx)
 {
-  test_context *ctx = &test_instance;
   rtems_status_code sc;
 
   ctx->tasks[M] = rtems_task_self();
@@ -238,7 +237,10 @@ static void test(void)
     &ctx->mtx
   );
   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
 
+static void test_simple_inheritance(test_context *ctx)
+{
   obtain(ctx);
   request(ctx, A_1, REQ_MTX_OBTAIN);
   check_generations(ctx, NONE, NONE);
@@ -248,7 +250,10 @@ static void test(void)
   assert_prio(ctx, M, 3);
   request(ctx, A_1, REQ_MTX_RELEASE);
   check_generations(ctx, A_1, NONE);
+}
 
+static void test_dequeue_order_one_scheduler_instance(test_context *ctx)
+{
   obtain(ctx);
   request(ctx, A_2_0, REQ_MTX_OBTAIN);
   request(ctx, A_1, REQ_MTX_OBTAIN);
@@ -265,7 +270,10 @@ static void test(void)
   check_generations(ctx, A_2_0, A_2_1);
   request(ctx, A_2_1, REQ_MTX_RELEASE);
   check_generations(ctx, A_2_1, NONE);
+}
 
+static void test_simple_boosting(test_context *ctx)
+{
   obtain(ctx);
   request(ctx, B_5_0, REQ_MTX_OBTAIN);
   request(ctx, B_4, REQ_MTX_OBTAIN);
@@ -282,7 +290,10 @@ static void test(void)
   check_generations(ctx, B_5_0, B_5_1);
   request(ctx, B_5_1, REQ_MTX_RELEASE);
   check_generations(ctx, B_5_1, NONE);
+}
 
+static void test_dequeue_order_two_scheduler_instances(test_context *ctx)
+{
   obtain(ctx);
   request(ctx, A_2_0, REQ_MTX_OBTAIN);
   check_generations(ctx, NONE, NONE);
@@ -324,6 +335,17 @@ static void test(void)
   assert_prio(ctx, B_5_1, 5);
 }
 
+static void test(void)
+{
+  test_context *ctx = &test_instance;
+
+  test_init(ctx);
+  test_simple_inheritance(ctx);
+  test_dequeue_order_one_scheduler_instance(ctx);
+  test_simple_boosting(ctx);
+  test_dequeue_order_two_scheduler_instances(ctx);
+}
+
 static void Init(rtems_task_argument arg)
 {
   TEST_BEGIN();



More information about the vc mailing list