From 3dda222a772d8178ef04205c525c3c417e2ce7ad Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 12 Apr 2009 16:31:59 +0000 Subject: 100% code coverage for mutexes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@897 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmtx.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test') diff --git a/test/testmtx.c b/test/testmtx.c index feaeb2338..e62bb0c74 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -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 = { -- cgit v1.2.3