diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-04-12 16:31:59 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-04-12 16:31:59 +0000 |
commit | 3dda222a772d8178ef04205c525c3c417e2ce7ad (patch) | |
tree | fa7e23c46c2b1f70b9013cd49347b7705e5a7bd4 /test | |
parent | 97817eb7dcdc881e05e1d46c125a7f8db6b111d1 (diff) | |
download | ChibiOS-3dda222a772d8178ef04205c525c3c417e2ce7ad.tar.gz ChibiOS-3dda222a772d8178ef04205c525c3c417e2ce7ad.tar.bz2 ChibiOS-3dda222a772d8178ef04205c525c3c417e2ce7ad.zip |
100% code coverage for mutexes.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@897 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test')
-rw-r--r-- | test/testmtx.c | 21 |
1 files changed, 21 insertions, 0 deletions
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 = {
|