git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@977 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
dd6e2f3911
commit
b20088a8cb
13
test/test.c
13
test/test.c
|
@ -57,15 +57,26 @@ static unsigned failpoint;
|
||||||
static char tokens_buffer[MAX_TOKENS];
|
static char tokens_buffer[MAX_TOKENS];
|
||||||
static char *tokp;
|
static char *tokp;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Static working areas, the following areas can be used for threads or
|
||||||
|
* used as temporary buffers.
|
||||||
|
*/
|
||||||
WORKING_AREA(waT0, THREADS_STACK_SIZE);
|
WORKING_AREA(waT0, THREADS_STACK_SIZE);
|
||||||
WORKING_AREA(waT1, THREADS_STACK_SIZE);
|
WORKING_AREA(waT1, THREADS_STACK_SIZE);
|
||||||
WORKING_AREA(waT2, THREADS_STACK_SIZE);
|
WORKING_AREA(waT2, THREADS_STACK_SIZE);
|
||||||
WORKING_AREA(waT3, THREADS_STACK_SIZE);
|
WORKING_AREA(waT3, THREADS_STACK_SIZE);
|
||||||
WORKING_AREA(waT4, THREADS_STACK_SIZE);
|
WORKING_AREA(waT4, THREADS_STACK_SIZE);
|
||||||
|
|
||||||
void *wa[MAX_THREADS] = {waT0, waT1, waT2, waT3, waT4};
|
/*
|
||||||
|
* Pointers to the spawned threads.
|
||||||
|
*/
|
||||||
Thread *threads[MAX_THREADS];
|
Thread *threads[MAX_THREADS];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pointers to the working areas.
|
||||||
|
*/
|
||||||
|
void * const wa[5] = {waT0, waT1, waT2, waT3, waT4};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Console output.
|
* Console output.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -94,12 +94,12 @@ extern "C" {
|
||||||
}
|
}
|
||||||
|
|
||||||
extern Thread *threads[MAX_THREADS];
|
extern Thread *threads[MAX_THREADS];
|
||||||
extern void *wa[MAX_THREADS];
|
|
||||||
extern WORKING_AREA(waT0, THREADS_STACK_SIZE);
|
extern WORKING_AREA(waT0, THREADS_STACK_SIZE);
|
||||||
extern WORKING_AREA(waT1, THREADS_STACK_SIZE);
|
extern WORKING_AREA(waT1, THREADS_STACK_SIZE);
|
||||||
extern WORKING_AREA(waT2, THREADS_STACK_SIZE);
|
extern WORKING_AREA(waT2, THREADS_STACK_SIZE);
|
||||||
extern WORKING_AREA(waT3, THREADS_STACK_SIZE);
|
extern WORKING_AREA(waT3, THREADS_STACK_SIZE);
|
||||||
extern WORKING_AREA(waT4, THREADS_STACK_SIZE);
|
extern WORKING_AREA(waT4, THREADS_STACK_SIZE);
|
||||||
|
extern void * const wa[];
|
||||||
extern bool_t test_timer_done;
|
extern bool_t test_timer_done;
|
||||||
|
|
||||||
#endif /* _TEST_H_ */
|
#endif /* _TEST_H_ */
|
||||||
|
|
|
@ -196,7 +196,7 @@ static void serial2_execute(void) {
|
||||||
dflags_t flags;
|
dflags_t flags;
|
||||||
|
|
||||||
/* Asynchronous test using the direct APIs.*/
|
/* Asynchronous test using the direct APIs.*/
|
||||||
n = chFDDWrite(&fdd, "ABCDEFGH", TEST_QUEUES_SIZE);
|
n = chFDDWrite(&fdd, (uint8_t *)"ABCDEFGH", TEST_QUEUES_SIZE);
|
||||||
test_assert(1, n == TEST_QUEUES_SIZE, "unexpected write condition");
|
test_assert(1, n == TEST_QUEUES_SIZE, "unexpected write condition");
|
||||||
n = chFDDRead(&fdd, wa[1], TEST_QUEUES_SIZE);
|
n = chFDDRead(&fdd, wa[1], TEST_QUEUES_SIZE);
|
||||||
test_assert(2, n == TEST_QUEUES_SIZE, "unexpected read condition");
|
test_assert(2, n == TEST_QUEUES_SIZE, "unexpected read condition");
|
||||||
|
@ -206,7 +206,7 @@ static void serial2_execute(void) {
|
||||||
test_assert(4, flags == 0, "unexpected error condition");
|
test_assert(4, flags == 0, "unexpected error condition");
|
||||||
|
|
||||||
/* Input overflow testing.*/
|
/* Input overflow testing.*/
|
||||||
n = chFDDWrite(&fdd, "ABCDEFGH", TEST_QUEUES_SIZE);
|
n = chFDDWrite(&fdd, (uint8_t *)"ABCDEFGH", TEST_QUEUES_SIZE);
|
||||||
test_assert(5, n == TEST_QUEUES_SIZE, "unexpected write condition");
|
test_assert(5, n == TEST_QUEUES_SIZE, "unexpected write condition");
|
||||||
/* The following operation will fail to loopback because the input queue
|
/* The following operation will fail to loopback because the input queue
|
||||||
* is full.*/
|
* is full.*/
|
||||||
|
@ -217,7 +217,7 @@ static void serial2_execute(void) {
|
||||||
test_assert(7, n == TEST_QUEUES_SIZE, "unexpected read condition");
|
test_assert(7, n == TEST_QUEUES_SIZE, "unexpected read condition");
|
||||||
|
|
||||||
/* Asynchronous test using the channel APIs.*/
|
/* Asynchronous test using the channel APIs.*/
|
||||||
n = chIOWrite(&fdd, "ABCDEFGH", TEST_QUEUES_SIZE);
|
n = chIOWrite(&fdd, (uint8_t *)"ABCDEFGH", TEST_QUEUES_SIZE);
|
||||||
test_assert(8, n == TEST_QUEUES_SIZE, "unexpected write condition");
|
test_assert(8, n == TEST_QUEUES_SIZE, "unexpected write condition");
|
||||||
n = chIORead(&fdd, wa[1], TEST_QUEUES_SIZE);
|
n = chIORead(&fdd, wa[1], TEST_QUEUES_SIZE);
|
||||||
test_assert(9, n == TEST_QUEUES_SIZE, "unexpected read condition");
|
test_assert(9, n == TEST_QUEUES_SIZE, "unexpected read condition");
|
||||||
|
|
2
todo.txt
2
todo.txt
|
@ -9,7 +9,7 @@ After 1.2.0:
|
||||||
? Move the serial drivers implementations in library. Better keep the core
|
? Move the serial drivers implementations in library. Better keep the core
|
||||||
as compact as possible.
|
as compact as possible.
|
||||||
* Add tests documentation to the general documentation via doxygen.
|
* Add tests documentation to the general documentation via doxygen.
|
||||||
* Static object initializers.
|
X Static object initializers.
|
||||||
- Remove any instance of unnamed structures/unions.
|
- Remove any instance of unnamed structures/unions.
|
||||||
- Objects registry in the kernel.
|
- Objects registry in the kernel.
|
||||||
- OSEK-style simple tasks within the idle thread.
|
- OSEK-style simple tasks within the idle thread.
|
||||||
|
|
Loading…
Reference in New Issue