git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6694 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2014-02-10 13:01:54 +00:00
parent 1ef57ed011
commit c082a87062
6 changed files with 111 additions and 28 deletions

View File

@ -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>

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -25,6 +25,8 @@
#ifndef _TEST_ROOT_H_
#define _TEST_ROOT_H_
#include "nil.h"
#include "test_sequence_000.h"
/*===========================================================================*/

View File

@ -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}_teardown(void) {
}
static void test_000_000_execute(void) {
systime_t time;
/* Step description.*/
/* 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 const testcase_t test_000_000 = {
"Brief description",
test_000_000_setup,
test_000_000_teardown,
NULL,
NULL,
test_000_000_execute
};
#endif /* TEST_000_000_CONDITION */
#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_001_execute(void) {
systime_t time;
/* 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_001 = {
"Brief description",
NULL,
NULL,
test_000_001_execute
};
#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
};