git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2020 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
eee0672c0a
commit
a544f87a38
|
@ -60,6 +60,7 @@
|
||||||
|
|
||||||
*** 2.1.0 ***
|
*** 2.1.0 ***
|
||||||
- FIX: Fixed assertion in adcStop() (bug 3015109)(backported in 2.0.0).
|
- FIX: Fixed assertion in adcStop() (bug 3015109)(backported in 2.0.0).
|
||||||
|
- OPT: Simplified the test suite code, now it is smaller (backported in 2.0.0).
|
||||||
|
|
||||||
*** 1.5.9 ***
|
*** 1.5.9 ***
|
||||||
- FIX: Fixed STM8 baud rate setup error (bug 3010990).
|
- FIX: Fixed STM8 baud rate setup error (bug 3010990).
|
||||||
|
|
|
@ -110,7 +110,7 @@ void test_printn(uint32_t n) {
|
||||||
*
|
*
|
||||||
* @param[in] msgp the message
|
* @param[in] msgp the message
|
||||||
*/
|
*/
|
||||||
void test_print(char *msgp) {
|
void test_print(const char *msgp) {
|
||||||
|
|
||||||
while (*msgp)
|
while (*msgp)
|
||||||
chIOPut(chp, *msgp++);
|
chIOPut(chp, *msgp++);
|
||||||
|
@ -121,7 +121,7 @@ void test_print(char *msgp) {
|
||||||
*
|
*
|
||||||
* @param[in] msgp the message
|
* @param[in] msgp the message
|
||||||
*/
|
*/
|
||||||
void test_println(char *msgp) {
|
void test_println(const char *msgp) {
|
||||||
|
|
||||||
test_print(msgp);
|
test_print(msgp);
|
||||||
chIOPut(chp, '\r');
|
chIOPut(chp, '\r');
|
||||||
|
@ -353,7 +353,7 @@ msg_t TestThread(void *p) {
|
||||||
test_print(".");
|
test_print(".");
|
||||||
test_printn(j + 1);
|
test_printn(j + 1);
|
||||||
test_print(" (");
|
test_print(" (");
|
||||||
test_print(patterns[i][j]->gettest());
|
test_print(patterns[i][j]->name);
|
||||||
test_println(")");
|
test_println(")");
|
||||||
#if DELAY_BETWEEN_TESTS > 0
|
#if DELAY_BETWEEN_TESTS > 0
|
||||||
chThdSleepMilliseconds(DELAY_BETWEEN_TESTS);
|
chThdSleepMilliseconds(DELAY_BETWEEN_TESTS);
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
* @brief Structure representing a test case.
|
* @brief Structure representing a test case.
|
||||||
*/
|
*/
|
||||||
struct testcase {
|
struct testcase {
|
||||||
char *(*gettest)(void); /**< @brief Test case name get function. */
|
const char *name; /**< @brief Test case name. */
|
||||||
void (*setup)(void); /**< @brief Test case preparation function. */
|
void (*setup)(void); /**< @brief Test case preparation function. */
|
||||||
void (*teardown)(void); /**< @brief Test case clean up function. */
|
void (*teardown)(void); /**< @brief Test case clean up function. */
|
||||||
void (*execute)(void); /**< @brief Test case execution function. */
|
void (*execute)(void); /**< @brief Test case execution function. */
|
||||||
|
@ -84,8 +84,8 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
msg_t TestThread(void *p);
|
msg_t TestThread(void *p);
|
||||||
void test_printn(uint32_t n);
|
void test_printn(uint32_t n);
|
||||||
void test_print(char *msgp);
|
void test_print(const char *msgp);
|
||||||
void test_println(char *msgp);
|
void test_println(const char *msgp);
|
||||||
void test_emit_token(char token);
|
void test_emit_token(char token);
|
||||||
bool_t _test_fail(unsigned point);
|
bool_t _test_fail(unsigned point);
|
||||||
bool_t _test_assert(unsigned point, bool_t condition);
|
bool_t _test_assert(unsigned point, bool_t condition);
|
||||||
|
|
|
@ -102,11 +102,6 @@ static unsigned int msg_loop_test(Thread *tp) {
|
||||||
* printed in the output log.
|
* printed in the output log.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *bmk1_gettest(void) {
|
|
||||||
|
|
||||||
return "Benchmark, messages #1";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void bmk1_execute(void) {
|
static void bmk1_execute(void) {
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
|
|
||||||
|
@ -121,7 +116,7 @@ static void bmk1_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testbmk1 = {
|
const struct testcase testbmk1 = {
|
||||||
bmk1_gettest,
|
"Benchmark, messages #1",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
bmk1_execute
|
bmk1_execute
|
||||||
|
@ -136,11 +131,6 @@ const struct testcase testbmk1 = {
|
||||||
* printed in the output log.
|
* printed in the output log.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *bmk2_gettest(void) {
|
|
||||||
|
|
||||||
return "Benchmark, messages #2";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void bmk2_execute(void) {
|
static void bmk2_execute(void) {
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
|
|
||||||
|
@ -155,7 +145,7 @@ static void bmk2_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testbmk2 = {
|
const struct testcase testbmk2 = {
|
||||||
bmk2_gettest,
|
"Benchmark, messages #2",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
bmk2_execute
|
bmk2_execute
|
||||||
|
@ -176,11 +166,6 @@ static msg_t thread2(void *p) {
|
||||||
* printed in the output log.
|
* printed in the output log.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *bmk3_gettest(void) {
|
|
||||||
|
|
||||||
return "Benchmark, messages #3";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void bmk3_execute(void) {
|
static void bmk3_execute(void) {
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
|
|
||||||
|
@ -199,7 +184,7 @@ static void bmk3_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testbmk3 = {
|
const struct testcase testbmk3 = {
|
||||||
bmk3_gettest,
|
"Benchmark, messages #3",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
bmk3_execute
|
bmk3_execute
|
||||||
|
@ -215,11 +200,6 @@ const struct testcase testbmk3 = {
|
||||||
* iterations after a second of continuous operations.
|
* iterations after a second of continuous operations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *bmk4_gettest(void) {
|
|
||||||
|
|
||||||
return "Benchmark, context switch";
|
|
||||||
}
|
|
||||||
|
|
||||||
msg_t thread4(void *p) {
|
msg_t thread4(void *p) {
|
||||||
msg_t msg;
|
msg_t msg;
|
||||||
Thread *self = chThdSelf();
|
Thread *self = chThdSelf();
|
||||||
|
@ -265,7 +245,7 @@ static void bmk4_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testbmk4 = {
|
const struct testcase testbmk4 = {
|
||||||
bmk4_gettest,
|
"Benchmark, context switch",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
bmk4_execute
|
bmk4_execute
|
||||||
|
@ -282,11 +262,6 @@ const struct testcase testbmk4 = {
|
||||||
* a second of continuous operations.
|
* a second of continuous operations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *bmk5_gettest(void) {
|
|
||||||
|
|
||||||
return "Benchmark, threads, full cycle";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void bmk5_execute(void) {
|
static void bmk5_execute(void) {
|
||||||
|
|
||||||
uint32_t n = 0;
|
uint32_t n = 0;
|
||||||
|
@ -307,7 +282,7 @@ static void bmk5_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testbmk5 = {
|
const struct testcase testbmk5 = {
|
||||||
bmk5_gettest,
|
"Benchmark, threads, full cycle",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
bmk5_execute
|
bmk5_execute
|
||||||
|
@ -326,11 +301,6 @@ const struct testcase testbmk5 = {
|
||||||
* a second of continuous operations.
|
* a second of continuous operations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *bmk6_gettest(void) {
|
|
||||||
|
|
||||||
return "Benchmark, threads, create only";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void bmk6_execute(void) {
|
static void bmk6_execute(void) {
|
||||||
|
|
||||||
uint32_t n = 0;
|
uint32_t n = 0;
|
||||||
|
@ -351,7 +321,7 @@ static void bmk6_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testbmk6 = {
|
const struct testcase testbmk6 = {
|
||||||
bmk6_gettest,
|
"Benchmark, threads, create only",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
bmk6_execute
|
bmk6_execute
|
||||||
|
@ -376,11 +346,6 @@ static msg_t thread3(void *p) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *bmk7_gettest(void) {
|
|
||||||
|
|
||||||
return "Benchmark, mass reschedule, 5 threads";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void bmk7_setup(void) {
|
static void bmk7_setup(void) {
|
||||||
|
|
||||||
chSemInit(&sem1, 0);
|
chSemInit(&sem1, 0);
|
||||||
|
@ -417,7 +382,7 @@ static void bmk7_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testbmk7 = {
|
const struct testcase testbmk7 = {
|
||||||
bmk7_gettest,
|
"Benchmark, mass reschedule, 5 threads",
|
||||||
bmk7_setup,
|
bmk7_setup,
|
||||||
NULL,
|
NULL,
|
||||||
bmk7_execute
|
bmk7_execute
|
||||||
|
@ -448,11 +413,6 @@ static msg_t thread8(void *p) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *bmk8_gettest(void) {
|
|
||||||
|
|
||||||
return "Benchmark, round robin context switching";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void bmk8_execute(void) {
|
static void bmk8_execute(void) {
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
|
|
||||||
|
@ -475,7 +435,7 @@ static void bmk8_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testbmk8 = {
|
const struct testcase testbmk8 = {
|
||||||
bmk8_gettest,
|
"Benchmark, round robin context switching",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
bmk8_execute
|
bmk8_execute
|
||||||
|
@ -491,11 +451,6 @@ const struct testcase testbmk8 = {
|
||||||
* a second of continuous operations.
|
* a second of continuous operations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *bmk9_gettest(void) {
|
|
||||||
|
|
||||||
return "Benchmark, I/O Queues throughput";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void bmk9_execute(void) {
|
static void bmk9_execute(void) {
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
static uint8_t ib[16];
|
static uint8_t ib[16];
|
||||||
|
@ -525,7 +480,7 @@ static void bmk9_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testbmk9 = {
|
const struct testcase testbmk9 = {
|
||||||
bmk9_gettest,
|
"Benchmark, I/O Queues throughput",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
bmk9_execute
|
bmk9_execute
|
||||||
|
@ -540,11 +495,6 @@ const struct testcase testbmk9 = {
|
||||||
* a second of continuous operations.
|
* a second of continuous operations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *bmk10_gettest(void) {
|
|
||||||
|
|
||||||
return "Benchmark, virtual timers set/reset";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void tmo(void *param) {(void)param;}
|
static void tmo(void *param) {(void)param;}
|
||||||
|
|
||||||
static void bmk10_execute(void) {
|
static void bmk10_execute(void) {
|
||||||
|
@ -571,7 +521,7 @@ static void bmk10_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testbmk10 = {
|
const struct testcase testbmk10 = {
|
||||||
bmk10_gettest,
|
"Benchmark, virtual timers set/reset",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
bmk10_execute
|
bmk10_execute
|
||||||
|
@ -587,11 +537,6 @@ const struct testcase testbmk10 = {
|
||||||
* a second of continuous operations.
|
* a second of continuous operations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *bmk11_gettest(void) {
|
|
||||||
|
|
||||||
return "Benchmark, semaphores wait/signal";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void bmk11_setup(void) {
|
static void bmk11_setup(void) {
|
||||||
|
|
||||||
chSemInit(&sem1, 1);
|
chSemInit(&sem1, 1);
|
||||||
|
@ -622,7 +567,7 @@ static void bmk11_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testbmk11 = {
|
const struct testcase testbmk11 = {
|
||||||
bmk11_gettest,
|
"Benchmark, semaphores wait/signal",
|
||||||
bmk11_setup,
|
bmk11_setup,
|
||||||
NULL,
|
NULL,
|
||||||
bmk11_execute
|
bmk11_execute
|
||||||
|
@ -639,11 +584,6 @@ const struct testcase testbmk11 = {
|
||||||
* a second of continuous operations.
|
* a second of continuous operations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *bmk12_gettest(void) {
|
|
||||||
|
|
||||||
return "Benchmark, mutexes lock/unlock";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void bmk12_setup(void) {
|
static void bmk12_setup(void) {
|
||||||
|
|
||||||
chMtxInit(&mtx1);
|
chMtxInit(&mtx1);
|
||||||
|
@ -674,7 +614,7 @@ static void bmk12_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testbmk12 = {
|
const struct testcase testbmk12 = {
|
||||||
bmk12_gettest,
|
"Benchmark, mutexes lock/unlock",
|
||||||
bmk12_setup,
|
bmk12_setup,
|
||||||
NULL,
|
NULL,
|
||||||
bmk12_execute
|
bmk12_execute
|
||||||
|
@ -688,11 +628,6 @@ const struct testcase testbmk12 = {
|
||||||
* The memory size of the various kernel objects is printed.
|
* The memory size of the various kernel objects is printed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *bmk13_gettest(void) {
|
|
||||||
|
|
||||||
return "Benchmark, RAM footprint";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void bmk13_execute(void) {
|
static void bmk13_execute(void) {
|
||||||
|
|
||||||
test_print("--- System: ");
|
test_print("--- System: ");
|
||||||
|
@ -740,7 +675,7 @@ static void bmk13_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testbmk13 = {
|
const struct testcase testbmk13 = {
|
||||||
bmk13_gettest,
|
"Benchmark, RAM footprint",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
bmk13_execute
|
bmk13_execute
|
||||||
|
|
|
@ -78,11 +78,6 @@ static msg_t thread(void *p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CH_USE_HEAP
|
#if CH_USE_HEAP
|
||||||
static char *dyn1_gettest(void) {
|
|
||||||
|
|
||||||
return "Dynamic APIs, threads creation from heap";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dyn1_setup(void) {
|
static void dyn1_setup(void) {
|
||||||
|
|
||||||
chHeapInit(&heap1, test.buffer, sizeof(union test_buffers));
|
chHeapInit(&heap1, test.buffer, sizeof(union test_buffers));
|
||||||
|
@ -123,7 +118,7 @@ static void dyn1_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testdyn1 = {
|
const struct testcase testdyn1 = {
|
||||||
dyn1_gettest,
|
"Dynamic APIs, threads creation from heap",
|
||||||
dyn1_setup,
|
dyn1_setup,
|
||||||
NULL,
|
NULL,
|
||||||
dyn1_execute
|
dyn1_execute
|
||||||
|
@ -141,11 +136,6 @@ const struct testcase testdyn1 = {
|
||||||
* one to fail.
|
* one to fail.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *dyn2_gettest(void) {
|
|
||||||
|
|
||||||
return "Dynamic APIs, threads creation from memory pool";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dyn2_setup(void) {
|
static void dyn2_setup(void) {
|
||||||
|
|
||||||
chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE), NULL);
|
chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE), NULL);
|
||||||
|
@ -184,7 +174,7 @@ static void dyn2_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testdyn2 = {
|
const struct testcase testdyn2 = {
|
||||||
dyn2_gettest,
|
"Dynamic APIs, threads creation from memory pool",
|
||||||
dyn2_setup,
|
dyn2_setup,
|
||||||
NULL,
|
NULL,
|
||||||
dyn2_execute
|
dyn2_execute
|
||||||
|
@ -212,11 +202,6 @@ static unsigned regscan(void) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *dyn3_gettest(void) {
|
|
||||||
|
|
||||||
return "Dynamic APIs, registry and references";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dyn3_setup(void) {
|
static void dyn3_setup(void) {
|
||||||
|
|
||||||
chHeapInit(&heap1, test.buffer, sizeof(union test_buffers));
|
chHeapInit(&heap1, test.buffer, sizeof(union test_buffers));
|
||||||
|
@ -256,7 +241,7 @@ static void dyn3_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testdyn3 = {
|
const struct testcase testdyn3 = {
|
||||||
dyn3_gettest,
|
"Dynamic APIs, registry and references",
|
||||||
dyn3_setup,
|
dyn3_setup,
|
||||||
NULL,
|
NULL,
|
||||||
dyn3_execute
|
dyn3_execute
|
||||||
|
|
|
@ -75,11 +75,6 @@ static EVENTSOURCE_DECL(es2);
|
||||||
* the associated event handlers are invoked in LSb-first order.
|
* the associated event handlers are invoked in LSb-first order.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *evt1_gettest(void) {
|
|
||||||
|
|
||||||
return "Events, registration and dispatch";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void evt1_setup(void) {
|
static void evt1_setup(void) {
|
||||||
|
|
||||||
chEvtClear(ALL_EVENTS);
|
chEvtClear(ALL_EVENTS);
|
||||||
|
@ -113,7 +108,7 @@ static void evt1_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testevt1 = {
|
const struct testcase testevt1 = {
|
||||||
evt1_gettest,
|
"Events, registration and dispatch",
|
||||||
evt1_setup,
|
evt1_setup,
|
||||||
NULL,
|
NULL,
|
||||||
evt1_execute
|
evt1_execute
|
||||||
|
@ -133,11 +128,6 @@ const struct testcase testevt1 = {
|
||||||
* the expected time and that there are no stuck event flags.
|
* the expected time and that there are no stuck event flags.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *evt2_gettest(void) {
|
|
||||||
|
|
||||||
return "Events, wait and broadcast";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void evt2_setup(void) {
|
static void evt2_setup(void) {
|
||||||
|
|
||||||
chEvtClear(ALL_EVENTS);
|
chEvtClear(ALL_EVENTS);
|
||||||
|
@ -235,7 +225,7 @@ static void evt2_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testevt2 = {
|
const struct testcase testevt2 = {
|
||||||
evt2_gettest,
|
"Events, wait and broadcast",
|
||||||
evt2_setup,
|
evt2_setup,
|
||||||
NULL,
|
NULL,
|
||||||
evt2_execute
|
evt2_execute
|
||||||
|
@ -257,11 +247,6 @@ const struct testcase testevt2 = {
|
||||||
* After each test phase the test verifies that there are no stuck event flags.
|
* After each test phase the test verifies that there are no stuck event flags.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *evt3_gettest(void) {
|
|
||||||
|
|
||||||
return "Events, timeouts";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void evt3_setup(void) {
|
static void evt3_setup(void) {
|
||||||
|
|
||||||
chEvtClear(ALL_EVENTS);
|
chEvtClear(ALL_EVENTS);
|
||||||
|
@ -288,7 +273,7 @@ static void evt3_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testevt3 = {
|
const struct testcase testevt3 = {
|
||||||
evt3_gettest,
|
"Events, timeouts",
|
||||||
evt3_setup,
|
evt3_setup,
|
||||||
NULL,
|
NULL,
|
||||||
evt3_execute
|
evt3_execute
|
||||||
|
|
|
@ -64,11 +64,6 @@ static MemoryHeap test_heap;
|
||||||
* sequence.
|
* sequence.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *heap1_gettest(void) {
|
|
||||||
|
|
||||||
return "Heap, allocation and fragmentation test";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void heap1_setup(void) {
|
static void heap1_setup(void) {
|
||||||
|
|
||||||
chHeapInit(&test_heap, test.buffer, sizeof(union test_buffers));
|
chHeapInit(&test_heap, test.buffer, sizeof(union test_buffers));
|
||||||
|
@ -148,7 +143,7 @@ static void heap1_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testheap1 = {
|
const struct testcase testheap1 = {
|
||||||
heap1_gettest,
|
"Heap, allocation and fragmentation test",
|
||||||
heap1_setup,
|
heap1_setup,
|
||||||
NULL,
|
NULL,
|
||||||
heap1_execute
|
heap1_execute
|
||||||
|
|
|
@ -71,11 +71,6 @@ static MAILBOX_DECL(mb1, test.wa.T0, MB_SIZE);
|
||||||
* The test expects to find a consistent mailbox status after each operation.
|
* The test expects to find a consistent mailbox status after each operation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *mbox1_gettest(void) {
|
|
||||||
|
|
||||||
return "Mailboxes, queuing and timeouts";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void mbox1_setup(void) {
|
static void mbox1_setup(void) {
|
||||||
|
|
||||||
chMBInit(&mb1, (msg_t *)test.wa.T0, MB_SIZE);
|
chMBInit(&mb1, (msg_t *)test.wa.T0, MB_SIZE);
|
||||||
|
@ -161,7 +156,7 @@ static void mbox1_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testmbox1 = {
|
const struct testcase testmbox1 = {
|
||||||
mbox1_gettest,
|
"Mailboxes, queuing and timeouts",
|
||||||
mbox1_setup,
|
mbox1_setup,
|
||||||
NULL,
|
NULL,
|
||||||
mbox1_execute
|
mbox1_execute
|
||||||
|
|
|
@ -59,11 +59,6 @@
|
||||||
* not find a fifth message waiting.
|
* not find a fifth message waiting.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *msg1_gettest(void) {
|
|
||||||
|
|
||||||
return "Messages, loop";
|
|
||||||
}
|
|
||||||
|
|
||||||
static msg_t thread(void *p) {
|
static msg_t thread(void *p) {
|
||||||
|
|
||||||
chMsgSend(p, 'A');
|
chMsgSend(p, 'A');
|
||||||
|
@ -107,7 +102,7 @@ static void msg1_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testmsg1 = {
|
const struct testcase testmsg1 = {
|
||||||
msg1_gettest,
|
"Messages, loop",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
msg1_execute
|
msg1_execute
|
||||||
|
|
|
@ -83,10 +83,6 @@ static CONDVAR_DECL(c1);
|
||||||
* The test expects the threads to perform their operations in increasing
|
* The test expects the threads to perform their operations in increasing
|
||||||
* priority order regardless of the initial order.
|
* priority order regardless of the initial order.
|
||||||
*/
|
*/
|
||||||
static char *mtx1_gettest(void) {
|
|
||||||
|
|
||||||
return "Mutexes, priority enqueuing test";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void mtx1_setup(void) {
|
static void mtx1_setup(void) {
|
||||||
|
|
||||||
|
@ -117,7 +113,7 @@ static void mtx1_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testmtx1 = {
|
const struct testcase testmtx1 = {
|
||||||
mtx1_gettest,
|
"Mutexes, priority enqueuing test",
|
||||||
mtx1_setup,
|
mtx1_setup,
|
||||||
NULL,
|
NULL,
|
||||||
mtx1_execute
|
mtx1_execute
|
||||||
|
@ -155,11 +151,6 @@ const struct testcase testmtx1 = {
|
||||||
* @endcode
|
* @endcode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *mtx2_gettest(void) {
|
|
||||||
|
|
||||||
return "Mutexes, priority inheritance, simple case";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void mtx2_setup(void) {
|
static void mtx2_setup(void) {
|
||||||
|
|
||||||
chMtxInit(&m1);
|
chMtxInit(&m1);
|
||||||
|
@ -213,7 +204,7 @@ static void mtx2_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testmtx2 = {
|
const struct testcase testmtx2 = {
|
||||||
mtx2_gettest,
|
"Mutexes, priority inheritance, simple case",
|
||||||
mtx2_setup,
|
mtx2_setup,
|
||||||
NULL,
|
NULL,
|
||||||
mtx2_execute
|
mtx2_execute
|
||||||
|
@ -249,10 +240,6 @@ const struct testcase testmtx2 = {
|
||||||
* ^ - Priority transition (boost or return).
|
* ^ - Priority transition (boost or return).
|
||||||
* @endcode
|
* @endcode
|
||||||
*/
|
*/
|
||||||
static char *mtx3_gettest(void) {
|
|
||||||
|
|
||||||
return "Mutexes, priority inheritance, complex case";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void mtx3_setup(void) {
|
static void mtx3_setup(void) {
|
||||||
|
|
||||||
|
@ -337,7 +324,7 @@ static void mtx3_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testmtx3 = {
|
const struct testcase testmtx3 = {
|
||||||
mtx3_gettest,
|
"Mutexes, priority inheritance, complex case",
|
||||||
mtx3_setup,
|
mtx3_setup,
|
||||||
NULL,
|
NULL,
|
||||||
mtx3_execute
|
mtx3_execute
|
||||||
|
@ -353,10 +340,6 @@ const struct testcase testmtx3 = {
|
||||||
* The test expects that the priority changes caused by the priority
|
* The test expects that the priority changes caused by the priority
|
||||||
* inheritance algorithm happen at the right moment and with the right values.
|
* inheritance algorithm happen at the right moment and with the right values.
|
||||||
*/
|
*/
|
||||||
static char *mtx4_gettest(void) {
|
|
||||||
|
|
||||||
return "Mutexes, priority return";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void mtx4_setup(void) {
|
static void mtx4_setup(void) {
|
||||||
|
|
||||||
|
@ -429,7 +412,7 @@ static void mtx4_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testmtx4 = {
|
const struct testcase testmtx4 = {
|
||||||
mtx4_gettest,
|
"Mutexes, priority return",
|
||||||
mtx4_setup,
|
mtx4_setup,
|
||||||
NULL,
|
NULL,
|
||||||
mtx4_execute
|
mtx4_execute
|
||||||
|
@ -444,10 +427,6 @@ const struct testcase testmtx4 = {
|
||||||
* The test expects that the internal mutex status is consistent after each
|
* The test expects that the internal mutex status is consistent after each
|
||||||
* operation.
|
* operation.
|
||||||
*/
|
*/
|
||||||
static char *mtx5_gettest(void) {
|
|
||||||
|
|
||||||
return "Mutexes, status";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void mtx5_setup(void) {
|
static void mtx5_setup(void) {
|
||||||
|
|
||||||
|
@ -476,7 +455,7 @@ static void mtx5_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testmtx5 = {
|
const struct testcase testmtx5 = {
|
||||||
mtx5_gettest,
|
"Mutexes, status",
|
||||||
mtx5_setup,
|
mtx5_setup,
|
||||||
NULL,
|
NULL,
|
||||||
mtx5_execute
|
mtx5_execute
|
||||||
|
@ -493,10 +472,6 @@ const struct testcase testmtx5 = {
|
||||||
* The test expects the threads to reach their goal in increasing priority
|
* The test expects the threads to reach their goal in increasing priority
|
||||||
* order regardless of the initial order.
|
* order regardless of the initial order.
|
||||||
*/
|
*/
|
||||||
static char *mtx6_gettest(void) {
|
|
||||||
|
|
||||||
return "CondVar, signal test";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void mtx6_setup(void) {
|
static void mtx6_setup(void) {
|
||||||
|
|
||||||
|
@ -534,7 +509,7 @@ static void mtx6_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testmtx6 = {
|
const struct testcase testmtx6 = {
|
||||||
mtx6_gettest,
|
"CondVar, signal test",
|
||||||
mtx6_setup,
|
mtx6_setup,
|
||||||
NULL,
|
NULL,
|
||||||
mtx6_execute
|
mtx6_execute
|
||||||
|
@ -549,10 +524,6 @@ const struct testcase testmtx6 = {
|
||||||
* The test expects the threads to reach their goal in increasing priority
|
* The test expects the threads to reach their goal in increasing priority
|
||||||
* order regardless of the initial order.
|
* order regardless of the initial order.
|
||||||
*/
|
*/
|
||||||
static char *mtx7_gettest(void) {
|
|
||||||
|
|
||||||
return "CondVar, broadcast test";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void mtx7_setup(void) {
|
static void mtx7_setup(void) {
|
||||||
|
|
||||||
|
@ -575,7 +546,7 @@ static void mtx7_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testmtx7 = {
|
const struct testcase testmtx7 = {
|
||||||
mtx7_gettest,
|
"CondVar, broadcast test",
|
||||||
mtx7_setup,
|
mtx7_setup,
|
||||||
NULL,
|
NULL,
|
||||||
mtx7_execute
|
mtx7_execute
|
||||||
|
@ -589,10 +560,6 @@ const struct testcase testmtx7 = {
|
||||||
* conditional variable queue. It tests this very specific situation in order
|
* conditional variable queue. It tests this very specific situation in order
|
||||||
* to complete the code coverage.
|
* to complete the code coverage.
|
||||||
*/
|
*/
|
||||||
static char *mtx8_gettest(void) {
|
|
||||||
|
|
||||||
return "CondVar, boost test";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void mtx8_setup(void) {
|
static void mtx8_setup(void) {
|
||||||
|
|
||||||
|
@ -637,7 +604,7 @@ static void mtx8_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testmtx8 = {
|
const struct testcase testmtx8 = {
|
||||||
mtx8_gettest,
|
"CondVar, boost test",
|
||||||
mtx8_setup,
|
mtx8_setup,
|
||||||
NULL,
|
NULL,
|
||||||
mtx8_execute
|
mtx8_execute
|
||||||
|
|
|
@ -66,11 +66,6 @@ static void *null_provider(size_t size) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *pools1_gettest(void) {
|
|
||||||
|
|
||||||
return "Memory Pools, queue/dequeue";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void pools1_setup(void) {
|
static void pools1_setup(void) {
|
||||||
|
|
||||||
chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE), NULL);
|
chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE), NULL);
|
||||||
|
@ -96,7 +91,7 @@ static void pools1_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testpools1 = {
|
const struct testcase testpools1 = {
|
||||||
pools1_gettest,
|
"Memory Pools, queue/dequeue",
|
||||||
pools1_setup,
|
pools1_setup,
|
||||||
NULL,
|
NULL,
|
||||||
pools1_execute
|
pools1_execute
|
||||||
|
|
|
@ -76,11 +76,6 @@ static OUTPUTQUEUE_DECL(oq, test.wa.T1, TEST_QUEUES_SIZE, notify);
|
||||||
* consistent through the whole test.
|
* consistent through the whole test.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *queues1_gettest(void) {
|
|
||||||
|
|
||||||
return "Queues, input queues";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void queues1_setup(void) {
|
static void queues1_setup(void) {
|
||||||
|
|
||||||
chIQInit(&iq, wa[0], TEST_QUEUES_SIZE, notify);
|
chIQInit(&iq, wa[0], TEST_QUEUES_SIZE, notify);
|
||||||
|
@ -135,7 +130,7 @@ static void queues1_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testqueues1 = {
|
const struct testcase testqueues1 = {
|
||||||
queues1_gettest,
|
"Queues, input queues",
|
||||||
queues1_setup,
|
queues1_setup,
|
||||||
NULL,
|
NULL,
|
||||||
queues1_execute
|
queues1_execute
|
||||||
|
@ -149,10 +144,6 @@ const struct testcase testqueues1 = {
|
||||||
* @p OutputQueue object including timeouts. The queue state must remain
|
* @p OutputQueue object including timeouts. The queue state must remain
|
||||||
* consistent through the whole test.
|
* consistent through the whole test.
|
||||||
*/
|
*/
|
||||||
static char *queues2_gettest(void) {
|
|
||||||
|
|
||||||
return "Queues, output queues";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void queues2_setup(void) {
|
static void queues2_setup(void) {
|
||||||
|
|
||||||
|
@ -199,7 +190,7 @@ static void queues2_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testqueues2 = {
|
const struct testcase testqueues2 = {
|
||||||
queues2_gettest,
|
"Queues, output queues",
|
||||||
queues2_setup,
|
queues2_setup,
|
||||||
NULL,
|
NULL,
|
||||||
queues2_execute
|
queues2_execute
|
||||||
|
|
|
@ -70,10 +70,6 @@ static SEMAPHORE_DECL(sem1, 0);
|
||||||
* priority order depending on the CH_USE_SEMAPHORES_PRIORITY configuration
|
* priority order depending on the CH_USE_SEMAPHORES_PRIORITY configuration
|
||||||
* setting.
|
* setting.
|
||||||
*/
|
*/
|
||||||
static char *sem1_gettest(void) {
|
|
||||||
|
|
||||||
return "Semaphores, enqueuing";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sem1_setup(void) {
|
static void sem1_setup(void) {
|
||||||
|
|
||||||
|
@ -107,6 +103,13 @@ static void sem1_execute(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const struct testcase testsem1 = {
|
||||||
|
"Semaphores, enqueuing",
|
||||||
|
sem1_setup,
|
||||||
|
NULL,
|
||||||
|
sem1_execute
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @page test_sem_002 Timeout test
|
* @page test_sem_002 Timeout test
|
||||||
*
|
*
|
||||||
|
@ -117,17 +120,6 @@ static void sem1_execute(void) {
|
||||||
* in each of the above scenario and that the semaphore structure status is
|
* in each of the above scenario and that the semaphore structure status is
|
||||||
* correct after each operation.
|
* correct after each operation.
|
||||||
*/
|
*/
|
||||||
const struct testcase testsem1 = {
|
|
||||||
sem1_gettest,
|
|
||||||
sem1_setup,
|
|
||||||
NULL,
|
|
||||||
sem1_execute
|
|
||||||
};
|
|
||||||
|
|
||||||
static char *sem2_gettest(void) {
|
|
||||||
|
|
||||||
return "Semaphores, timeout";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sem2_setup(void) {
|
static void sem2_setup(void) {
|
||||||
|
|
||||||
|
@ -186,7 +178,7 @@ static void sem2_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testsem2 = {
|
const struct testcase testsem2 = {
|
||||||
sem2_gettest,
|
"Semaphores, timeout",
|
||||||
sem2_setup,
|
sem2_setup,
|
||||||
NULL,
|
NULL,
|
||||||
sem2_execute
|
sem2_execute
|
||||||
|
@ -205,11 +197,6 @@ const struct testcase testsem2 = {
|
||||||
* correct after each operation.
|
* correct after each operation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *sem3_gettest(void) {
|
|
||||||
|
|
||||||
return "Semaphores, atomic signal-wait";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sem3_setup(void) {
|
static void sem3_setup(void) {
|
||||||
|
|
||||||
chSemInit(&sem1, 0);
|
chSemInit(&sem1, 0);
|
||||||
|
@ -236,7 +223,7 @@ static void sem3_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testsem3 = {
|
const struct testcase testsem3 = {
|
||||||
sem3_gettest,
|
"Semaphores, atomic signal-wait",
|
||||||
sem3_setup,
|
sem3_setup,
|
||||||
NULL,
|
NULL,
|
||||||
sem3_execute
|
sem3_execute
|
||||||
|
|
|
@ -66,11 +66,6 @@ static msg_t thread(void *p) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *thd1_gettest(void) {
|
|
||||||
|
|
||||||
return "Threads, enqueuing test #1";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void thd1_execute(void) {
|
static void thd1_execute(void) {
|
||||||
|
|
||||||
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread, "E");
|
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread, "E");
|
||||||
|
@ -83,7 +78,7 @@ static void thd1_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testthd1 = {
|
const struct testcase testthd1 = {
|
||||||
thd1_gettest,
|
"Threads, enqueuing test #1",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
thd1_execute
|
thd1_execute
|
||||||
|
@ -99,11 +94,6 @@ const struct testcase testthd1 = {
|
||||||
* priority order regardless of the initial order.
|
* priority order regardless of the initial order.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *thd2_gettest(void) {
|
|
||||||
|
|
||||||
return "Threads, enqueuing test #2";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void thd2_execute(void) {
|
static void thd2_execute(void) {
|
||||||
|
|
||||||
threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread, "D");
|
threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread, "D");
|
||||||
|
@ -116,7 +106,7 @@ static void thd2_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testthd2 = {
|
const struct testcase testthd2 = {
|
||||||
thd2_gettest,
|
"Threads, enqueuing test #2",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
thd2_execute
|
thd2_execute
|
||||||
|
@ -132,11 +122,6 @@ const struct testcase testthd2 = {
|
||||||
* also tested under priority inheritance boosted priority state.
|
* also tested under priority inheritance boosted priority state.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *thd3_gettest(void) {
|
|
||||||
|
|
||||||
return "Threads, priority change";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void thd3_execute(void) {
|
static void thd3_execute(void) {
|
||||||
tprio_t prio, p1;
|
tprio_t prio, p1;
|
||||||
|
|
||||||
|
@ -186,7 +171,7 @@ static void thd3_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testthd3 = {
|
const struct testcase testthd3 = {
|
||||||
thd3_gettest,
|
"Threads, priority change",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
thd3_execute
|
thd3_execute
|
||||||
|
@ -200,11 +185,6 @@ const struct testcase testthd3 = {
|
||||||
* to wake up at the exact expected time.
|
* to wake up at the exact expected time.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *thd4_gettest(void) {
|
|
||||||
|
|
||||||
return "Threads, delays";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void thd4_execute(void) {
|
static void thd4_execute(void) {
|
||||||
systime_t time;
|
systime_t time;
|
||||||
|
|
||||||
|
@ -232,7 +212,7 @@ static void thd4_execute(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testthd4 = {
|
const struct testcase testthd4 = {
|
||||||
thd4_gettest,
|
"Threads, delays",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
thd4_execute
|
thd4_execute
|
||||||
|
|
Loading…
Reference in New Issue