diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/testbmk.c | 5 | ||||
-rw-r--r-- | test/testmsg.c | 30 |
2 files changed, 14 insertions, 21 deletions
diff --git a/test/testbmk.c b/test/testbmk.c index 0f38eb78b..7e7a714df 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -65,11 +65,14 @@ static Mutex mtx1; #endif
static msg_t thread1(void *p) {
+ Thread *tp;
msg_t msg;
(void)p;
do {
- chMsgRelease(msg = chMsgWait());
+ tp = chMsgWait();
+ msg = chMsgGet(tp);
+ chMsgRelease(tp, msg);
} while (msg);
return 0;
}
diff --git a/test/testmsg.c b/test/testmsg.c index 881db167f..14b6d8186 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -64,11 +64,11 @@ static msg_t thread(void *p) { chMsgSend(p, 'A');
chMsgSend(p, 'B');
chMsgSend(p, 'C');
- chMsgSend(p, 'D');
return 0;
}
static void msg1_execute(void) {
+ Thread *tp;
msg_t msg;
/*
@@ -76,29 +76,19 @@ static void msg1_execute(void) { */
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() + 1,
thread, chThdSelf());
- chMsgRelease(msg = chMsgWait());
+ tp = chMsgWait();
+ msg = chMsgGet(tp);
+ chMsgRelease(tp, msg);
test_emit_token(msg);
- chMsgRelease(msg = chMsgWait());
+ tp = chMsgWait();
+ msg = chMsgGet(tp);
+ chMsgRelease(tp, msg);
test_emit_token(msg);
- chMsgRelease(msg = chMsgWait());
+ tp = chMsgWait();
+ msg = chMsgGet(tp);
+ chMsgRelease(tp, msg);
test_emit_token(msg);
test_assert_sequence(1, "ABC");
-
- /*
- * Testing message fetch using chMsgGet().
- * Note, the following is valid because the sender has higher priority than
- * the receiver.
- */
- msg = chMsgGet();
- test_assert(1, msg != 0, "no message");
- chMsgRelease(0);
- test_assert(2, msg == 'D', "wrong message");
-
- /*
- * Must not have pending messages.
- */
- msg = chMsgGet();
- test_assert(3, msg == 0, "unknown message");
}
ROMCONST struct testcase testmsg1 = {
|