aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-02-10 13:01:54 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-02-10 13:01:54 +0000
commitc082a87062ebb9414ec223e9bf7ea8959a717488 (patch)
tree347323664729cfb5126aa28d77fe799a14e52073
parent1ef57ed011384517ebaf13bd098653caac32d3df (diff)
downloadChibiOS-c082a87062ebb9414ec223e9bf7ea8959a717488.tar.gz
ChibiOS-c082a87062ebb9414ec223e9bf7ea8959a717488.tar.bz2
ChibiOS-c082a87062ebb9414ec223e9bf7ea8959a717488.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6694 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--demos/nil/NIL-STM32F303-DISCOVERY/.project5
-rw-r--r--demos/nil/NIL-STM32F303-DISCOVERY/Makefile2
-rw-r--r--test/lib/templates/test_sequence_XXX.c2
-rw-r--r--test/nil/test.mk6
-rw-r--r--test/nil/test_root.h2
-rw-r--r--test/nil/test_sequence_000.c118
6 files changed, 109 insertions, 26 deletions
diff --git a/demos/nil/NIL-STM32F303-DISCOVERY/.project b/demos/nil/NIL-STM32F303-DISCOVERY/.project
index 637b2d362..08a691543 100644
--- a/demos/nil/NIL-STM32F303-DISCOVERY/.project
+++ b/demos/nil/NIL-STM32F303-DISCOVERY/.project
@@ -86,5 +86,10 @@
<type>2</type>
<locationURI>CHIBIOS/os</locationURI>
</link>
+ <link>
+ <name>test</name>
+ <type>2</type>
+ <locationURI>CHIBIOS/test</locationURI>
+ </link>
</linkedResources>
</projectDescription>
diff --git a/demos/nil/NIL-STM32F303-DISCOVERY/Makefile b/demos/nil/NIL-STM32F303-DISCOVERY/Makefile
index 0a93433bc..5a95ab821 100644
--- a/demos/nil/NIL-STM32F303-DISCOVERY/Makefile
+++ b/demos/nil/NIL-STM32F303-DISCOVERY/Makefile
@@ -82,7 +82,7 @@ include $(CHIBIOS)/os/hal/ports/STM32/STM32F30x/platform.mk
include $(CHIBIOS)/os/hal/osal/nil/osal.mk
include $(CHIBIOS)/os/nil/nil.mk
include $(CHIBIOS)/os/nil/ports/ARMCMx/compilers/GCC/mk/port_stm32f30x.mk
-#include $(CHIBIOS)/test/test.mk
+include $(CHIBIOS)/test/nil/test.mk
# Define linker script file here
LDSCRIPT = $(PORTLD)/STM32F303xC.ld
diff --git a/test/lib/templates/test_sequence_XXX.c b/test/lib/templates/test_sequence_XXX.c
index 3fb1df8e0..2d46efac8 100644
--- a/test/lib/templates/test_sequence_XXX.c
+++ b/test/lib/templates/test_sequence_XXX.c
@@ -80,7 +80,7 @@ static const testcase_t test_XXX_000 = {
test_XXX_000_teardown,
test_XXX_000_execute
};
- #endif /* TEST_XXX_000_CONDITION */
+#endif /* TEST_XXX_000_CONDITION */
/****************************************************************************
* Exported data.
diff --git a/test/nil/test.mk b/test/nil/test.mk
index 6abe29dfe..a69e80e08 100644
--- a/test/nil/test.mk
+++ b/test/nil/test.mk
@@ -1,8 +1,8 @@
# List of all the ChibiOS/RT test files.
TESTSRC = ${CHIBIOS}/test/lib/ch_test.c \
- ${CHIBIOS}/test/rt/test_root.c \
- ${CHIBIOS}/test/rt/test_sequence_000.c
+ ${CHIBIOS}/test/nil/test_root.c \
+ ${CHIBIOS}/test/nil/test_sequence_000.c
# Required include directories
TESTINC = ${CHIBIOS}/test/lib \
- ${CHIBIOS}/test/rt
+ ${CHIBIOS}/test/nil
diff --git a/test/nil/test_root.h b/test/nil/test_root.h
index fb6fea873..42463fc03 100644
--- a/test/nil/test_root.h
+++ b/test/nil/test_root.h
@@ -25,6 +25,8 @@
#ifndef _TEST_ROOT_H_
#define _TEST_ROOT_H_
+#include "nil.h"
+
#include "test_sequence_000.h"
/*===========================================================================*/
diff --git a/test/nil/test_sequence_000.c b/test/nil/test_sequence_000.c
index efe81b6da..7b56a3908 100644
--- a/test/nil/test_sequence_000.c
+++ b/test/nil/test_sequence_000.c
@@ -19,12 +19,12 @@
#include "test_root.h"
/**
- * @page test_sequence_000 Sequence brief description
+ * @page test_sequence_000 Threads Functionality
*
* File: @ref test_sequence_000.c
*
* <h2>Description</h2>
- * Sequence detailed description.
+ * This sequence tests the ChibiOS/Nil functionalities related to threading.
*
* <h2>Test Cases</h2>
* - @subpage test_000_000
@@ -40,47 +40,120 @@
* Test cases.
****************************************************************************/
-#if TEST_000_000_CONDITION || defined(__DOXYGEN__)
+#if TRUE || defined(__DOXYGEN__)
/**
- * @page test_000_000 Brief description
+ * @page test_000_000 System Tick Counter functionality
*
* <h2>Description</h2>
- * Detailed description.
+ * The functionality of the API @p chVTGetSystemTimeX() is tested.
*
* <h2>Conditions</h2>
- * This test is only executed if the following preprocessor condition
- * evaluates to true:
- * - TEST_000_000_CONDITION
- * .
+ * None.
*
* <h2>Test Steps</h2>
- * - Step description.
+ * - A System Tick Counter increment is expected, the test simply hangs if
+ * it does not happen.
* .
*/
-static void test_000_000_setup(void) {
+static void test_000_000_execute(void) {
+ systime_t time;
+ /* A System Tick Counter increment is expected, the test simply hangs if
+ it does not happen.*/
+ test_set_step(1);
+ {
+ time = chVTGetSystemTimeX();
+ while (time == chVTGetSystemTimeX()) {
+ }
+ }
}
-static void test_000_000}_teardown(void) {
+static const testcase_t test_000_000 = {
+ "Brief description",
+ NULL,
+ NULL,
+ test_000_000_execute
+};
+#endif /* TEST_000_000_CONDITION */
-}
+#if TRUE || defined(__DOXYGEN__)
+/**
+ * @page test_000_001 Thread Sleep functionality
+ *
+ * <h2>Description</h2>
+ * The functionality of the API @p chThdSleep() and derivatives is tested.
+ *
+ * <h2>Conditions</h2>
+ * None.
+ *
+ * <h2>Test Steps</h2>
+ * - 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.
+ * .
+ */
-static void test_000_000_execute(void) {
+static void test_000_001_execute(void) {
+ systime_t time;
- /* Step description.*/
+ /* The current system time is read then a sleep is performed for 100 system
+ ticks and on exit the system time is verified again.*/
test_set_step(1);
{
+ time = chVTGetSystemTimeX();
+ chThdSleep(100);
+ test_assert_time_window(time + 100,
+ time + 101,
+ "out of time window");
+ }
+
+ /* The current system time is read then a sleep is performed for 100000
+ microseconds and on exit the system time is verified again.*/
+ test_set_step(2);
+ {
+ time = chVTGetSystemTimeX();
+ chThdSleepMicroseconds(100);
+ test_assert_time_window(time + US2ST(100),
+ time + US2ST(100) + 1,
+ "out of time window");
+ }
+
+ /* The current system time is read then a sleep is performed for 100
+ milliseconds and on exit the system time is verified again.*/
+ test_set_step(3);
+ {
+ time = chVTGetSystemTimeX();
+ chThdSleepMicroseconds(100);
+ test_assert_time_window(time + MS2ST(100),
+ time + MS2ST(100) + 1,
+ "out of time window");
+ }
+
+ /* The current system time is read then a sleep is performed for 1
+ second and on exit the system time is verified again.*/
+ test_set_step(4);
+ {
+ time = chVTGetSystemTimeX();
+ chThdSleepSeconds(1);
+ test_assert_time_window(time + S2ST(1),
+ time + S2ST(1) + 1,
+ "out of time window");
}
}
-static const testcase_t test_000_000 = {
+static const testcase_t test_000_001 = {
"Brief description",
- test_000_000_setup,
- test_000_000_teardown,
- test_000_000_execute
+ NULL,
+ NULL,
+ test_000_001_execute
};
- #endif /* TEST_000_000_CONDITION */
+#endif /* TEST_000_001_CONDITION */
/****************************************************************************
* Exported data.
@@ -90,8 +163,11 @@ static const testcase_t test_000_000 = {
* @brief Sequence brief description.
*/
const testcase_t * const test_sequence_000[] = {
-#if TEST_000_000_CONDITION || defined(__DOXYGEN__)
+#if 1 || defined(__DOXYGEN__)
&test_000_000,
#endif
+#if 1 || defined(__DOXYGEN__)
+ &test_000_001,
+#endif
NULL
};