git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@773 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
cae6f99028
commit
dd85cc143d
|
@ -80,6 +80,9 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
|
||||||
- FIX: Fixed a small problem in the chcore.c template file.
|
- FIX: Fixed a small problem in the chcore.c template file.
|
||||||
- NEW: Mode flexible debug configuration options, removed the old CH_USE_DEBUG
|
- NEW: Mode flexible debug configuration options, removed the old CH_USE_DEBUG
|
||||||
and CH_USE_TRACE.
|
and CH_USE_TRACE.
|
||||||
|
- Improvements to the test suite, added a new level of indirection that allows
|
||||||
|
to make tests depend on the configuration options without have to put #ifs
|
||||||
|
into the test main module.
|
||||||
|
|
||||||
*** 1.1.0unstable ***
|
*** 1.1.0unstable ***
|
||||||
- FIX: Modified the default value for the STM32 HSI setup it was 1, it should
|
- FIX: Modified the default value for the STM32 HSI setup it was 1, it should
|
||||||
|
|
71
test/test.c
71
test/test.c
|
@ -32,50 +32,19 @@
|
||||||
#include "testbmk.h"
|
#include "testbmk.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Array of all the test cases.
|
* Array of all the test patterns.
|
||||||
*/
|
*/
|
||||||
static const struct testcase *tests[] = {
|
static const struct testcase **patterns[] = {
|
||||||
&testrdy1,
|
patternrdy,
|
||||||
&testrdy2,
|
patternsem,
|
||||||
#if CH_USE_SEMAPHORES
|
patternmtx,
|
||||||
&testsem1,
|
patterncond,
|
||||||
&testsem2,
|
patternmsg,
|
||||||
#endif
|
patternevt,
|
||||||
#if CH_USE_MUTEXES
|
patternheap,
|
||||||
&testmtx1,
|
patternpools,
|
||||||
&testmtx2,
|
patterndyn,
|
||||||
&testmtx3,
|
patternbmk,
|
||||||
#if CH_USE_CONDVARS
|
|
||||||
&testcond1,
|
|
||||||
&testcond2,
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#if CH_USE_MESSAGES
|
|
||||||
&testmsg1,
|
|
||||||
#endif
|
|
||||||
#if CH_USE_EVENTS
|
|
||||||
&testevt1,
|
|
||||||
#endif
|
|
||||||
#if CH_USE_HEAP
|
|
||||||
&testheap1,
|
|
||||||
#endif
|
|
||||||
#if CH_USE_MEMPOOLS
|
|
||||||
&testpools1,
|
|
||||||
#endif
|
|
||||||
#if CH_USE_DYNAMIC && CH_USE_HEAP
|
|
||||||
&testdyn1,
|
|
||||||
#endif
|
|
||||||
#if CH_USE_DYNAMIC && CH_USE_MEMPOOLS
|
|
||||||
&testdyn2,
|
|
||||||
#endif
|
|
||||||
&testbmk1,
|
|
||||||
&testbmk2,
|
|
||||||
&testbmk3,
|
|
||||||
&testbmk4,
|
|
||||||
&testbmk5,
|
|
||||||
&testbmk6,
|
|
||||||
&testbmk7,
|
|
||||||
&testbmk8,
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -248,13 +217,15 @@ static void execute_test(const struct testcase *tcp) {
|
||||||
for (i = 0; i < MAX_THREADS; i++)
|
for (i = 0; i < MAX_THREADS; i++)
|
||||||
threads[i] = NULL;
|
threads[i] = NULL;
|
||||||
|
|
||||||
|
if (tcp->setup != NULL)
|
||||||
tcp->setup();
|
tcp->setup();
|
||||||
tcp->execute();
|
tcp->execute();
|
||||||
|
if (tcp->teardown != NULL)
|
||||||
tcp->teardown();
|
tcp->teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_t TestThread(void *p) {
|
msg_t TestThread(void *p) {
|
||||||
int i;
|
int i, j;
|
||||||
|
|
||||||
comp = p;
|
comp = p;
|
||||||
test_println("");
|
test_println("");
|
||||||
|
@ -265,17 +236,21 @@ msg_t TestThread(void *p) {
|
||||||
|
|
||||||
global_fail = FALSE;
|
global_fail = FALSE;
|
||||||
i = 0;
|
i = 0;
|
||||||
while (tests[i]) {
|
while (patterns[i]) {
|
||||||
#if DELAY_BETWEEN_TESTS > 0
|
#if DELAY_BETWEEN_TESTS > 0
|
||||||
chThdSleepMilliseconds(DELAY_BETWEEN_TESTS);
|
chThdSleepMilliseconds(DELAY_BETWEEN_TESTS);
|
||||||
#endif
|
#endif
|
||||||
|
j = 0;
|
||||||
|
while (patterns[i][j]) {
|
||||||
test_println("---------------------------------------------------------------------------");
|
test_println("---------------------------------------------------------------------------");
|
||||||
test_print("--- Test Case ");
|
test_print("--- Test Case ");
|
||||||
test_printn(i + 1);
|
test_printn(i + 1);
|
||||||
|
test_print(".");
|
||||||
|
test_printn(j + 1);
|
||||||
test_print(" (");
|
test_print(" (");
|
||||||
test_print(tests[i]->gettest());
|
test_print(patterns[i][j]->gettest());
|
||||||
test_println(")");
|
test_println(")");
|
||||||
execute_test(tests[i]);
|
execute_test(patterns[i][j]);
|
||||||
if (local_fail) {
|
if (local_fail) {
|
||||||
test_print("--- Result: FAIL (");
|
test_print("--- Result: FAIL (");
|
||||||
if (failmsg)
|
if (failmsg)
|
||||||
|
@ -288,6 +263,8 @@ msg_t TestThread(void *p) {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
test_println("--- Result: SUCCESS");
|
test_println("--- Result: SUCCESS");
|
||||||
|
j++;
|
||||||
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
test_println("---------------------------------------------------------------------------");
|
test_println("---------------------------------------------------------------------------");
|
||||||
|
|
|
@ -20,9 +20,16 @@
|
||||||
#ifndef _TEST_H_
|
#ifndef _TEST_H_
|
||||||
#define _TEST_H_
|
#define _TEST_H_
|
||||||
|
|
||||||
|
#ifndef DELAY_BETWEEN_TESTS
|
||||||
|
#define DELAY_BETWEEN_TESTS 200
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TEST_NO_BENCHMARKS
|
||||||
|
#define TEST_NO_BENCHMARKS FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAX_THREADS 5
|
#define MAX_THREADS 5
|
||||||
#define MAX_TOKENS 16
|
#define MAX_TOKENS 16
|
||||||
#define DELAY_BETWEEN_TESTS 200
|
|
||||||
|
|
||||||
#if defined(CH_ARCHITECTURE_AVR) || defined(CH_ARCHITECTURE_MSP430)
|
#if defined(CH_ARCHITECTURE_AVR) || defined(CH_ARCHITECTURE_MSP430)
|
||||||
#define THREADS_STACK_SIZE 48
|
#define THREADS_STACK_SIZE 48
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
|
|
||||||
static Semaphore sem1;
|
static Semaphore sem1;
|
||||||
|
|
||||||
static void empty(void) {}
|
|
||||||
|
|
||||||
static msg_t thread1(void *p) {
|
static msg_t thread1(void *p) {
|
||||||
msg_t msg;
|
msg_t msg;
|
||||||
|
|
||||||
|
@ -72,8 +70,8 @@ static void bmk1_execute(void) {
|
||||||
|
|
||||||
const struct testcase testbmk1 = {
|
const struct testcase testbmk1 = {
|
||||||
bmk1_gettest,
|
bmk1_gettest,
|
||||||
empty,
|
NULL,
|
||||||
empty,
|
NULL,
|
||||||
bmk1_execute
|
bmk1_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -98,8 +96,8 @@ static void bmk2_execute(void) {
|
||||||
|
|
||||||
const struct testcase testbmk2 = {
|
const struct testcase testbmk2 = {
|
||||||
bmk2_gettest,
|
bmk2_gettest,
|
||||||
empty,
|
NULL,
|
||||||
empty,
|
NULL,
|
||||||
bmk2_execute
|
bmk2_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -133,8 +131,8 @@ static void bmk3_execute(void) {
|
||||||
|
|
||||||
const struct testcase testbmk3 = {
|
const struct testcase testbmk3 = {
|
||||||
bmk3_gettest,
|
bmk3_gettest,
|
||||||
empty,
|
NULL,
|
||||||
empty,
|
NULL,
|
||||||
bmk3_execute
|
bmk3_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -164,8 +162,8 @@ static void bmk4_execute(void) {
|
||||||
|
|
||||||
const struct testcase testbmk4 = {
|
const struct testcase testbmk4 = {
|
||||||
bmk4_gettest,
|
bmk4_gettest,
|
||||||
empty,
|
NULL,
|
||||||
empty,
|
NULL,
|
||||||
bmk4_execute
|
bmk4_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -195,8 +193,8 @@ static void bmk5_execute(void) {
|
||||||
|
|
||||||
const struct testcase testbmk5 = {
|
const struct testcase testbmk5 = {
|
||||||
bmk5_gettest,
|
bmk5_gettest,
|
||||||
empty,
|
NULL,
|
||||||
empty,
|
NULL,
|
||||||
bmk5_execute
|
bmk5_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -250,7 +248,7 @@ static void bmk6_execute(void) {
|
||||||
const struct testcase testbmk6 = {
|
const struct testcase testbmk6 = {
|
||||||
bmk6_gettest,
|
bmk6_gettest,
|
||||||
bmk6_setup,
|
bmk6_setup,
|
||||||
empty,
|
NULL,
|
||||||
bmk6_execute
|
bmk6_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -288,8 +286,8 @@ static void bmk7_execute(void) {
|
||||||
|
|
||||||
const struct testcase testbmk7 = {
|
const struct testcase testbmk7 = {
|
||||||
bmk7_gettest,
|
bmk7_gettest,
|
||||||
empty,
|
NULL,
|
||||||
empty,
|
NULL,
|
||||||
bmk7_execute
|
bmk7_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -325,7 +323,24 @@ static void bmk8_execute(void) {
|
||||||
|
|
||||||
const struct testcase testbmk8 = {
|
const struct testcase testbmk8 = {
|
||||||
bmk8_gettest,
|
bmk8_gettest,
|
||||||
empty,
|
NULL,
|
||||||
empty,
|
NULL,
|
||||||
bmk8_execute
|
bmk8_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test sequence for benchmarks pattern.
|
||||||
|
*/
|
||||||
|
const struct testcase *patternbmk[] = {
|
||||||
|
#if TEST_NO_BENCHMARKS
|
||||||
|
&testbmk1,
|
||||||
|
&testbmk2,
|
||||||
|
&testbmk3,
|
||||||
|
&testbmk4,
|
||||||
|
&testbmk5,
|
||||||
|
&testbmk6,
|
||||||
|
&testbmk7,
|
||||||
|
&testbmk8,
|
||||||
|
#endif
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
|
@ -20,8 +20,6 @@
|
||||||
#ifndef _TESTBMK_H_
|
#ifndef _TESTBMK_H_
|
||||||
#define _TESTBMK_H_
|
#define _TESTBMK_H_
|
||||||
|
|
||||||
extern const struct testcase testbmk1, testbmk2, testbmk3,
|
extern const struct testcase *patternbmk[];
|
||||||
testbmk4, testbmk5, testbmk6,
|
|
||||||
testbmk7, testbmk8;
|
|
||||||
|
|
||||||
#endif /* _TESTBMK_H_ */
|
#endif /* _TESTBMK_H_ */
|
||||||
|
|
|
@ -37,9 +37,6 @@ static void cond1_setup(void) {
|
||||||
chMtxInit(&m1);
|
chMtxInit(&m1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cond1_teardown(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static msg_t thread1(void *p) {
|
static msg_t thread1(void *p) {
|
||||||
|
|
||||||
chMtxLock(&m1);
|
chMtxLock(&m1);
|
||||||
|
@ -71,7 +68,7 @@ static void cond1_execute(void) {
|
||||||
const struct testcase testcond1 = {
|
const struct testcase testcond1 = {
|
||||||
cond1_gettest,
|
cond1_gettest,
|
||||||
cond1_setup,
|
cond1_setup,
|
||||||
cond1_teardown,
|
NULL,
|
||||||
cond1_execute
|
cond1_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -97,9 +94,20 @@ static void cond2_execute(void) {
|
||||||
|
|
||||||
const struct testcase testcond2 = {
|
const struct testcase testcond2 = {
|
||||||
cond2_gettest,
|
cond2_gettest,
|
||||||
cond1_setup,
|
NULL,
|
||||||
cond1_teardown,
|
NULL,
|
||||||
cond2_execute
|
cond2_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(CH_USE_CONDVARS) && defined(CH_USE_MUTEXES) */
|
#endif /* CH_USE_CONDVARS && CH_USE_MUTEXES */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test sequence for condvars pattern.
|
||||||
|
*/
|
||||||
|
const struct testcase *patterncond[] = {
|
||||||
|
#if CH_USE_CONDVARS && CH_USE_MUTEXES
|
||||||
|
&testcond1,
|
||||||
|
&testcond2,
|
||||||
|
#endif
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#ifndef _TESTCOND_H_
|
#ifndef _TESTCOND_H_
|
||||||
#define _TESTCOND_H_
|
#define _TESTCOND_H_
|
||||||
|
|
||||||
extern const struct testcase testcond1;
|
extern const struct testcase *patterncond[];
|
||||||
extern const struct testcase testcond2;
|
|
||||||
|
|
||||||
#endif /* _TESTCOND_H_ */
|
#endif /* _TESTCOND_H_ */
|
||||||
|
|
|
@ -35,12 +35,6 @@ static char *dyn1_gettest(void) {
|
||||||
return "Dynamic APIs, threads creation from heap";
|
return "Dynamic APIs, threads creation from heap";
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dyn1_setup(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dyn1_teardown(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dyn1_execute(void) {
|
static void dyn1_execute(void) {
|
||||||
size_t n, sz;
|
size_t n, sz;
|
||||||
tprio_t prio = chThdGetPriority();
|
tprio_t prio = chThdGetPriority();
|
||||||
|
@ -72,8 +66,8 @@ static void dyn1_execute(void) {
|
||||||
|
|
||||||
const struct testcase testdyn1 = {
|
const struct testcase testdyn1 = {
|
||||||
dyn1_gettest,
|
dyn1_gettest,
|
||||||
dyn1_setup,
|
NULL,
|
||||||
dyn1_teardown,
|
NULL,
|
||||||
dyn1_execute
|
dyn1_execute
|
||||||
};
|
};
|
||||||
#endif /* CH_USE_HEAP */
|
#endif /* CH_USE_HEAP */
|
||||||
|
@ -91,9 +85,6 @@ static void dyn2_setup(void) {
|
||||||
chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE));
|
chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dyn2_teardown(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dyn2_execute(void) {
|
static void dyn2_execute(void) {
|
||||||
int i;
|
int i;
|
||||||
tprio_t prio = chThdGetPriority();
|
tprio_t prio = chThdGetPriority();
|
||||||
|
@ -129,9 +120,24 @@ static void dyn2_execute(void) {
|
||||||
const struct testcase testdyn2 = {
|
const struct testcase testdyn2 = {
|
||||||
dyn2_gettest,
|
dyn2_gettest,
|
||||||
dyn2_setup,
|
dyn2_setup,
|
||||||
dyn2_teardown,
|
NULL,
|
||||||
dyn2_execute
|
dyn2_execute
|
||||||
};
|
};
|
||||||
#endif /* CH_USE_MEMPOOLS */
|
#endif /* CH_USE_MEMPOOLS */
|
||||||
|
|
||||||
#endif /* CH_USE_DYNAMIC */
|
#endif /* CH_USE_DYNAMIC */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test sequence for dynamic APIs pattern.
|
||||||
|
*/
|
||||||
|
const struct testcase *patterndyn[] = {
|
||||||
|
#if CH_USE_DYNAMIC
|
||||||
|
#if CH_USE_HEAP
|
||||||
|
&testdyn1,
|
||||||
|
#endif
|
||||||
|
#if CH_USE_MEMPOOLS
|
||||||
|
&testdyn2,
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
|
@ -20,6 +20,6 @@
|
||||||
#ifndef _TESTDYN_H_
|
#ifndef _TESTDYN_H_
|
||||||
#define _TESTDYN_H_
|
#define _TESTDYN_H_
|
||||||
|
|
||||||
extern const struct testcase testdyn1, testdyn2;
|
extern const struct testcase *patterndyn[];
|
||||||
|
|
||||||
#endif /* _TESTDYN_H_ */
|
#endif /* _TESTDYN_H_ */
|
||||||
|
|
|
@ -37,9 +37,6 @@ static void evt1_setup(void) {
|
||||||
chEvtClear(ALL_EVENTS);
|
chEvtClear(ALL_EVENTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void evt1_teardown(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static msg_t thread(void *p) {
|
static msg_t thread(void *p) {
|
||||||
|
|
||||||
chEvtBroadcast(&es1);
|
chEvtBroadcast(&es1);
|
||||||
|
@ -97,8 +94,18 @@ static void evt1_execute(void) {
|
||||||
const struct testcase testevt1 = {
|
const struct testcase testevt1 = {
|
||||||
evt1_gettest,
|
evt1_gettest,
|
||||||
evt1_setup,
|
evt1_setup,
|
||||||
evt1_teardown,
|
NULL,
|
||||||
evt1_execute
|
evt1_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CH_USE_EVENTS */
|
#endif /* CH_USE_EVENTS */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test sequence for events pattern.
|
||||||
|
*/
|
||||||
|
const struct testcase *patternevt[] = {
|
||||||
|
#if CH_USE_EVENTS
|
||||||
|
&testevt1,
|
||||||
|
#endif
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
|
@ -20,6 +20,6 @@
|
||||||
#ifndef _TESTEVT_H_
|
#ifndef _TESTEVT_H_
|
||||||
#define _TESTEVT_H_
|
#define _TESTEVT_H_
|
||||||
|
|
||||||
extern const struct testcase testevt1;
|
extern const struct testcase *patternevt[];
|
||||||
|
|
||||||
#endif /* _TESTEVT_H_ */
|
#endif /* _TESTEVT_H_ */
|
||||||
|
|
|
@ -30,12 +30,6 @@ static char *heap1_gettest(void) {
|
||||||
return "Heap, allocation and fragmentation test";
|
return "Heap, allocation and fragmentation test";
|
||||||
}
|
}
|
||||||
|
|
||||||
static void heap1_setup(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static void heap1_teardown(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static void heap1_execute(void) {
|
static void heap1_execute(void) {
|
||||||
void *p1, *p2, *p3;
|
void *p1, *p2, *p3;
|
||||||
size_t n, sz;
|
size_t n, sz;
|
||||||
|
@ -75,9 +69,19 @@ static void heap1_execute(void) {
|
||||||
|
|
||||||
const struct testcase testheap1 = {
|
const struct testcase testheap1 = {
|
||||||
heap1_gettest,
|
heap1_gettest,
|
||||||
heap1_setup,
|
NULL,
|
||||||
heap1_teardown,
|
NULL,
|
||||||
heap1_execute
|
heap1_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CH_USE_HEAP */
|
#endif /* CH_USE_HEAP */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test sequence for heap pattern.
|
||||||
|
*/
|
||||||
|
const struct testcase *patternheap[] = {
|
||||||
|
#if CH_USE_HEAP
|
||||||
|
&testheap1,
|
||||||
|
#endif
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
|
@ -20,6 +20,6 @@
|
||||||
#ifndef _TESTHEAP_H_
|
#ifndef _TESTHEAP_H_
|
||||||
#define _TESTHEAP_H_
|
#define _TESTHEAP_H_
|
||||||
|
|
||||||
extern const struct testcase testheap1;
|
extern const struct testcase *patternheap[];
|
||||||
|
|
||||||
#endif /* _TESTHEAP_H_ */
|
#endif /* _TESTHEAP_H_ */
|
||||||
|
|
|
@ -21,17 +21,13 @@
|
||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
|
#if CH_USE_MESSAGES
|
||||||
|
|
||||||
static char *msg1_gettest(void) {
|
static char *msg1_gettest(void) {
|
||||||
|
|
||||||
return "Messages, dispatch test";
|
return "Messages, dispatch test";
|
||||||
}
|
}
|
||||||
|
|
||||||
static void msg1_setup(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static void msg1_teardown(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static msg_t thread(void *p) {
|
static msg_t thread(void *p) {
|
||||||
msg_t msg;
|
msg_t msg;
|
||||||
int i;
|
int i;
|
||||||
|
@ -59,7 +55,19 @@ static void msg1_execute(void) {
|
||||||
|
|
||||||
const struct testcase testmsg1 = {
|
const struct testcase testmsg1 = {
|
||||||
msg1_gettest,
|
msg1_gettest,
|
||||||
msg1_setup,
|
NULL,
|
||||||
msg1_teardown,
|
NULL,
|
||||||
msg1_execute
|
msg1_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif /* CH_USE_MESSAGES */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test sequence for messages pattern.
|
||||||
|
*/
|
||||||
|
const struct testcase *patternmsg[] = {
|
||||||
|
#if CH_USE_MESSAGES
|
||||||
|
&testmsg1,
|
||||||
|
#endif
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
|
@ -20,6 +20,6 @@
|
||||||
#ifndef _TESTMSG_H_
|
#ifndef _TESTMSG_H_
|
||||||
#define _TESTMSG_H_
|
#define _TESTMSG_H_
|
||||||
|
|
||||||
extern const struct testcase testmsg1;
|
extern const struct testcase *patternmsg[];
|
||||||
|
|
||||||
#endif /* _TESTMSG_H_ */
|
#endif /* _TESTMSG_H_ */
|
||||||
|
|
|
@ -37,9 +37,6 @@ static void mtx1_setup(void) {
|
||||||
chMtxInit(&m1);
|
chMtxInit(&m1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mtx1_teardown(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static msg_t thread1(void *p) {
|
static msg_t thread1(void *p) {
|
||||||
|
|
||||||
chMtxLock(&m1);
|
chMtxLock(&m1);
|
||||||
|
@ -66,7 +63,7 @@ static void mtx1_execute(void) {
|
||||||
const struct testcase testmtx1 = {
|
const struct testcase testmtx1 = {
|
||||||
mtx1_gettest,
|
mtx1_gettest,
|
||||||
mtx1_setup,
|
mtx1_setup,
|
||||||
mtx1_teardown,
|
NULL,
|
||||||
mtx1_execute
|
mtx1_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -80,9 +77,6 @@ static void mtx2_setup(void) {
|
||||||
chMtxInit(&m1);
|
chMtxInit(&m1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mtx2_teardown(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static msg_t thread2(void *p) {
|
static msg_t thread2(void *p) {
|
||||||
|
|
||||||
chThdSleepMilliseconds(10);
|
chThdSleepMilliseconds(10);
|
||||||
|
@ -127,7 +121,7 @@ static void mtx2_execute(void) {
|
||||||
const struct testcase testmtx2 = {
|
const struct testcase testmtx2 = {
|
||||||
mtx2_gettest,
|
mtx2_gettest,
|
||||||
mtx2_setup,
|
mtx2_setup,
|
||||||
mtx2_teardown,
|
NULL,
|
||||||
mtx2_execute
|
mtx2_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -142,9 +136,6 @@ static void mtx3_setup(void) {
|
||||||
chMtxInit(&m2);
|
chMtxInit(&m2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mtx3_teardown(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static msg_t thread5(void *p) {
|
static msg_t thread5(void *p) {
|
||||||
|
|
||||||
chMtxLock(&m1);
|
chMtxLock(&m1);
|
||||||
|
@ -218,8 +209,20 @@ static void mtx3_execute(void) {
|
||||||
const struct testcase testmtx3 = {
|
const struct testcase testmtx3 = {
|
||||||
mtx3_gettest,
|
mtx3_gettest,
|
||||||
mtx3_setup,
|
mtx3_setup,
|
||||||
mtx3_teardown,
|
NULL,
|
||||||
mtx3_execute
|
mtx3_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CH_USE_MUTEXES */
|
#endif /* CH_USE_MUTEXES */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test sequence for mutexes pattern.
|
||||||
|
*/
|
||||||
|
const struct testcase *patternmtx[] = {
|
||||||
|
#if CH_USE_MUTEXES
|
||||||
|
&testmtx1,
|
||||||
|
&testmtx2,
|
||||||
|
&testmtx3,
|
||||||
|
#endif
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
|
@ -20,6 +20,6 @@
|
||||||
#ifndef _TESTMTX_H_
|
#ifndef _TESTMTX_H_
|
||||||
#define _TESTMTX_H_
|
#define _TESTMTX_H_
|
||||||
|
|
||||||
extern const struct testcase testmtx1, testmtx2, testmtx3;
|
extern const struct testcase *patternmtx[];
|
||||||
|
|
||||||
#endif /* _TESTMTX_H_ */
|
#endif /* _TESTMTX_H_ */
|
||||||
|
|
|
@ -35,9 +35,6 @@ static void pools1_setup(void) {
|
||||||
chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE));
|
chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pools1_teardown(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static void pools1_execute(void) {
|
static void pools1_execute(void) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -56,8 +53,18 @@ static void pools1_execute(void) {
|
||||||
const struct testcase testpools1 = {
|
const struct testcase testpools1 = {
|
||||||
pools1_gettest,
|
pools1_gettest,
|
||||||
pools1_setup,
|
pools1_setup,
|
||||||
pools1_teardown,
|
NULL,
|
||||||
pools1_execute
|
pools1_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CH_USE_MEMPOOLS */
|
#endif /* CH_USE_MEMPOOLS */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test sequence for pools pattern.
|
||||||
|
*/
|
||||||
|
const struct testcase *patternpools[] = {
|
||||||
|
#if CH_USE_MEMPOOLS
|
||||||
|
&testpools1,
|
||||||
|
#endif
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
|
@ -20,6 +20,6 @@
|
||||||
#ifndef _TESTPOOLS_H_
|
#ifndef _TESTPOOLS_H_
|
||||||
#define _TESTPOOLS_H_
|
#define _TESTPOOLS_H_
|
||||||
|
|
||||||
extern const struct testcase testpools1;
|
extern const struct testcase *patternpools[];
|
||||||
|
|
||||||
#endif /* _TESTPOOLS_H_ */
|
#endif /* _TESTPOOLS_H_ */
|
||||||
|
|
|
@ -32,12 +32,6 @@ static char *rdy1_gettest(void) {
|
||||||
return "Ready List, priority enqueuing test #1";
|
return "Ready List, priority enqueuing test #1";
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rdy1_setup(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static void rdy1_teardown(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static void rdy1_execute(void) {
|
static void rdy1_execute(void) {
|
||||||
|
|
||||||
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread, "E");
|
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread, "E");
|
||||||
|
@ -51,8 +45,8 @@ static void rdy1_execute(void) {
|
||||||
|
|
||||||
const struct testcase testrdy1 = {
|
const struct testcase testrdy1 = {
|
||||||
rdy1_gettest,
|
rdy1_gettest,
|
||||||
rdy1_setup,
|
NULL,
|
||||||
rdy1_teardown,
|
NULL,
|
||||||
rdy1_execute
|
rdy1_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,12 +55,6 @@ static char *rdy2_gettest(void) {
|
||||||
return "Ready List, priority enqueuing test #2";
|
return "Ready List, priority enqueuing test #2";
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rdy2_setup(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static void rdy2_teardown(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static void rdy2_execute(void) {
|
static void rdy2_execute(void) {
|
||||||
|
|
||||||
threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread, "D");
|
threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread, "D");
|
||||||
|
@ -80,7 +68,16 @@ static void rdy2_execute(void) {
|
||||||
|
|
||||||
const struct testcase testrdy2 = {
|
const struct testcase testrdy2 = {
|
||||||
rdy2_gettest,
|
rdy2_gettest,
|
||||||
rdy2_setup,
|
NULL,
|
||||||
rdy2_teardown,
|
NULL,
|
||||||
rdy2_execute
|
rdy2_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test sequence for ready list pattern.
|
||||||
|
*/
|
||||||
|
const struct testcase *patternrdy[] = {
|
||||||
|
&testrdy1,
|
||||||
|
&testrdy2,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
|
@ -20,6 +20,6 @@
|
||||||
#ifndef _TESTRDY_H_
|
#ifndef _TESTRDY_H_
|
||||||
#define _TESTRDY_H_
|
#define _TESTRDY_H_
|
||||||
|
|
||||||
extern const struct testcase testrdy1, testrdy2;
|
extern const struct testcase *patternrdy[];
|
||||||
|
|
||||||
#endif /* _TESTRDY_H_ */
|
#endif /* _TESTRDY_H_ */
|
||||||
|
|
|
@ -37,9 +37,6 @@ static void sem1_setup(void) {
|
||||||
chSemInit(&sem1, 0);
|
chSemInit(&sem1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sem1_teardown(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static msg_t thread(void *p) {
|
static msg_t thread(void *p) {
|
||||||
|
|
||||||
chSemWait(&sem1);
|
chSemWait(&sem1);
|
||||||
|
@ -66,10 +63,11 @@ static void sem1_execute(void) {
|
||||||
const struct testcase testsem1 = {
|
const struct testcase testsem1 = {
|
||||||
sem1_gettest,
|
sem1_gettest,
|
||||||
sem1_setup,
|
sem1_setup,
|
||||||
sem1_teardown,
|
NULL,
|
||||||
sem1_execute
|
sem1_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if CH_USE_SEMAPHORES_TIMEOUT
|
||||||
static char *sem2_gettest(void) {
|
static char *sem2_gettest(void) {
|
||||||
|
|
||||||
return "Semaphores, timeout test";
|
return "Semaphores, timeout test";
|
||||||
|
@ -80,9 +78,6 @@ static void sem2_setup(void) {
|
||||||
chSemInit(&sem1, 0);
|
chSemInit(&sem1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sem2_teardown(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sem2_execute(void) {
|
static void sem2_execute(void) {
|
||||||
int i;
|
int i;
|
||||||
systime_t target_time;
|
systime_t target_time;
|
||||||
|
@ -101,8 +96,21 @@ static void sem2_execute(void) {
|
||||||
const struct testcase testsem2 = {
|
const struct testcase testsem2 = {
|
||||||
sem2_gettest,
|
sem2_gettest,
|
||||||
sem2_setup,
|
sem2_setup,
|
||||||
sem2_teardown,
|
NULL,
|
||||||
sem2_execute
|
sem2_execute
|
||||||
};
|
};
|
||||||
|
#endif /* CH_USE_SEMAPHORES_TIMEOUT */
|
||||||
#endif /* CH_USE_SEMAPHORES */
|
#endif /* CH_USE_SEMAPHORES */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test sequence for semaphores pattern.
|
||||||
|
*/
|
||||||
|
const struct testcase *patternsem[] = {
|
||||||
|
#if CH_USE_SEMAPHORES
|
||||||
|
&testsem1,
|
||||||
|
#if CH_USE_SEMAPHORES_TIMEOUT
|
||||||
|
&testsem2,
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
|
@ -20,6 +20,6 @@
|
||||||
#ifndef _TESTSEM_H_
|
#ifndef _TESTSEM_H_
|
||||||
#define _TESTSEM_H_
|
#define _TESTSEM_H_
|
||||||
|
|
||||||
extern const struct testcase testsem1, testsem2;
|
extern const struct testcase *patternsem[];
|
||||||
|
|
||||||
#endif /* _TESTSEM_H_ */
|
#endif /* _TESTSEM_H_ */
|
||||||
|
|
6
todo.txt
6
todo.txt
|
@ -5,12 +5,14 @@ After 1.0.0:
|
||||||
* chSysLock() and chSysUnlock() with counter (option).
|
* chSysLock() and chSysUnlock() with counter (option).
|
||||||
* OSEK-style chSysSuspendAll()/chSysResumeAll()/chSysEnable()/chSysDisable(),
|
* OSEK-style chSysSuspendAll()/chSysResumeAll()/chSysEnable()/chSysDisable(),
|
||||||
implemented this as the new Suspended and Disabled states in 1.1.
|
implemented this as the new Suspended and Disabled states in 1.1.
|
||||||
X lwIP TCP/IP stack integration.
|
X lwIP TCP/IP stack integration and demo.
|
||||||
- "Wide Queues" or Mailboxes, lwIP requires them.
|
- "Wide Queues" or Mailboxes, lwIP requires them.
|
||||||
- FatFS library integration and demo.
|
X FatFS library integration and demo.
|
||||||
* Multiple debug switches.
|
* Multiple debug switches.
|
||||||
- Stack guard pages.
|
- Stack guard pages.
|
||||||
- Threads profiling option.
|
- Threads profiling option.
|
||||||
|
- Objects registry.
|
||||||
|
Problem: fixed size? it goes against project policy.
|
||||||
* Idle loop hook macro.
|
* Idle loop hook macro.
|
||||||
* Switch the configuration options to TRUE/FALSE rather than def/undef.
|
* Switch the configuration options to TRUE/FALSE rather than def/undef.
|
||||||
- Threads Pools manager in the library.
|
- Threads Pools manager in the library.
|
||||||
|
|
Loading…
Reference in New Issue