aboutsummaryrefslogtreecommitdiffstats
path: root/test/rt/source/test
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2017-10-17 13:00:11 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2017-10-17 13:00:11 +0000
commit3c40945fea5379db8ccfa06aef0bd9cfa1e878fd (patch)
tree04a746b8900ad838f7dc4dfe2f9aa642634cc3f6 /test/rt/source/test
parenta95ea913cd7478e1240b3a09d84c86884c6be231 (diff)
downloadChibiOS-3c40945fea5379db8ccfa06aef0bd9cfa1e878fd.tar.gz
ChibiOS-3c40945fea5379db8ccfa06aef0bd9cfa1e878fd.tar.bz2
ChibiOS-3c40945fea5379db8ccfa06aef0bd9cfa1e878fd.zip
Test suite cleaned up of direct math operations on system time.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10844 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test/rt/source/test')
-rw-r--r--test/rt/source/test/rt_test_root.c2
-rw-r--r--test/rt/source/test/rt_test_sequence_003.c22
-rw-r--r--test/rt/source/test/rt_test_sequence_004.c4
-rw-r--r--test/rt/source/test/rt_test_sequence_005.c5
-rw-r--r--test/rt/source/test/rt_test_sequence_006.c8
-rw-r--r--test/rt/source/test/rt_test_sequence_008.c20
-rw-r--r--test/rt/source/test/rt_test_sequence_010.c16
7 files changed, 42 insertions, 35 deletions
diff --git a/test/rt/source/test/rt_test_root.c b/test/rt/source/test/rt_test_root.c
index 9e0365686..0349fc1e6 100644
--- a/test/rt/source/test/rt_test_root.c
+++ b/test/rt/source/test/rt_test_root.c
@@ -79,7 +79,7 @@ const testsequence_t * const rt_test_suite_array[] = {
* @brief Test suite root structure.
*/
const testsuite_t rt_test_suite = {
- "ChibiOS/RT Library Test Suite.",
+ "ChibiOS/RT Test Suite.",
rt_test_suite_array
};
diff --git a/test/rt/source/test/rt_test_sequence_003.c b/test/rt/source/test/rt_test_sequence_003.c
index 9069502e9..5a9771d4f 100644
--- a/test/rt/source/test/rt_test_sequence_003.c
+++ b/test/rt/source/test/rt_test_sequence_003.c
@@ -83,8 +83,8 @@ static void rt_test_003_001_execute(void) {
{
time = chVTGetSystemTimeX();
chThdSleep(100);
- test_assert_time_window(time + 100,
- time + 100 + CH_CFG_ST_TIMEDELTA + 1,
+ test_assert_time_window(chTimeAddX(time, 100),
+ chTimeAddX(time, 100 + CH_CFG_ST_TIMEDELTA + 1),
"out of time window");
}
@@ -95,8 +95,8 @@ static void rt_test_003_001_execute(void) {
{
time = chVTGetSystemTimeX();
chThdSleepMicroseconds(100000);
- test_assert_time_window(time + TIME_US2I(100000),
- time + TIME_US2I(100000) + CH_CFG_ST_TIMEDELTA + 1,
+ test_assert_time_window(chTimeAddX(time, TIME_US2I(100000)),
+ chTimeAddX(time, TIME_US2I(100000) + CH_CFG_ST_TIMEDELTA + 1),
"out of time window");
}
@@ -107,8 +107,8 @@ static void rt_test_003_001_execute(void) {
{
time = chVTGetSystemTimeX();
chThdSleepMilliseconds(100);
- test_assert_time_window(time + TIME_MS2I(100),
- time + TIME_MS2I(100) + CH_CFG_ST_TIMEDELTA + 1,
+ test_assert_time_window(chTimeAddX(time, TIME_MS2I(100)),
+ chTimeAddX(time, TIME_MS2I(100) + CH_CFG_ST_TIMEDELTA + 1),
"out of time window");
}
@@ -118,8 +118,8 @@ static void rt_test_003_001_execute(void) {
{
time = chVTGetSystemTimeX();
chThdSleepSeconds(1);
- test_assert_time_window(time + TIME_S2I(1),
- time + TIME_S2I(1) + CH_CFG_ST_TIMEDELTA + 1,
+ test_assert_time_window(chTimeAddX(time, TIME_S2I(1)),
+ chTimeAddX(time, TIME_S2I(1) + CH_CFG_ST_TIMEDELTA + 1),
"out of time window");
}
@@ -128,9 +128,9 @@ static void rt_test_003_001_execute(void) {
test_set_step(5);
{
time = chVTGetSystemTimeX();
- chThdSleepUntil(time + 100);
- test_assert_time_window(time + 100,
- time + 100 + CH_CFG_ST_TIMEDELTA + 1,
+ chThdSleepUntil(chTimeAddX(time, 100));
+ test_assert_time_window(chTimeAddX(time, 100),
+ chTimeAddX(time, 100 + CH_CFG_ST_TIMEDELTA + 1),
"out of time window");
}
}
diff --git a/test/rt/source/test/rt_test_sequence_004.c b/test/rt/source/test/rt_test_sequence_004.c
index 67eaefdb1..9793102e1 100644
--- a/test/rt/source/test/rt_test_sequence_004.c
+++ b/test/rt/source/test/rt_test_sequence_004.c
@@ -101,8 +101,8 @@ static void rt_test_004_001_execute(void) {
time = chVTGetSystemTimeX();
msg = chThdSuspendTimeoutS(&tr1, TIME_MS2I(1000));
chSysUnlock();
- test_assert_time_window(time + TIME_MS2I(1000),
- time + TIME_MS2I(1000) + CH_CFG_ST_TIMEDELTA + 1,
+ test_assert_time_window(chTimeAddX(time, TIME_MS2I(1000)),
+ chTimeAddX(time, TIME_MS2I(1000) + CH_CFG_ST_TIMEDELTA + 1),
"out of time window");
test_assert(NULL == tr1, "not NULL");
test_assert(MSG_TIMEOUT == msg, "wrong returned message");
diff --git a/test/rt/source/test/rt_test_sequence_005.c b/test/rt/source/test/rt_test_sequence_005.c
index 29127092b..437bbaf87 100644
--- a/test/rt/source/test/rt_test_sequence_005.c
+++ b/test/rt/source/test/rt_test_sequence_005.c
@@ -260,7 +260,7 @@ static void rt_test_005_003_execute(void) {
/* [5.3.3] Testing timeout condition.*/
test_set_step(3);
{
- target_time = test_wait_tick() + TIME_MS2I(5 * 50);
+ target_time = chTimeAddX(test_wait_tick(), TIME_MS2I(5 * 50));
for (i = 0; i < 5; i++) {
test_emit_token('A' + i);
msg = chSemWaitTimeout(&sem1, TIME_MS2I(50));
@@ -269,7 +269,8 @@ static void rt_test_005_003_execute(void) {
test_assert(sem1.cnt == 0, "counter not zero");
}
test_assert_sequence("ABCDE", "invalid sequence");
- test_assert_time_window(target_time, target_time + ALLOWED_DELAY,
+ test_assert_time_window(target_time,
+ chTimeAddX(target_time, ALLOWED_DELAY),
"out of time window");
}
}
diff --git a/test/rt/source/test/rt_test_sequence_006.c b/test/rt/source/test/rt_test_sequence_006.c
index 14aa2dd78..4b4ec262f 100644
--- a/test/rt/source/test/rt_test_sequence_006.c
+++ b/test/rt/source/test/rt_test_sequence_006.c
@@ -71,7 +71,7 @@ void test_cpu_pulse(unsigned duration) {
systime_t start, end, now;
start = chThdGetTicksX(chThdGetSelfX());
- end = start + TIME_MS2I(duration);
+ end = chTimeAddX(start, TIME_MS2I(duration));
do {
now = chThdGetTicksX(chThdGetSelfX());
#if defined(SIMULATOR)
@@ -358,7 +358,8 @@ static void rt_test_006_002_execute(void) {
time windows (100mS...100mS+ALLOWED_DELAY).*/
test_set_step(3);
{
- test_assert_time_window(time + TIME_MS2I(100), time + TIME_MS2I(100) + ALLOWED_DELAY,
+ test_assert_time_window(chTimeAddX(time, TIME_MS2I(100)),
+ chTimeAddX(time, TIME_MS2I(100) + ALLOWED_DELAY),
"out of time window");
}
}
@@ -430,7 +431,8 @@ static void rt_test_006_003_execute(void) {
time windows (110mS...110mS+ALLOWED_DELAY).*/
test_set_step(3);
{
- test_assert_time_window(time + TIME_MS2I(110), time + TIME_MS2I(110) + ALLOWED_DELAY,
+ test_assert_time_window(chTimeAddX(time, TIME_MS2I(110)),
+ chTimeAddX(time, TIME_MS2I(110) + ALLOWED_DELAY),
"out of time window");
}
}
diff --git a/test/rt/source/test/rt_test_sequence_008.c b/test/rt/source/test/rt_test_sequence_008.c
index 77b49268d..3b23db132 100644
--- a/test/rt/source/test/rt_test_sequence_008.c
+++ b/test/rt/source/test/rt_test_sequence_008.c
@@ -225,7 +225,7 @@ static void rt_test_008_003_execute(void) {
thread will set an event flag after 50mS.*/
test_set_step(3);
{
- target_time = test_wait_tick() + TIME_MS2I(50);
+ target_time = chTimeAddX(test_wait_tick(), TIME_MS2I(50));
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1,
evt_thread3, chThdGetSelfX());
}
@@ -236,7 +236,8 @@ static void rt_test_008_003_execute(void) {
test_set_step(4);
{
m = chEvtWaitOne(ALL_EVENTS);
- test_assert_time_window(target_time, target_time + ALLOWED_DELAY,
+ test_assert_time_window(target_time,
+ chTimeAddX(target_time, ALLOWED_DELAY),
"out of time window");
test_assert(m == 1, "event flag error");
m = chEvtGetAndClearEvents(ALL_EVENTS);
@@ -298,7 +299,7 @@ static void rt_test_008_004_execute(void) {
thread will set an event flag after 50mS.*/
test_set_step(3);
{
- target_time = test_wait_tick() + TIME_MS2I(50);
+ target_time = chTimeAddX(test_wait_tick(), TIME_MS2I(50));
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1,
evt_thread3, chThdGetSelfX());
}
@@ -309,7 +310,8 @@ static void rt_test_008_004_execute(void) {
test_set_step(4);
{
m = chEvtWaitAny(ALL_EVENTS);
- test_assert_time_window(target_time, target_time + ALLOWED_DELAY,
+ test_assert_time_window(target_time,
+ chTimeAddX(target_time, ALLOWED_DELAY),
"out of time window");
test_assert(m == 1, "event flag error");
m = chEvtGetAndClearEvents(ALL_EVENTS);
@@ -378,7 +380,7 @@ static void rt_test_008_005_execute(void) {
thread will set another event flag after 50mS.*/
test_set_step(4);
{
- target_time = test_wait_tick() + TIME_MS2I(50);
+ target_time = chTimeAddX(test_wait_tick(), TIME_MS2I(50));
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1,
evt_thread3, chThdGetSelfX());
}
@@ -389,7 +391,8 @@ static void rt_test_008_005_execute(void) {
test_set_step(5);
{
m = chEvtWaitAll(5);
- test_assert_time_window(target_time, target_time + ALLOWED_DELAY,
+ test_assert_time_window(target_time,
+ chTimeAddX(target_time, ALLOWED_DELAY),
"out of time window");
test_assert(m == 5, "event flags error");
m = chEvtGetAndClearEvents(ALL_EVENTS);
@@ -510,7 +513,7 @@ static void rt_test_008_007_execute(void) {
other after 50mS.*/
test_set_step(2);
{
- target_time = test_wait_tick() + TIME_MS2I(50);
+ target_time = chTimeAddX(test_wait_tick(), TIME_MS2I(50));
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1,
evt_thread7, "A");
}
@@ -521,7 +524,8 @@ static void rt_test_008_007_execute(void) {
test_set_step(3);
{
m = chEvtWaitAll(5);
- test_assert_time_window(target_time, target_time + ALLOWED_DELAY,
+ test_assert_time_window(target_time,
+ chTimeAddX(target_time, ALLOWED_DELAY),
"out of time window");
m = chEvtGetAndClearEvents(ALL_EVENTS);
test_assert(m == 0, "stuck event");
diff --git a/test/rt/source/test/rt_test_sequence_010.c b/test/rt/source/test/rt_test_sequence_010.c
index 4a9d365f0..54f8ef879 100644
--- a/test/rt/source/test/rt_test_sequence_010.c
+++ b/test/rt/source/test/rt_test_sequence_010.c
@@ -80,7 +80,7 @@ NOINLINE static unsigned int msg_loop_test(thread_t *tp) {
uint32_t n = 0;
start = test_wait_tick();
- end = start + TIME_MS2I(1000);
+ end = chTimeAddX(start, TIME_MS2I(1000));
do {
(void)chMsgSend(tp, 1);
n++;
@@ -372,7 +372,7 @@ static void rt_test_010_004_execute(void) {
n = 0;
start = test_wait_tick();
- end = start + TIME_MS2I(1000);
+ end = chTimeAddX(start, TIME_MS2I(1000));
do {
chSysLock();
chSchWakeupS(tp, MSG_OK);
@@ -442,7 +442,7 @@ static void rt_test_010_005_execute(void) {
{
n = 0;
start = test_wait_tick();
- end = start + TIME_MS2I(1000);
+ end = chTimeAddX(start, TIME_MS2I(1000));
do {
chThdWait(chThdCreateStatic(wa[0], WA_SIZE, prio, bmk_thread3, NULL));
n++;
@@ -499,7 +499,7 @@ static void rt_test_010_006_execute(void) {
{
n = 0;
start = test_wait_tick();
- end = start + TIME_MS2I(1000);
+ end = chTimeAddX(start, TIME_MS2I(1000));
do {
#if CH_CFG_USE_REGISTRY
chThdRelease(chThdCreateStatic(wa[0], WA_SIZE, prio, bmk_thread3, NULL));
@@ -581,7 +581,7 @@ static void rt_test_010_007_execute(void) {
n = 0;
start = test_wait_tick();
- end = start + TIME_MS2I(1000);
+ end = chTimeAddX(start, TIME_MS2I(1000));
do {
chSemReset(&sem1, 0);
n++;
@@ -706,7 +706,7 @@ static void rt_test_010_009_execute(void) {
n = 0;
start = test_wait_tick();
- end = start + TIME_MS2I(1000);
+ end = chTimeAddX(start, TIME_MS2I(1000));
do {
chSysLock();
chVTDoSetI(&vt1, 1, tmo, NULL);
@@ -775,7 +775,7 @@ static void rt_test_010_010_execute(void) {
n = 0;
start = test_wait_tick();
- end = start + TIME_MS2I(1000);
+ end = chTimeAddX(start, TIME_MS2I(1000));
do {
chSemWait(&sem1);
chSemSignal(&sem1);
@@ -847,7 +847,7 @@ static void rt_test_010_011_execute(void) {
n = 0;
start = test_wait_tick();
- end = start + TIME_MS2I(1000);
+ end = chTimeAddX(start, TIME_MS2I(1000));
do {
chMtxLock(&mtx1);
chMtxUnlock(&mtx1);