aboutsummaryrefslogtreecommitdiffstats
path: root/test/testthd.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-04-25 11:12:10 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-04-25 11:12:10 +0000
commita2a88226488db68ca8435a72ed608bf5ec9df464 (patch)
tree1232bb7af969baa856631cc4d3e9643cdb55f667 /test/testthd.c
parentc031b80726d1472098bb6e352eba561e3ab2e766 (diff)
downloadChibiOS-a2a88226488db68ca8435a72ed608bf5ec9df464.tar.gz
ChibiOS-a2a88226488db68ca8435a72ed608bf5ec9df464.tar.bz2
ChibiOS-a2a88226488db68ca8435a72ed608bf5ec9df464.zip
Changes to the test suite in order to save RAM on AVR targets.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@917 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test/testthd.c')
-rw-r--r--test/testthd.c47
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 = {