diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/coverage/chconf.h | 2 | ||||
-rw-r--r-- | test/coverage/halconf.h | 2 | ||||
-rw-r--r-- | test/testmbox.c | 32 | ||||
-rw-r--r-- | test/testpools.c | 22 |
4 files changed, 36 insertions, 22 deletions
diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index d514e822d..9db485f52 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -459,7 +459,7 @@ * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API.
*
- * @note It is invoked from within @p chThdInit() and implicitily from all
+ * @note It is invoked from within @p chThdInit() and implicitly from all
* the threads creation APIs.
*/
#if !defined(THREAD_EXT_INIT_HOOK) || defined(__DOXYGEN__)
diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 5b49950cd..991f7cd1b 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -268,7 +268,7 @@ /**
* @brief Number of initialization attempts before rejecting the card.
- * @note Attempts are performed at 10mS intevals.
+ * @note Attempts are performed at 10mS intervals.
*/
#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
#define SDC_INIT_RETRY 100
diff --git a/test/testmbox.c b/test/testmbox.c index 5271752d2..9c0bc08fa 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_sequence(40, "ABCDE");
+ test_assert_lock(41, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
+ test_assert_lock(42, chMBGetUsedCountI(&mb1) == 0, "still full");
+ test_assert(43, 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(44, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
+ test_assert_lock(45, chMBGetUsedCountI(&mb1) == 0, "still full");
+ test_assert_lock(46, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base");
+ test_assert_lock(47, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base");
}
ROMCONST struct testcase testmbox1 = {
diff --git a/test/testpools.c b/test/testpools.c index 1c864d973..2583170fd 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -75,20 +75,30 @@ static void pools1_setup(void) { static void pools1_execute(void) {
int i;
- /* Adding the WAs to the pool. */
- for (i = 0; i < MAX_THREADS; i++)
- chPoolFree(&mp1, wa[i]);
+ /* Adding the WAs to the pool.*/
+ chPoolLoadArray(&mp1, wa[0], MAX_THREADS);
- /* Empting the pool again. */
+ /* Emptying the pool.*/
for (i = 0; i < MAX_THREADS; i++)
test_assert(1, chPoolAlloc(&mp1) != NULL, "list empty");
- /* Now must be empty. */
+ /* Now must be empty.*/
test_assert(2, chPoolAlloc(&mp1) == NULL, "list not empty");
+ /* Adding the WAs to the pool, one by one this time.*/
+ for (i = 0; i < MAX_THREADS; i++)
+ chPoolFree(&mp1, wa[i]);
+
+ /* Emptying the pool again.*/
+ for (i = 0; i < MAX_THREADS; i++)
+ test_assert(3, chPoolAlloc(&mp1) != NULL, "list empty");
+
+ /* Now must be empty again.*/
+ test_assert(4, chPoolAlloc(&mp1) == NULL, "list not empty");
+
/* Covering the case where a provider is unable to return more memory.*/
chPoolInit(&mp1, 16, null_provider);
- test_assert(3, chPoolAlloc(&mp1) == NULL, "provider returned memory");
+ test_assert(5, chPoolAlloc(&mp1) == NULL, "provider returned memory");
}
ROMCONST struct testcase testpools1 = {
|