diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-05-07 15:24:47 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-05-07 15:24:47 +0000 |
commit | aea323e12179301b00e7766fc97dc3d3b51576d9 (patch) | |
tree | 4d6bf9467a957ee7ac26dc33fa69779b76fb8727 /test | |
parent | fcd92814ce79c541fdaf3a6ef1ecfd497d75c7fd (diff) | |
download | ChibiOS-aea323e12179301b00e7766fc97dc3d3b51576d9.tar.gz ChibiOS-aea323e12179301b00e7766fc97dc3d3b51576d9.tar.bz2 ChibiOS-aea323e12179301b00e7766fc97dc3d3b51576d9.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@949 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test')
-rw-r--r-- | test/test.c | 2 | ||||
-rw-r--r-- | test/test.mk | 3 | ||||
-rw-r--r-- | test/testqueues.c | 49 | ||||
-rw-r--r-- | test/testserial.c | 65 | ||||
-rw-r--r-- | test/testserial.h | 25 | ||||
-rw-r--r-- | test/testthd.c | 71 |
6 files changed, 213 insertions, 2 deletions
diff --git a/test/test.c b/test/test.c index 3ca3d8a8a..02e56788a 100644 --- a/test/test.c +++ b/test/test.c @@ -30,6 +30,7 @@ #include "testpools.h"
#include "testdyn.h"
#include "testqueues.h"
+#include "testserial.h"
#include "testbmk.h"
/*
@@ -46,6 +47,7 @@ static const struct testcase **patterns[] = { patternpools,
patterndyn,
patternqueues,
+ patternserial,
patternbmk,
NULL
};
diff --git a/test/test.mk b/test/test.mk index 2a3e1a4f9..f80237f8a 100644 --- a/test/test.mk +++ b/test/test.mk @@ -4,7 +4,8 @@ TESTSRC = ../../test/test.c ../../test/testthd.c \ ../../test/testmsg.c ../../test/testmbox.c \
../../test/testevt.c ../../test/testheap.c \
../../test/testpools.c ../../test/testdyn.c \
- ../../test/testqueues.c ../../test/testbmk.c
+ ../../test/testqueues.c ../../test/testserial.c \
+ ../../test/testbmk.c
# Required include directories
TESTINC = ../../test
diff --git a/test/testqueues.c b/test/testqueues.c index e3faf71f0..2781b3479 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -21,10 +21,51 @@ #include "test.h"
+/**
+ * @page test_queues I/O Queues test
+ *
+ * <h2>Description</h2>
+ * This module implements the test sequence for the @ref IOQueues subsystem.
+ * The tests are performed by inserting and removing data from queues and by
+ * checking both the queues status and the correct sequence of the extracted
+ * data.
+ *
+ * <h2>Objective</h2>
+ * Objective of the test module is to cover 100% of the @ref IOQueues code
+ * as a necessary step in order to assess its readyness.<br>
+ * Note that the @ref IOQueues subsystem depends on the @ref Semaphores
+ * subsystem that has to met its testing objectives as well.
+ *
+ * <h2>Preconditions</h2>
+ * The module requires the following kernel options:
+ * - @p CH_USE_QUEUES (and dependent options)
+ * .
+ * In case of the required options are not enabled some or all tests may be
+ * skipped.
+ *
+ * <h2>Waivers</h2>
+ * None.
+ *
+ * <h2>Test Cases</h2>
+ * - @subpage test_queues_001
+ * - @subpage test_queues_002
+ * .
+ * @file testqueues.c
+ * @file testqueues.h
+ */
+
#if CH_USE_QUEUES
#define TEST_QUEUES_SIZE 4
+/**
+ * @page test_queues_001 Input Queues functionality and APIs
+ *
+ * <h2>Description</h2>
+ * This test case tests sysnchronos and asynchronous operations on an
+ * @p InputQueue object including timeouts. The queue state must remain
+ * consistent through the whole test.
+ */
static void notify(void) {}
static char *queues1_gettest(void) {
@@ -81,6 +122,14 @@ const struct testcase testqueues1 = { queues1_execute
};
+/**
+ * @page test_queues_002 Output Queues functionality and APIs
+ *
+ * <h2>Description</h2>
+ * This test case tests sysnchronos and asynchronous operations on an
+ * @p OutputQueue object including timeouts. The queue state must remain
+ * consistent through the whole test.
+ */
static char *queues2_gettest(void) {
return "Queues, output queues";
diff --git a/test/testserial.c b/test/testserial.c new file mode 100644 index 000000000..a10529493 --- /dev/null +++ b/test/testserial.c @@ -0,0 +1,65 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <ch.h> + +#include "test.h" + +/** + * @page test_serial Serial Driver test + * + * <h2>Description</h2> + * This module implements the test sequence for the @ref Serial subsystem. + * The tests are performed on a loopback software serial driver where a + * dedicated thread echoes back in the input queue the data read from the + * output queue at a fixed rate. + * + * <h2>Objective</h2> + * Objective of the test module is to cover 100% of the @ref Serial code + * as a necessary step in order to assess its readyness.<br> + * Note that the @ref Serial subsystem depends on the @ref Semaphores and + * @ref Events subsystems that have to met their testing objectives as well. + * + * <h2>Preconditions</h2> + * The module requires the following kernel options: + * - @p CH_USE_SERIAL_FULLDUPLEX (and dependent options) + * . + * In case of the required options are not enabled some or all tests may be + * skipped. + * + * <h2>Waivers</h2> + * None. + * + * @file testserial.c + * @file testserial.h + */ + +#if CH_USE_SERIAL_FULLDUPLEX + +#endif /* CH_USE_SERIAL_FULLDUPLEX */ + +/* + * Test sequence for queues pattern. + */ +const struct testcase * const patternserial[] = { +#if CH_USE_SERIAL_FULLDUPLEX + &testserial1, +#endif + NULL +}; diff --git a/test/testserial.h b/test/testserial.h new file mode 100644 index 000000000..3e68dd9c7 --- /dev/null +++ b/test/testserial.h @@ -0,0 +1,25 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _TESTSERIAL_H_ +#define _TESTSERIAL_H_ + +extern const struct testcase *patternserial[]; + +#endif /* _TESTSERIAL_H_ */ diff --git a/test/testthd.c b/test/testthd.c index e4e15be52..e44531868 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -21,6 +21,47 @@ #include "test.h"
+/**
+ * @page test_threads Threads and Scheduler test
+ *
+ * <h2>Description</h2>
+ * This module implements the test sequence for the @ref Scheduler,
+ * @ref Threads and @ref Time subsystems.<br>
+ * Note that the tests on those subsystems are formally required but most of
+ * their functionality is already demostrated because the test suite itself
+ * depends on them, anyway doublecheck is good.
+ *
+ * <h2>Objective</h2>
+ * Objective of the test module is to cover 100% of the subsystems code
+ * as a necessary step in order to assess their readyness.<br>
+ *
+ * <h2>Preconditions</h2>
+ * None.
+ *
+ * <h2>Waivers</h2>
+ * - The @p chThdExit() API is not code 100% covered because it cannot return.
+ * It must work this way by design.
+ * .
+ * <h2>Test Cases</h2>
+ * - @subpage test_threads_001
+ * - @subpage test_threads_002
+ * - @subpage test_threads_003
+ * - @subpage test_threads_004
+ * .
+ * @file testthd.c
+ * @file testthd.h
+ */
+
+/**
+ * @page test_threads_001 Ready List functionality #1
+ *
+ * <h2>Description</h2>
+ * Five threads, with increasing priority, are enqueued in the ready list
+ * and atomically executed.<br>
+ * The test expects the threads to perform their operations in increasing
+ * priority order redardless of the initial order.
+ */
+
static msg_t thread(void *p) {
test_emit_token(*(char *)p);
@@ -50,6 +91,16 @@ const struct testcase testthd1 = { thd1_execute
};
+/**
+ * @page test_threads_002 Ready List functionality #2
+ *
+ * <h2>Description</h2>
+ * Five threads, with pseudo-random priority, are enqueued in the ready list
+ * and atomically executed.<br>
+ * The test expects the threads to perform their operations in increasing
+ * priority order redardless of the initial order.
+ */
+
static char *thd2_gettest(void) {
return "Threads, enqueuing test #2";
@@ -73,6 +124,16 @@ const struct testcase testthd2 = { thd2_execute
};
+/**
+ * @page test_threads_003 Threads priority change test
+ *
+ * <h2>Description</h2>
+ * A series of priority changes are performed on the current thread in order
+ * to verify that the priority change happens as expected.<br>
+ * If the @p CH_USE_MUTEXES option is enabled then the priority changes are
+ * also tested under priority inheritance boosted priority state.
+ */
+
static char *thd3_gettest(void) {
return "Threads, priority change";
@@ -133,6 +194,14 @@ const struct testcase testthd3 = { thd3_execute
};
+/**
+ * @page test_threads_004 Threads delays test
+ *
+ * <h2>Description</h2>
+ * Delay APIs and associated macros are tested, the invoking thread is verified
+ * to wake up at the exact expected time.
+ */
+
static char *thd4_gettest(void) {
return "Threads, delays";
@@ -172,7 +241,7 @@ const struct testcase testthd4 = { };
/*
- * Test sequence for ready list pattern.
+ * Test sequence for threads patterns.
*/
const struct testcase * const patternthd[] = {
&testthd1,
|