100% code coverage for mutexes.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@897 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
gdisirio 2009-04-12 16:31:59 +00:00
parent 97817eb7dc
commit 3dda222a77
1 changed files with 21 additions and 0 deletions

View File

@ -264,6 +264,27 @@ static void mtx4_execute(void) {
chMtxUnlockAll();
test_assert(chThdGetPriority() == p, "#7");
test_wait_threads();
/* Test repeated in order to cover chMtxUnlockS().*/
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, p1, thread13, "D");
threads[1] = chThdCreateStatic(wa[1], WA_SIZE, p2, thread14, "C");
chMtxLock(&m2);
test_assert(chThdGetPriority() == p, "#8");
chThdSleepMilliseconds(100);
test_assert(chThdGetPriority() == p1, "#9");
chMtxLock(&m1);
test_assert(chThdGetPriority() == p1, "#10");
chThdSleepMilliseconds(100);
test_assert(chThdGetPriority() == p2, "#11");
chSysLock();
chMtxUnlockS();
chSysUnlock();
test_assert(chThdGetPriority() == p1, "#12");
chThdSleepMilliseconds(100);
test_assert(chThdGetPriority() == p1, "#13");
chMtxUnlockAll();
test_assert(chThdGetPriority() == p, "#14");
test_wait_threads();
}
const struct testcase testmtx4 = {