diff options
Diffstat (limited to 'test/testmsg.c')
-rw-r--r-- | test/testmsg.c | 30 |
1 files changed, 10 insertions, 20 deletions
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 = {
|