mirror of https://github.com/rusefi/ChibiOS.git
Test improvements.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13190 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
ef5ee94dad
commit
2d5f8eadd4
|
@ -94,6 +94,7 @@ static void nil_test_001_001_execute(void) {
|
||||||
test_println("");
|
test_println("");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_001_001 = {
|
static const testcase_t nil_test_001_001 = {
|
||||||
|
@ -135,6 +136,7 @@ static void nil_test_001_002_execute(void) {
|
||||||
test_printn(CH_KERNEL_PATCH);
|
test_printn(CH_KERNEL_PATCH);
|
||||||
test_println("");
|
test_println("");
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_001_002 = {
|
static const testcase_t nil_test_001_002 = {
|
||||||
|
@ -206,6 +208,7 @@ static void nil_test_001_003_execute(void) {
|
||||||
test_printn(CH_DBG_ENABLE_STACK_CHECK);
|
test_printn(CH_DBG_ENABLE_STACK_CHECK);
|
||||||
test_println("");
|
test_println("");
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_001_003 = {
|
static const testcase_t nil_test_001_003 = {
|
||||||
|
|
|
@ -67,6 +67,7 @@ static void nil_test_002_001_execute(void) {
|
||||||
while (time == chVTGetSystemTimeX()) {
|
while (time == chVTGetSystemTimeX()) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_002_001 = {
|
static const testcase_t nil_test_002_001 = {
|
||||||
|
@ -113,6 +114,7 @@ static void nil_test_002_002_execute(void) {
|
||||||
chTimeAddX(time, 100 + 1),
|
chTimeAddX(time, 100 + 1),
|
||||||
"out of time window");
|
"out of time window");
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [2.2.2] The current system time is read then a sleep is performed
|
/* [2.2.2] The current system time is read then a sleep is performed
|
||||||
for 100000 microseconds and on exit the system time is verified
|
for 100000 microseconds and on exit the system time is verified
|
||||||
|
@ -125,6 +127,7 @@ static void nil_test_002_002_execute(void) {
|
||||||
chTimeAddX(time, TIME_US2I(100000) + 1),
|
chTimeAddX(time, TIME_US2I(100000) + 1),
|
||||||
"out of time window");
|
"out of time window");
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
|
|
||||||
/* [2.2.3] The current system time is read then a sleep is performed
|
/* [2.2.3] The current system time is read then a sleep is performed
|
||||||
for 100 milliseconds and on exit the system time is verified
|
for 100 milliseconds and on exit the system time is verified
|
||||||
|
@ -137,6 +140,7 @@ static void nil_test_002_002_execute(void) {
|
||||||
chTimeAddX(time, TIME_MS2I(100) + 1),
|
chTimeAddX(time, TIME_MS2I(100) + 1),
|
||||||
"out of time window");
|
"out of time window");
|
||||||
}
|
}
|
||||||
|
test_end_step(3);
|
||||||
|
|
||||||
/* [2.2.4] The current system time is read then a sleep is performed
|
/* [2.2.4] The current system time is read then a sleep is performed
|
||||||
for 1 second and on exit the system time is verified again.*/
|
for 1 second and on exit the system time is verified again.*/
|
||||||
|
@ -148,6 +152,7 @@ static void nil_test_002_002_execute(void) {
|
||||||
chTimeAddX(time, TIME_S2I(1) + 1),
|
chTimeAddX(time, TIME_S2I(1) + 1),
|
||||||
"out of time window");
|
"out of time window");
|
||||||
}
|
}
|
||||||
|
test_end_step(4);
|
||||||
|
|
||||||
/* [2.2.5] Function chThdSleepUntil() is tested with a timeline of
|
/* [2.2.5] Function chThdSleepUntil() is tested with a timeline of
|
||||||
"now" + 100 ticks.*/
|
"now" + 100 ticks.*/
|
||||||
|
@ -159,6 +164,7 @@ static void nil_test_002_002_execute(void) {
|
||||||
chTimeAddX(time, 100 + 1),
|
chTimeAddX(time, 100 + 1),
|
||||||
"out of time window");
|
"out of time window");
|
||||||
}
|
}
|
||||||
|
test_end_step(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_002_002 = {
|
static const testcase_t nil_test_002_002 = {
|
||||||
|
|
|
@ -119,6 +119,7 @@ static void nil_test_003_001_execute(void) {
|
||||||
test_assert_lock(chSemGetCounterI(&sem1) == 0, "wrong counter value");
|
test_assert_lock(chSemGetCounterI(&sem1) == 0, "wrong counter value");
|
||||||
test_assert(MSG_OK == msg, "wrong returned message");
|
test_assert(MSG_OK == msg, "wrong returned message");
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [3.1.2] The function chSemSignal() is invoked, after return the
|
/* [3.1.2] The function chSemSignal() is invoked, after return the
|
||||||
counter is tested.*/
|
counter is tested.*/
|
||||||
|
@ -127,6 +128,7 @@ static void nil_test_003_001_execute(void) {
|
||||||
chSemSignal(&sem1);
|
chSemSignal(&sem1);
|
||||||
test_assert_lock(chSemGetCounterI(&sem1) == 1, "wrong counter value");
|
test_assert_lock(chSemGetCounterI(&sem1) == 1, "wrong counter value");
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
|
|
||||||
/* [3.1.3] The function chSemReset() is invoked, after return the
|
/* [3.1.3] The function chSemReset() is invoked, after return the
|
||||||
counter is tested.*/
|
counter is tested.*/
|
||||||
|
@ -135,6 +137,7 @@ static void nil_test_003_001_execute(void) {
|
||||||
chSemReset(&sem1, 2);
|
chSemReset(&sem1, 2);
|
||||||
test_assert_lock(chSemGetCounterI(&sem1) == 2, "wrong counter value");
|
test_assert_lock(chSemGetCounterI(&sem1) == 2, "wrong counter value");
|
||||||
}
|
}
|
||||||
|
test_end_step(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_003_001 = {
|
static const testcase_t nil_test_003_001 = {
|
||||||
|
@ -191,6 +194,7 @@ static void nil_test_003_002_execute(void) {
|
||||||
test_assert_lock(chSemGetCounterI(&sem1) == 0, "wrong counter value");
|
test_assert_lock(chSemGetCounterI(&sem1) == 0, "wrong counter value");
|
||||||
test_assert(MSG_OK == msg, "wrong returned message");
|
test_assert(MSG_OK == msg, "wrong returned message");
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [3.2.2] The function chSemWait() is invoked, after return the
|
/* [3.2.2] The function chSemWait() is invoked, after return the
|
||||||
counter and the returned message are tested. The semaphore is
|
counter and the returned message are tested. The semaphore is
|
||||||
|
@ -203,6 +207,7 @@ static void nil_test_003_002_execute(void) {
|
||||||
test_assert_lock(chSemGetCounterI(&sem2) == 0,"wrong counter value");
|
test_assert_lock(chSemGetCounterI(&sem2) == 0,"wrong counter value");
|
||||||
test_assert(MSG_RESET == msg, "wrong returned message");
|
test_assert(MSG_RESET == msg, "wrong returned message");
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_003_002 = {
|
static const testcase_t nil_test_003_002 = {
|
||||||
|
@ -253,6 +258,7 @@ static void nil_test_003_003_execute(void) {
|
||||||
test_assert_lock(chSemGetCounterI(&sem1) == 0, "wrong counter value");
|
test_assert_lock(chSemGetCounterI(&sem1) == 0, "wrong counter value");
|
||||||
test_assert(MSG_TIMEOUT == msg, "wrong timeout message");
|
test_assert(MSG_TIMEOUT == msg, "wrong timeout message");
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [3.3.2] The function chSemWaitTimeout() is invoked again, after
|
/* [3.3.2] The function chSemWaitTimeout() is invoked again, after
|
||||||
return the system time, the counter and the returned message are
|
return the system time, the counter and the returned message are
|
||||||
|
@ -267,6 +273,7 @@ static void nil_test_003_003_execute(void) {
|
||||||
test_assert_lock(chSemGetCounterI(&sem1) == 0, "wrong counter value");
|
test_assert_lock(chSemGetCounterI(&sem1) == 0, "wrong counter value");
|
||||||
test_assert(MSG_TIMEOUT == msg, "wrong timeout message");
|
test_assert(MSG_TIMEOUT == msg, "wrong timeout message");
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_003_003 = {
|
static const testcase_t nil_test_003_003 = {
|
||||||
|
|
|
@ -112,6 +112,7 @@ static void nil_test_004_001_execute(void) {
|
||||||
test_assert(NULL == tr1, "not NULL");
|
test_assert(NULL == tr1, "not NULL");
|
||||||
test_assert(MSG_OK == msg,"wrong returned message");
|
test_assert(MSG_OK == msg,"wrong returned message");
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [4.1.2] The function chThdSuspendTimeoutS() is invoked, the thread
|
/* [4.1.2] The function chThdSuspendTimeoutS() is invoked, the thread
|
||||||
is not resumed so a timeout must occur. On return the message and
|
is not resumed so a timeout must occur. On return the message and
|
||||||
|
@ -130,6 +131,7 @@ static void nil_test_004_001_execute(void) {
|
||||||
test_assert(NULL == tr, "not NULL");
|
test_assert(NULL == tr, "not NULL");
|
||||||
test_assert(MSG_TIMEOUT == msg, "wrong returned message");
|
test_assert(MSG_TIMEOUT == msg, "wrong returned message");
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_004_001 = {
|
static const testcase_t nil_test_004_001 = {
|
||||||
|
|
|
@ -112,6 +112,7 @@ static void nil_test_005_001_execute(void) {
|
||||||
{
|
{
|
||||||
chEvtObjectInit(&es1);
|
chEvtObjectInit(&es1);
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [5.1.2] Two Event Listeners are registered on the Event Source,
|
/* [5.1.2] Two Event Listeners are registered on the Event Source,
|
||||||
the Event Source is tested to have listeners.*/
|
the Event Source is tested to have listeners.*/
|
||||||
|
@ -121,6 +122,7 @@ static void nil_test_005_001_execute(void) {
|
||||||
chEvtRegisterMask(&es1, &el2, 2);
|
chEvtRegisterMask(&es1, &el2, 2);
|
||||||
test_assert_lock(chEvtIsListeningI(&es1), "no listener");
|
test_assert_lock(chEvtIsListeningI(&es1), "no listener");
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
|
|
||||||
/* [5.1.3] An Event Listener is unregistered, the Event Source must
|
/* [5.1.3] An Event Listener is unregistered, the Event Source must
|
||||||
still have listeners.*/
|
still have listeners.*/
|
||||||
|
@ -129,6 +131,7 @@ static void nil_test_005_001_execute(void) {
|
||||||
chEvtUnregister(&es1, &el1);
|
chEvtUnregister(&es1, &el1);
|
||||||
test_assert_lock(chEvtIsListeningI(&es1), "no listener");
|
test_assert_lock(chEvtIsListeningI(&es1), "no listener");
|
||||||
}
|
}
|
||||||
|
test_end_step(3);
|
||||||
|
|
||||||
/* [5.1.4] An Event Listener is unregistered, the Event Source must
|
/* [5.1.4] An Event Listener is unregistered, the Event Source must
|
||||||
not have listeners.*/
|
not have listeners.*/
|
||||||
|
@ -137,6 +140,7 @@ static void nil_test_005_001_execute(void) {
|
||||||
chEvtUnregister(&es1, &el2);
|
chEvtUnregister(&es1, &el2);
|
||||||
test_assert_lock(!chEvtIsListeningI(&es1), "stuck listener");
|
test_assert_lock(!chEvtIsListeningI(&es1), "stuck listener");
|
||||||
}
|
}
|
||||||
|
test_end_step(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_005_001 = {
|
static const testcase_t nil_test_005_001 = {
|
||||||
|
@ -172,6 +176,7 @@ static void nil_test_005_002_execute(void) {
|
||||||
chEvtDispatch(evhndl, 7);
|
chEvtDispatch(evhndl, 7);
|
||||||
test_assert_sequence("ABC", "invalid sequence");
|
test_assert_sequence("ABC", "invalid sequence");
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_005_002 = {
|
static const testcase_t nil_test_005_002 = {
|
||||||
|
@ -213,6 +218,7 @@ static void nil_test_005_003_execute(void) {
|
||||||
{
|
{
|
||||||
chEvtAddEvents(7);
|
chEvtAddEvents(7);
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [5.3.2] Calling chEvtWaitOne() three times, each time a single
|
/* [5.3.2] Calling chEvtWaitOne() three times, each time a single
|
||||||
flag must be returned in order of priority.*/
|
flag must be returned in order of priority.*/
|
||||||
|
@ -227,6 +233,7 @@ static void nil_test_005_003_execute(void) {
|
||||||
m = chEvtGetAndClearEvents(ALL_EVENTS);
|
m = chEvtGetAndClearEvents(ALL_EVENTS);
|
||||||
test_assert(m == 0, "stuck event");
|
test_assert(m == 0, "stuck event");
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
|
|
||||||
/* [5.3.3] Getting current time and starting a signaler thread, the
|
/* [5.3.3] Getting current time and starting a signaler thread, the
|
||||||
thread will set an event flag after 50mS.*/
|
thread will set an event flag after 50mS.*/
|
||||||
|
@ -243,6 +250,7 @@ static void nil_test_005_003_execute(void) {
|
||||||
};
|
};
|
||||||
tp = chThdCreate(&tc);
|
tp = chThdCreate(&tc);
|
||||||
}
|
}
|
||||||
|
test_end_step(3);
|
||||||
|
|
||||||
/* [5.3.4] Calling chEvtWaitOne() then verifying that the event has
|
/* [5.3.4] Calling chEvtWaitOne() then verifying that the event has
|
||||||
been received after 50mS and that the event flags mask has been
|
been received after 50mS and that the event flags mask has been
|
||||||
|
@ -258,6 +266,7 @@ static void nil_test_005_003_execute(void) {
|
||||||
test_assert(m == 0, "stuck event");
|
test_assert(m == 0, "stuck event");
|
||||||
chThdWait(tp);
|
chThdWait(tp);
|
||||||
}
|
}
|
||||||
|
test_end_step(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_005_003 = {
|
static const testcase_t nil_test_005_003 = {
|
||||||
|
@ -299,6 +308,7 @@ static void nil_test_005_004_execute(void) {
|
||||||
{
|
{
|
||||||
chEvtAddEvents(5);
|
chEvtAddEvents(5);
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [5.4.2] Calling chEvtWaitAny() one time, the two flags must be
|
/* [5.4.2] Calling chEvtWaitAny() one time, the two flags must be
|
||||||
returned.*/
|
returned.*/
|
||||||
|
@ -309,6 +319,7 @@ static void nil_test_005_004_execute(void) {
|
||||||
m = chEvtGetAndClearEvents(ALL_EVENTS);
|
m = chEvtGetAndClearEvents(ALL_EVENTS);
|
||||||
test_assert(m == 0, "stuck event");
|
test_assert(m == 0, "stuck event");
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
|
|
||||||
/* [5.4.3] Getting current time and starting a signaler thread, the
|
/* [5.4.3] Getting current time and starting a signaler thread, the
|
||||||
thread will set an event flag after 50mS.*/
|
thread will set an event flag after 50mS.*/
|
||||||
|
@ -325,6 +336,7 @@ static void nil_test_005_004_execute(void) {
|
||||||
};
|
};
|
||||||
tp = chThdCreate(&tc);
|
tp = chThdCreate(&tc);
|
||||||
}
|
}
|
||||||
|
test_end_step(3);
|
||||||
|
|
||||||
/* [5.4.4] Calling chEvtWaitAny() then verifying that the event has
|
/* [5.4.4] Calling chEvtWaitAny() then verifying that the event has
|
||||||
been received after 50mS and that the event flags mask has been
|
been received after 50mS and that the event flags mask has been
|
||||||
|
@ -340,6 +352,7 @@ static void nil_test_005_004_execute(void) {
|
||||||
test_assert(m == 0, "stuck event");
|
test_assert(m == 0, "stuck event");
|
||||||
chThdWait(tp);
|
chThdWait(tp);
|
||||||
}
|
}
|
||||||
|
test_end_step(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_005_004 = {
|
static const testcase_t nil_test_005_004 = {
|
||||||
|
@ -382,6 +395,7 @@ static void nil_test_005_005_execute(void) {
|
||||||
{
|
{
|
||||||
chEvtAddEvents(5);
|
chEvtAddEvents(5);
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [5.5.2] Calling chEvtWaitAll() one time, the two flags must be
|
/* [5.5.2] Calling chEvtWaitAll() one time, the two flags must be
|
||||||
returned.*/
|
returned.*/
|
||||||
|
@ -392,12 +406,14 @@ static void nil_test_005_005_execute(void) {
|
||||||
m = chEvtGetAndClearEvents(ALL_EVENTS);
|
m = chEvtGetAndClearEvents(ALL_EVENTS);
|
||||||
test_assert(m == 0, "stuck event");
|
test_assert(m == 0, "stuck event");
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
|
|
||||||
/* [5.5.3] Setting one event flag.*/
|
/* [5.5.3] Setting one event flag.*/
|
||||||
test_set_step(3);
|
test_set_step(3);
|
||||||
{
|
{
|
||||||
chEvtAddEvents(4);
|
chEvtAddEvents(4);
|
||||||
}
|
}
|
||||||
|
test_end_step(3);
|
||||||
|
|
||||||
/* [5.5.4] Getting current time and starting a signaler thread, the
|
/* [5.5.4] Getting current time and starting a signaler thread, the
|
||||||
thread will set another event flag after 50mS.*/
|
thread will set another event flag after 50mS.*/
|
||||||
|
@ -414,6 +430,7 @@ static void nil_test_005_005_execute(void) {
|
||||||
};
|
};
|
||||||
tp = chThdCreate(&tc);
|
tp = chThdCreate(&tc);
|
||||||
}
|
}
|
||||||
|
test_end_step(4);
|
||||||
|
|
||||||
/* [5.5.5] Calling chEvtWaitAll() then verifying that both event
|
/* [5.5.5] Calling chEvtWaitAll() then verifying that both event
|
||||||
flags have been received after 50mS and that the event flags mask
|
flags have been received after 50mS and that the event flags mask
|
||||||
|
@ -429,6 +446,7 @@ static void nil_test_005_005_execute(void) {
|
||||||
test_assert(m == 0, "stuck event");
|
test_assert(m == 0, "stuck event");
|
||||||
chThdWait(tp);
|
chThdWait(tp);
|
||||||
}
|
}
|
||||||
|
test_end_step(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_005_005 = {
|
static const testcase_t nil_test_005_005 = {
|
||||||
|
@ -471,6 +489,7 @@ static void nil_test_005_006_execute(void) {
|
||||||
m = chEvtWaitAllTimeout(ALL_EVENTS, TIME_IMMEDIATE);
|
m = chEvtWaitAllTimeout(ALL_EVENTS, TIME_IMMEDIATE);
|
||||||
test_assert(m == 0, "spurious event");
|
test_assert(m == 0, "spurious event");
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [5.6.2] The functions are invoked first with a 50mS timeout, the
|
/* [5.6.2] The functions are invoked first with a 50mS timeout, the
|
||||||
timeout condition is tested.*/
|
timeout condition is tested.*/
|
||||||
|
@ -483,6 +502,7 @@ static void nil_test_005_006_execute(void) {
|
||||||
m = chEvtWaitAllTimeout(ALL_EVENTS, TIME_MS2I(50));
|
m = chEvtWaitAllTimeout(ALL_EVENTS, TIME_MS2I(50));
|
||||||
test_assert(m == 0, "spurious event");
|
test_assert(m == 0, "spurious event");
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_005_006 = {
|
static const testcase_t nil_test_005_006 = {
|
||||||
|
@ -530,6 +550,7 @@ static void nil_test_005_007_execute(void) {
|
||||||
chEvtRegisterMask(&es1, &el1, 1);
|
chEvtRegisterMask(&es1, &el1, 1);
|
||||||
chEvtRegisterMask(&es2, &el2, 4);
|
chEvtRegisterMask(&es2, &el2, 4);
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [5.7.2] Getting current time and starting a broadcaster thread,
|
/* [5.7.2] Getting current time and starting a broadcaster thread,
|
||||||
the thread broadcast the first Event Source immediately and the
|
the thread broadcast the first Event Source immediately and the
|
||||||
|
@ -547,6 +568,7 @@ static void nil_test_005_007_execute(void) {
|
||||||
};
|
};
|
||||||
tp = chThdCreate(&tc);
|
tp = chThdCreate(&tc);
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
|
|
||||||
/* [5.7.3] Calling chEvtWaitAll() then verifying that both event
|
/* [5.7.3] Calling chEvtWaitAll() then verifying that both event
|
||||||
flags have been received after 50mS and that the event flags mask
|
flags have been received after 50mS and that the event flags mask
|
||||||
|
@ -561,6 +583,7 @@ static void nil_test_005_007_execute(void) {
|
||||||
test_assert(m == 0, "stuck event");
|
test_assert(m == 0, "stuck event");
|
||||||
chThdWait(tp);
|
chThdWait(tp);
|
||||||
}
|
}
|
||||||
|
test_end_step(3);
|
||||||
|
|
||||||
/* [5.7.4] Unregistering from the Event Sources.*/
|
/* [5.7.4] Unregistering from the Event Sources.*/
|
||||||
test_set_step(4);
|
test_set_step(4);
|
||||||
|
@ -570,6 +593,7 @@ static void nil_test_005_007_execute(void) {
|
||||||
test_assert(!chEvtIsListeningI(&es1), "stuck listener");
|
test_assert(!chEvtIsListeningI(&es1), "stuck listener");
|
||||||
test_assert(!chEvtIsListeningI(&es2), "stuck listener");
|
test_assert(!chEvtIsListeningI(&es2), "stuck listener");
|
||||||
}
|
}
|
||||||
|
test_end_step(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_005_007 = {
|
static const testcase_t nil_test_005_007 = {
|
||||||
|
|
|
@ -92,6 +92,7 @@ static void nil_test_006_001_execute(void) {
|
||||||
};
|
};
|
||||||
tp1 = chThdCreate(&tc);
|
tp1 = chThdCreate(&tc);
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [6.1.2] Waiting for four messages then testing the receive
|
/* [6.1.2] Waiting for four messages then testing the receive
|
||||||
order.*/
|
order.*/
|
||||||
|
@ -108,6 +109,7 @@ static void nil_test_006_001_execute(void) {
|
||||||
chThdWait(tp1);
|
chThdWait(tp1);
|
||||||
test_assert_sequence("ABCD", "invalid sequence");
|
test_assert_sequence("ABCD", "invalid sequence");
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_006_001 = {
|
static const testcase_t nil_test_006_001 = {
|
||||||
|
|
|
@ -150,6 +150,7 @@ static void nil_test_007_001_execute(void) {
|
||||||
};
|
};
|
||||||
tp = chThdCreate(&tc);
|
tp = chThdCreate(&tc);
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [7.1.2] The number of messages exchanged is counted in a one
|
/* [7.1.2] The number of messages exchanged is counted in a one
|
||||||
second time window.*/
|
second time window.*/
|
||||||
|
@ -158,6 +159,7 @@ static void nil_test_007_001_execute(void) {
|
||||||
n = msg_loop_test(tp);
|
n = msg_loop_test(tp);
|
||||||
chThdWait(tp);
|
chThdWait(tp);
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
|
|
||||||
/* [7.1.3] Score is printed.*/
|
/* [7.1.3] Score is printed.*/
|
||||||
test_set_step(3);
|
test_set_step(3);
|
||||||
|
@ -168,6 +170,7 @@ static void nil_test_007_001_execute(void) {
|
||||||
test_printn(n << 1);
|
test_printn(n << 1);
|
||||||
test_println(" ctxswc/S");
|
test_println(" ctxswc/S");
|
||||||
}
|
}
|
||||||
|
test_end_step(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_007_001 = {
|
static const testcase_t nil_test_007_001 = {
|
||||||
|
@ -220,6 +223,7 @@ static void nil_test_007_002_execute(void) {
|
||||||
};
|
};
|
||||||
tp = chThdCreate(&tc);
|
tp = chThdCreate(&tc);
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [7.2.2] The number of messages exchanged is counted in a one
|
/* [7.2.2] The number of messages exchanged is counted in a one
|
||||||
second time window.*/
|
second time window.*/
|
||||||
|
@ -228,6 +232,7 @@ static void nil_test_007_002_execute(void) {
|
||||||
n = msg_loop_test(tp);
|
n = msg_loop_test(tp);
|
||||||
chThdWait(tp);
|
chThdWait(tp);
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
|
|
||||||
/* [7.2.3] Score is printed.*/
|
/* [7.2.3] Score is printed.*/
|
||||||
test_set_step(3);
|
test_set_step(3);
|
||||||
|
@ -238,6 +243,7 @@ static void nil_test_007_002_execute(void) {
|
||||||
test_printn(n << 1);
|
test_printn(n << 1);
|
||||||
test_println(" ctxswc/S");
|
test_println(" ctxswc/S");
|
||||||
}
|
}
|
||||||
|
test_end_step(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_007_002 = {
|
static const testcase_t nil_test_007_002 = {
|
||||||
|
@ -284,6 +290,7 @@ static void nil_test_007_003_execute(void) {
|
||||||
};
|
};
|
||||||
tp = chThdCreate(&tc);
|
tp = chThdCreate(&tc);
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [7.3.2] Waking up the thread as fast as possible in a one second
|
/* [7.3.2] Waking up the thread as fast as possible in a one second
|
||||||
time window.*/
|
time window.*/
|
||||||
|
@ -304,6 +311,7 @@ static void nil_test_007_003_execute(void) {
|
||||||
n += 4;
|
n += 4;
|
||||||
} while (chVTIsSystemTimeWithinX(start, end));
|
} while (chVTIsSystemTimeWithinX(start, end));
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
|
|
||||||
/* [7.3.3] Stopping the target thread.*/
|
/* [7.3.3] Stopping the target thread.*/
|
||||||
test_set_step(3);
|
test_set_step(3);
|
||||||
|
@ -313,6 +321,7 @@ static void nil_test_007_003_execute(void) {
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
chThdWait(tp);
|
chThdWait(tp);
|
||||||
}
|
}
|
||||||
|
test_end_step(3);
|
||||||
|
|
||||||
/* [7.3.4] Score is printed.*/
|
/* [7.3.4] Score is printed.*/
|
||||||
test_set_step(4);
|
test_set_step(4);
|
||||||
|
@ -321,6 +330,7 @@ static void nil_test_007_003_execute(void) {
|
||||||
test_printn(n * 2);
|
test_printn(n * 2);
|
||||||
test_println(" ctxswc/S");
|
test_println(" ctxswc/S");
|
||||||
}
|
}
|
||||||
|
test_end_step(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_007_003 = {
|
static const testcase_t nil_test_007_003 = {
|
||||||
|
@ -374,6 +384,7 @@ static void nil_test_007_004_execute(void) {
|
||||||
n++;
|
n++;
|
||||||
} while (chVTIsSystemTimeWithinX(start, end));
|
} while (chVTIsSystemTimeWithinX(start, end));
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [7.4.2] Score is printed.*/
|
/* [7.4.2] Score is printed.*/
|
||||||
test_set_step(2);
|
test_set_step(2);
|
||||||
|
@ -382,6 +393,7 @@ static void nil_test_007_004_execute(void) {
|
||||||
test_printn(n);
|
test_printn(n);
|
||||||
test_println(" threads/S");
|
test_println(" threads/S");
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_007_004 = {
|
static const testcase_t nil_test_007_004 = {
|
||||||
|
@ -436,6 +448,7 @@ static void nil_test_007_005_execute(void) {
|
||||||
n++;
|
n++;
|
||||||
} while (chVTIsSystemTimeWithinX(start, end));
|
} while (chVTIsSystemTimeWithinX(start, end));
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [7.5.2] Score is printed.*/
|
/* [7.5.2] Score is printed.*/
|
||||||
test_set_step(2);
|
test_set_step(2);
|
||||||
|
@ -444,6 +457,7 @@ static void nil_test_007_005_execute(void) {
|
||||||
test_printn(n);
|
test_printn(n);
|
||||||
test_println(" threads/S");
|
test_println(" threads/S");
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_007_005 = {
|
static const testcase_t nil_test_007_005 = {
|
||||||
|
@ -507,6 +521,7 @@ static void nil_test_007_006_execute(void) {
|
||||||
#endif
|
#endif
|
||||||
} while (chVTIsSystemTimeWithinX(start, end));
|
} while (chVTIsSystemTimeWithinX(start, end));
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [7.6.2] The score is printed.*/
|
/* [7.6.2] The score is printed.*/
|
||||||
test_set_step(2);
|
test_set_step(2);
|
||||||
|
@ -515,6 +530,7 @@ static void nil_test_007_006_execute(void) {
|
||||||
test_printn(n * 4);
|
test_printn(n * 4);
|
||||||
test_println(" wait+signal/S");
|
test_println(" wait+signal/S");
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_007_006 = {
|
static const testcase_t nil_test_007_006 = {
|
||||||
|
@ -550,6 +566,7 @@ static void nil_test_007_007_execute(void) {
|
||||||
test_printn(sizeof(nil_system_t));
|
test_printn(sizeof(nil_system_t));
|
||||||
test_println(" bytes");
|
test_println(" bytes");
|
||||||
}
|
}
|
||||||
|
test_end_step(1);
|
||||||
|
|
||||||
/* [7.7.2] The size of a thread structure is printed.*/
|
/* [7.7.2] The size of a thread structure is printed.*/
|
||||||
test_set_step(2);
|
test_set_step(2);
|
||||||
|
@ -558,6 +575,7 @@ static void nil_test_007_007_execute(void) {
|
||||||
test_printn(sizeof(thread_t));
|
test_printn(sizeof(thread_t));
|
||||||
test_println(" bytes");
|
test_println(" bytes");
|
||||||
}
|
}
|
||||||
|
test_end_step(2);
|
||||||
|
|
||||||
/* [7.7.3] The size of a semaphore structure is printed.*/
|
/* [7.7.3] The size of a semaphore structure is printed.*/
|
||||||
test_set_step(3);
|
test_set_step(3);
|
||||||
|
@ -568,6 +586,7 @@ static void nil_test_007_007_execute(void) {
|
||||||
test_println(" bytes");
|
test_println(" bytes");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
test_end_step(3);
|
||||||
|
|
||||||
/* [7.7.4] The size of an event source is printed.*/
|
/* [7.7.4] The size of an event source is printed.*/
|
||||||
test_set_step(4);
|
test_set_step(4);
|
||||||
|
@ -578,6 +597,7 @@ static void nil_test_007_007_execute(void) {
|
||||||
test_println(" bytes");
|
test_println(" bytes");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
test_end_step(4);
|
||||||
|
|
||||||
/* [7.7.5] The size of an event listener is printed.*/
|
/* [7.7.5] The size of an event listener is printed.*/
|
||||||
test_set_step(5);
|
test_set_step(5);
|
||||||
|
@ -588,6 +608,7 @@ static void nil_test_007_007_execute(void) {
|
||||||
test_println(" bytes");
|
test_println(" bytes");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
test_end_step(5);
|
||||||
|
|
||||||
/* [7.7.6] The size of a mailbox is printed.*/
|
/* [7.7.6] The size of a mailbox is printed.*/
|
||||||
test_set_step(6);
|
test_set_step(6);
|
||||||
|
@ -598,6 +619,7 @@ static void nil_test_007_007_execute(void) {
|
||||||
test_println(" bytes");
|
test_println(" bytes");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
test_end_step(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const testcase_t nil_test_007_007 = {
|
static const testcase_t nil_test_007_007 = {
|
||||||
|
|
|
@ -207,7 +207,11 @@ test_println("");]]></value>
|
||||||
<value />
|
<value />
|
||||||
</tags>
|
</tags>
|
||||||
<code>
|
<code>
|
||||||
<value><![CDATA[test_print("--- CH_CFG_USE_MEMCORE: ");
|
<value><![CDATA[
|
||||||
|
test_print("--- CH_CFG_USE_MAILBOXES: ");
|
||||||
|
test_printn(CH_CFG_USE_MAILBOXES);
|
||||||
|
test_println("");
|
||||||
|
test_print("--- CH_CFG_USE_MEMCORE: ");
|
||||||
test_printn(CH_CFG_USE_MEMCORE);
|
test_printn(CH_CFG_USE_MEMCORE);
|
||||||
test_println("");
|
test_println("");
|
||||||
test_print("--- CH_CFG_USE_HEAP: ");
|
test_print("--- CH_CFG_USE_HEAP: ");
|
||||||
|
@ -222,6 +226,12 @@ test_println("");
|
||||||
test_print("--- CH_CFG_USE_PIPES: ");
|
test_print("--- CH_CFG_USE_PIPES: ");
|
||||||
test_printn(CH_CFG_USE_PIPES);
|
test_printn(CH_CFG_USE_PIPES);
|
||||||
test_println("");
|
test_println("");
|
||||||
|
test_print("--- CH_CFG_USE_OBJ_CACHES: ");
|
||||||
|
test_printn(CH_CFG_USE_OBJ_CACHES);
|
||||||
|
test_println("");
|
||||||
|
test_print("--- CH_CFG_USE_DELEGATES: ");
|
||||||
|
test_printn(CH_CFG_USE_DELEGATES);
|
||||||
|
test_println("");
|
||||||
test_print("--- CH_CFG_USE_FACTORY: ");
|
test_print("--- CH_CFG_USE_FACTORY: ");
|
||||||
test_printn(CH_CFG_USE_FACTORY);
|
test_printn(CH_CFG_USE_FACTORY);
|
||||||
test_println("");
|
test_println("");
|
||||||
|
@ -1078,15 +1088,12 @@ static THD_WORKING_AREA(waThread1, 256);
|
||||||
static THD_FUNCTION(Thread1, arg) {
|
static THD_FUNCTION(Thread1, arg) {
|
||||||
|
|
||||||
(void)arg;
|
(void)arg;
|
||||||
|
|
||||||
chRegSetThreadName("dispatcher");
|
|
||||||
|
|
||||||
exit_flag = false;
|
exit_flag = false;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
chDelegateDispatch();
|
chDelegateDispatch();
|
||||||
} while (!exit_flag);
|
} while (!exit_flag);
|
||||||
|
|
||||||
chThdExit(0x0FA5);
|
chThdExit(0x0FA5);
|
||||||
}
|
}
|
||||||
]]></value>
|
]]></value>
|
||||||
|
@ -1127,10 +1134,26 @@ thread_t *tp;
|
||||||
<code>
|
<code>
|
||||||
<value><![CDATA[
|
<value><![CDATA[
|
||||||
#if defined(_CHIBIOS_RT_)
|
#if defined(_CHIBIOS_RT_)
|
||||||
tp = chThdCreateStatic(waThread1, sizeof(waThread1),
|
thread_descriptor_t &td = {
|
||||||
chThdGetPriorityX() + 1, Thread1, NULL);
|
.name = "dispatcher",
|
||||||
|
.wbase = waThread1,
|
||||||
|
.wend = THD_WORKING_AREA_END(waThread1),
|
||||||
|
.prio = chThdGetPriorityX() + 1,
|
||||||
|
.funcp = Thread1,
|
||||||
|
.arg = NULL
|
||||||
|
};
|
||||||
|
tp = chThdCreate(&td);
|
||||||
#endif
|
#endif
|
||||||
#if defined(_CHIBIOS_NIL_)
|
#if defined(_CHIBIOS_NIL_)
|
||||||
|
thread_config_t tc = {
|
||||||
|
.prio = chThdGetPriorityX() + 1,
|
||||||
|
.namep = "dispatcher",
|
||||||
|
.wbase = waThread1,
|
||||||
|
.wend = THD_WORKING_AREA_END(waThread1),
|
||||||
|
.funcp = Thread1,
|
||||||
|
.arg = NULL
|
||||||
|
};
|
||||||
|
tp = chThdCreate(&tc);
|
||||||
#endif
|
#endif
|
||||||
]]></value>
|
]]></value>
|
||||||
</code>
|
</code>
|
||||||
|
|
|
@ -162,6 +162,9 @@ static void oslib_test_001_003_execute(void) {
|
||||||
/* [1.3.1] Prints the configuration options settings.*/
|
/* [1.3.1] Prints the configuration options settings.*/
|
||||||
test_set_step(1);
|
test_set_step(1);
|
||||||
{
|
{
|
||||||
|
test_print("--- CH_CFG_USE_MAILBOXES: ");
|
||||||
|
test_printn(CH_CFG_USE_MAILBOXES);
|
||||||
|
test_println("");
|
||||||
test_print("--- CH_CFG_USE_MEMCORE: ");
|
test_print("--- CH_CFG_USE_MEMCORE: ");
|
||||||
test_printn(CH_CFG_USE_MEMCORE);
|
test_printn(CH_CFG_USE_MEMCORE);
|
||||||
test_println("");
|
test_println("");
|
||||||
|
@ -177,6 +180,12 @@ static void oslib_test_001_003_execute(void) {
|
||||||
test_print("--- CH_CFG_USE_PIPES: ");
|
test_print("--- CH_CFG_USE_PIPES: ");
|
||||||
test_printn(CH_CFG_USE_PIPES);
|
test_printn(CH_CFG_USE_PIPES);
|
||||||
test_println("");
|
test_println("");
|
||||||
|
test_print("--- CH_CFG_USE_OBJ_CACHES: ");
|
||||||
|
test_printn(CH_CFG_USE_OBJ_CACHES);
|
||||||
|
test_println("");
|
||||||
|
test_print("--- CH_CFG_USE_DELEGATES: ");
|
||||||
|
test_printn(CH_CFG_USE_DELEGATES);
|
||||||
|
test_println("");
|
||||||
test_print("--- CH_CFG_USE_FACTORY: ");
|
test_print("--- CH_CFG_USE_FACTORY: ");
|
||||||
test_printn(CH_CFG_USE_FACTORY);
|
test_printn(CH_CFG_USE_FACTORY);
|
||||||
test_println("");
|
test_println("");
|
||||||
|
|
|
@ -102,10 +102,7 @@ static THD_FUNCTION(Thread1, arg) {
|
||||||
|
|
||||||
(void)arg;
|
(void)arg;
|
||||||
|
|
||||||
chRegSetThreadName("dispatcher");
|
|
||||||
|
|
||||||
exit_flag = false;
|
exit_flag = false;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
chDelegateDispatch();
|
chDelegateDispatch();
|
||||||
} while (!exit_flag);
|
} while (!exit_flag);
|
||||||
|
@ -142,6 +139,15 @@ static void oslib_test_004_001_execute(void) {
|
||||||
chThdGetPriorityX() + 1, Thread1, NULL);
|
chThdGetPriorityX() + 1, Thread1, NULL);
|
||||||
#endif
|
#endif
|
||||||
#if defined(_CHIBIOS_NIL_)
|
#if defined(_CHIBIOS_NIL_)
|
||||||
|
thread_config_t tc = {
|
||||||
|
.prio = chThdGetPriorityX() + 1,
|
||||||
|
.namep = "dispatcher",
|
||||||
|
.wbase = waThread1,
|
||||||
|
.wend = THD_WORKING_AREA_END(waThread1),
|
||||||
|
.funcp = Thread1,
|
||||||
|
.arg = NULL
|
||||||
|
};
|
||||||
|
tp = chThdCreate(&tc);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
test_end_step(1);
|
test_end_step(1);
|
||||||
|
|
Loading…
Reference in New Issue