diff options
Diffstat (limited to 'test/testthd.c')
-rw-r--r-- | test/testthd.c | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/test/testthd.c b/test/testthd.c index e5964f17f..e4e15be52 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -40,7 +40,7 @@ static void thd1_execute(void) { threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread, "B");
threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread, "A");
test_wait_threads();
- test_assert_sequence("ABCDE");
+ test_assert_sequence(1, "ABCDE");
}
const struct testcase testthd1 = {
@@ -63,7 +63,7 @@ static void thd2_execute(void) { threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread, "B");
threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread, "C");
test_wait_threads();
- test_assert_sequence("ABCDE");
+ test_assert_sequence(1, "ABCDE");
}
const struct testcase testthd2 = {
@@ -83,30 +83,41 @@ static void thd3_execute(void) { prio = chThdGetPriority();
p1 = chThdSetPriority(prio + 1);
- test_assert(p1 == prio, "#1");
- test_assert(chThdGetPriority() == prio + 1, "#2");
+ test_assert(1, p1 == prio,
+ "unexpected returned priority level");
+ test_assert(2, chThdGetPriority() == prio + 1,
+ "unexpected priority level");
p1 = chThdSetPriority(p1);
- test_assert(p1 == prio + 1, "#3");
- test_assert(chThdGetPriority() == prio, "#4");
+ test_assert(3, p1 == prio + 1,
+ "unexpected returned priority level");
+ test_assert(4, chThdGetPriority() == prio,
+ "unexpected priority level");
#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");
-
+ test_assert(5, chThdGetPriority() == prio + 2,
+ "unexpected priority level");
+
/* 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");
+ test_assert(6, p1 == prio,
+ "unexpected returned priority level");
+ test_assert(7, chThdSelf()->p_prio == prio + 2,
+ "unexpected priority level");
+ test_assert(8, chThdSelf()->p_realprio == prio + 1,
+ "unexpected returned real priority level");
/* 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");
+ test_assert(9, p1 == prio + 1,
+ "unexpected returned priority level");
+ test_assert(10, chThdSelf()->p_prio == prio + 3,
+ "unexpected priority level");
+ test_assert(11, chThdSelf()->p_realprio == prio + 3,
+ "unexpected real priority level");
chSysLock();
chThdSelf()->p_prio = prio;
@@ -135,22 +146,22 @@ static void thd4_execute(void) { /* Timeouts in microseconds.*/
time = chTimeNow();
chThdSleepMicroseconds(100000);
- test_assert_time_window(time + US2ST(100000), time + US2ST(100000) + 1);
+ test_assert_time_window(1, time + US2ST(100000), time + US2ST(100000) + 1);
/* Timeouts in milliseconds.*/
time = chTimeNow();
chThdSleepMilliseconds(100);
- test_assert_time_window(time + MS2ST(100), time + MS2ST(100) + 1);
+ test_assert_time_window(2, time + MS2ST(100), time + MS2ST(100) + 1);
/* Timeouts in seconds.*/
time = chTimeNow();
chThdSleepSeconds(1);
- test_assert_time_window(time + S2ST(1), time + S2ST(1) + 1);
+ test_assert_time_window(3, time + S2ST(1), time + S2ST(1) + 1);
/* Absolute timelines.*/
time = chTimeNow() + MS2ST(100);
chThdSleepUntil(time);
- test_assert_time_window(time, time + 1);
+ test_assert_time_window(4, time, time + 1);
}
const struct testcase testthd4 = {
|