diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-04-16 15:06:49 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-04-16 15:06:49 +0000 |
commit | e8ae833287d6813305ac676508cb3dbaaf483eeb (patch) | |
tree | 9be0f0036801f8eb3d68ebbd148e422882974330 /test | |
parent | 1f5d676018f3657d687d98b5401383b884fe0630 (diff) | |
download | ChibiOS-e8ae833287d6813305ac676508cb3dbaaf483eeb.tar.gz ChibiOS-e8ae833287d6813305ac676508cb3dbaaf483eeb.tar.bz2 ChibiOS-e8ae833287d6813305ac676508cb3dbaaf483eeb.zip |
100% code coverage for threads.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@902 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test')
-rw-r--r-- | test/testthd.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/testthd.c b/test/testthd.c index 92f0bfe9f..cac77a43a 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -88,6 +88,31 @@ static void thd3_execute(void) { p1 = chThdSetPriority(p1);
test_assert(p1 == prio + 1, "#3");
test_assert(chThdGetPriority() == prio, "#4");
+
+#if CH_USE_MUTEXES
+ /* Simulates a priority boost situation (p_prio > p_realprio).*/
+ chSysLock();
+ chThdSelf()->p_prio += 2;
+ chSysUnlock();
+ test_assert(chThdGetPriority() == prio + 2, "#5");
+
+ /* Tries to raise but below the boost level. */
+ p1 = chThdSetPriority(prio + 1);
+ test_assert(p1 == prio, "#6");
+ test_assert(chThdSelf()->p_prio == prio + 2, "#7");
+ test_assert(chThdSelf()->p_realprio == prio + 1, "#8");
+
+ /* Tries to raise above the boost level. */
+ p1 = chThdSetPriority(prio + 3);
+ test_assert(p1 == prio + 1, "#9");
+ test_assert(chThdSelf()->p_prio == prio + 3, "#10");
+ test_assert(chThdSelf()->p_realprio == prio + 3, "#11");
+
+ chSysLock();
+ chThdSelf()->p_prio = prio;
+ chThdSelf()->p_realprio = prio;
+ chSysUnlock();
+#endif
}
const struct testcase testthd3 = {
|