ChibiOS/NIL Test Suite.
Test suite for ChibiOS/NIL. The purpose of this suite is to
perform unit tests on the NIL modules and to converge to 100%
code coverage through successive improvements.
nil_
Internal Tests
Information.
This sequence reports configuration and version
information about the NIL kernel.
Port Info.
Port-related info are reported.
Prints the version string.
Kernel Info.
The version numbers are reported.
Prints the version string.
Kernel Settings.
The static kernel settings are reported.
Prints the configuration options settings.
Internal Tests
Time and Intervals Functionality.
This sequence tests the ChibiOS/NIL functionalities
related to time and intervals management.
System Tick Counter functionality.
The functionality of the API @p chVTGetSystemTimeX()
is tested.
A System Tick Counter increment is expected, the
test simply hangs if it does not happen.
Time ranges functionality.
The functionality of the API @p chTimeIsInRangeX() is
tested.
Checking case where start == end, it must always
evaluate as not in range.
Checking boundaries for start < end.
Checking boundaries for start > end.
Internal Tests
Threads Functionality.
This sequence tests the ChibiOS/NIL functionalities
related to threading.
Thread Sleep functionality.
The functionality of @p chThdSleep() and derivatives
is tested.
The current system time is read then a sleep is
performed for 100 system ticks and on exit the system
time is verified again.
The current system time is read then a sleep is
performed for 100000 microseconds and on exit the
system time is verified again.
The current system time is read then a sleep is
performed for 100 milliseconds and on exit the system
time is verified again.
The current system time is read then a sleep is
performed for 1 second and on exit the system time is
verified again.
Function chThdSleepUntil() is tested with a
timeline of "now" + 100 ticks.
Internal Tests
Semaphores.
This sequence tests the ChibiOS/NIL functionalities
related to counter semaphores.
Semaphore primitives, no state change.
Wait, Signal and Reset primitives are tested. The
testing thread does not trigger a state change.
The function chSemWait() is invoked, after return
the counter and the returned message are tested.
The function chSemSignal() is invoked, after
return the counter is tested.
The function chSemReset() is invoked, after
return the counter is tested.
Semaphore primitives, with state change.
Wait, Signal and Reset primitives are tested. The
testing thread triggers a state change.
The function chSemWait() is invoked, after return
the counter and the returned message are tested. The
semaphore is signaled by another thread.
The function chSemWait() is invoked, after return
the counter and the returned message are tested. The
semaphore is reset by another thread.
Semaphores timeout.
Timeout on semaphores is tested.
The function chSemWaitTimeout() is invoked a
first time, after return the system time, the counter
and the returned message are tested.
The function chSemWaitTimeout() is invoked again,
after return the system time, the counter and the
returned message are tested.
Internal Tests
Suspend/Resume.
This sequence tests the ChibiOS/NIL functionalities
related to threads suspend/resume.
Suspend and Resume functionality.
The functionality of chThdSuspendTimeoutS() and
chThdResumeI() is tested.
The function chThdSuspendTimeoutS() is invoked,
the thread is remotely resumed with message @p MSG_OK.
On return the message and the state of the reference
are tested.
The function chThdSuspendTimeoutS() is invoked,
the thread is not resumed so a timeout must occur. On
return the message and the state of the reference are
tested.
Internal Tests
Event Sources and Event Flags.
This module implements the test sequence for the Events
subsystem.
Events registration.
Two event listeners are registered on an event source
and then unregistered in the same order.<br>
The test expects that the even source has listeners after
the registrations and after the first unregistration,
then, after the second unegistration, the test expects no
more listeners.
An Event Source is initialized.
Two Event Listeners are registered on the Event
Source, the Event Source is tested to have listeners.
An Event Listener is unregistered, the Event
Source must still have listeners.
An Event Listener is unregistered, the Event
Source must not have listeners.
Event Flags dispatching.
The test dispatches three event flags and verifies
that the associated event handlers are invoked in
LSb-first order.
Three evenf flag bits are raised then
chEvtDispatch() is invoked, the sequence of handlers
calls is tested.
Events Flags wait using chEvtWaitOne().
Functionality of chEvtWaitOne() is tested under
various scenarios.
Setting three event flags.
Calling chEvtWaitOne() three times, each time a
single flag must be returned in order of priority.
Getting current time and starting a signaler
thread, the thread will set an event flag after 50mS.
Calling chEvtWaitOne() then verifying that the
event has been received after 50mS and that the event
flags mask has been emptied.
Events Flags wait using chEvtWaitAny().
Functionality of chEvtWaitAny() is tested under
various scenarios.
Setting two, non contiguous, event flags.
Calling chEvtWaitAny() one time, the two flags
must be returned.
Getting current time and starting a signaler
thread, the thread will set an event flag after 50mS.
Calling chEvtWaitAny() then verifying that the
event has been received after 50mS and that the event
flags mask has been emptied.
Events Flags wait using chEvtWaitAll().
Functionality of chEvtWaitAll() is tested under
various scenarios.
Setting two, non contiguous, event flags.
Calling chEvtWaitAll() one time, the two flags
must be returned.
Setting one event flag.
Getting current time and starting a signaler
thread, the thread will set another event flag after
50mS.
Calling chEvtWaitAll() then verifying that both
event flags have been received after 50mS and that the
event flags mask has been emptied.
Events Flags wait timeouts.
Timeout functionality is tested for
chEvtWaitOneTimeout(), chEvtWaitAnyTimeout() and
chEvtWaitAllTimeout().
F
The functions are invoked first with
TIME_IMMEDIATE timeout, the timeout condition is
tested.
The functions are invoked first with a 50mS
timeout, the timeout condition is tested.
Broadcasting using chEvtBroadcast().
Functionality of chEvtBroadcast() is tested.
Registering on two event sources associating them
with flags 1 and 4.
Getting current time and starting a broadcaster
thread, the thread broadcast the first Event Source
immediately and the other after 50mS.
Calling chEvtWaitAll() then verifying that both
event flags have been received after 50mS and that the
event flags mask has been emptied.
Unregistering from the Event Sources.
Internal Tests
Synchronous Messages.
This module implements the test sequence for the
Synchronous Messages subsystem.
Messages Server loop.
A messenger thread is spawned that sends four
messages back to the tester thread.<br>
The test expect to receive the messages in the correct sequence and
to not find a fifth message waiting.
Starting the messenger thread.
Waiting for four messages then testing the
receive order.
Benchmarks
Benchmarks.
This module implements a series of system benchmarks. The
benchmarks are useful as a stress test and as a reference when
comparing ChibiOS/RT with similar systems.<br>
Objective of the test sequence is to provide a performance
index for the most critical system subsystems. The performance
numbers allow to discover performance regressions between
successive ChibiOS/RT releases.
u1.msg;
} while (msg == MSG_OK);
chSysUnlock();
}]]>
Messages performance #1.
A message server thread is created with a lower
priority than the client thread, the messages throughput
per second is measured and the result printed on the
output log.
The messenger thread is started at a lower
priority than the current thread.
The number of messages exchanged is counted in a
one second time window.
Score is printed.
Messages performance #2.
A message server thread is created with an higher
priority than the client thread, the messages throughput
per second is measured and the result printed on the
output log.
The messenger thread is started at an higher
priority than the current thread.
The number of messages exchanged is counted in a
one second time window.
Score is printed.
Context Switch performance.
A thread is created that just performs a @p
chSchGoSleepS() into a loop, the thread is awakened as
fast is possible by the tester thread.<br>
The Context Switch performance is calculated by measuring the number
of iterations after a second of continuous operations.
Starting the target thread at an higher priority
level.
Waking up the thread as fast as possible in a one
second time window.
Stopping the target thread.
Score is printed.
Threads performance, full cycle.
Threads are continuously created and terminated into
a loop. A full chThdCreateStatic() / @p chThdExit() / @p
chThdWait() cycle is performed in each
iteration.<br>
The performance is calculated by measuring the number of iterations
after a second of continuous operations.
A thread is created at a lower priority level and
its termination detected using @p chThdWait(). The
operation is repeated continuously in a one-second
time window.
Score is printed.
Threads performance, create/exit only.
Threads are continuously created and terminated into
a loop. A partial @p chThdCreateStatic() / @p chThdExit()
cycle is performed in each iteration, the @p chThdWait()
is not necessary because the thread is created at an
higher priority so there is no need to wait for it to
terminate.<br> The performance is calculated by
measuring the number of iterations after a second of
continuous operations.
A thread is created at an higher priority level
and let terminate immediately. The operation is
repeated continuously in a one-second time window.
Score is printed.
Semaphores wait/signal performance
A counting semaphore is taken/released into a
continuous loop, no Context Switch happens because the
counter is always non negative.<br>
The performance is calculated by measuring the number of iterations
after a second of continuous operations.
A semaphore is teken and released. The operation
is repeated continuously in a one-second time window.
The score is printed.
RAM Footprint.
The memory size of the various kernel objects is
printed.
The size of the system area is printed.
The size of a thread structure is printed.
The size of a semaphore structure is printed.
The size of an event source is printed.
The size of an event listener is printed.
The size of a mailbox is printed.