From 52e98077ee867e31189c43ad592cf97f386cac93 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 15 Mar 2012 19:54:36 +0000 Subject: Fixed bug 3504450. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4039 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmbox.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/testmbox.c b/test/testmbox.c index 5271752d2..544bc29ae 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -180,30 +180,34 @@ static void mbox1_execute(void) { test_emit_token(msg2); } test_assert_sequence(29, "ABCDE"); - test_assert(30, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); + test_assert_lock(30, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); + test_assert_lock(31, chMBGetUsedCountI(&mb1) == 0, "still full"); + test_assert(32, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); chSysLock(); msg1 = chMBPostAheadI(&mb1, 'E'); - test_assert(31, msg1 == RDY_OK, "wrong wake-up message"); + test_assert(33, msg1 == RDY_OK, "wrong wake-up message"); msg1 = chMBPostAheadI(&mb1, 'D'); - test_assert(32, msg1 == RDY_OK, "wrong wake-up message"); + test_assert(34, msg1 == RDY_OK, "wrong wake-up message"); msg1 = chMBPostAheadI(&mb1, 'C'); - test_assert(33, msg1 == RDY_OK, "wrong wake-up message"); + test_assert(35, msg1 == RDY_OK, "wrong wake-up message"); msg1 = chMBPostAheadI(&mb1, 'B'); - test_assert(34, msg1 == RDY_OK, "wrong wake-up message"); + test_assert(36, msg1 == RDY_OK, "wrong wake-up message"); msg1 = chMBPostAheadI(&mb1, 'A'); chSysUnlock(); - test_assert(35, msg1 == RDY_OK, "wrong wake-up message"); - test_assert(36, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); + test_assert(37, msg1 == RDY_OK, "wrong wake-up message"); + test_assert(38, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); for (i = 0; i < MB_SIZE; i++) { chSysLock(); msg1 = chMBFetchI(&mb1, &msg2); chSysUnlock(); - test_assert(37, msg1 == RDY_OK, "wrong wake-up message"); + test_assert(39, msg1 == RDY_OK, "wrong wake-up message"); test_emit_token(msg2); } test_assert_sequence(38, "ABCDE"); - test_assert(39, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); + test_assert_lock(39, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); + test_assert_lock(40, chMBGetUsedCountI(&mb1) == 0, "still full"); + test_assert(41, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); /* * Testing reset. @@ -213,10 +217,10 @@ static void mbox1_execute(void) { /* * Re-testing final conditions. */ - test_assert_lock(40, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); - test_assert_lock(41, chMBGetUsedCountI(&mb1) == 0, "still full"); - test_assert_lock(42, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base"); - test_assert_lock(43, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base"); + test_assert_lock(42, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); + test_assert_lock(43, chMBGetUsedCountI(&mb1) == 0, "still full"); + test_assert_lock(44, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base"); + test_assert_lock(45, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base"); } ROMCONST struct testcase testmbox1 = { -- cgit v1.2.3