aboutsummaryrefslogtreecommitdiffstats
path: root/test/nasa_osal/source
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2016-03-08 09:30:01 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2016-03-08 09:30:01 +0000
commit1c8b3555ba022ff63be257b69111f2137f08f449 (patch)
treeda22caf2edcf7d2f5d060864302d6ee60a562826 /test/nasa_osal/source
parent742a1d93c841fc87fd91ae4feca78a736e812388 (diff)
downloadChibiOS-1c8b3555ba022ff63be257b69111f2137f08f449.tar.gz
ChibiOS-1c8b3555ba022ff63be257b69111f2137f08f449.tar.bz2
ChibiOS-1c8b3555ba022ff63be257b69111f2137f08f449.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9054 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test/nasa_osal/source')
-rw-r--r--test/nasa_osal/source/test/test_sequence_001.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/test/nasa_osal/source/test/test_sequence_001.c b/test/nasa_osal/source/test/test_sequence_001.c
index 7c7829d8a..f8081cde1 100644
--- a/test/nasa_osal/source/test/test_sequence_001.c
+++ b/test/nasa_osal/source/test/test_sequence_001.c
@@ -61,12 +61,19 @@ static void test_thread4(void) {
test_emit_token('D');
}
+static void delete_handler(void) {
+
+ test_emit_token('C');
+}
+
static void test_thread_delete(void) {
+ test_emit_token('A');
+ (void) OS_TaskInstallDeleteHandler(delete_handler);
while (!OS_TaskDeleteCheck()) {
- OS_TaskDelay(1);
+ (void) OS_TaskDelay(1);
}
- test_emit_token('A');
+ test_emit_token('B');
}
/****************************************************************************
@@ -498,9 +505,41 @@ static const testcase_t test_001_003 = {
* functionality.
*
* <h2>Test Steps</h2>
+ * - Creating a task executing an infinite loop.
+ * - Letting the task run for a while then deleting it. A check is
+ * performed on the correct execution of the delete handler.
+ * .
*/
static void test_001_004_execute(void) {
+ uint32 tid;
+
+ /* Creating a task executing an infinite loop.*/
+ test_set_step(1);
+ {
+ int32 err;
+
+ err = OS_TaskCreate(&tid,
+ "deletable thread",
+ test_thread_delete,
+ (uint32 *)wa_test1,
+ sizeof wa_test1,
+ TASKS_BASE_PRIORITY,
+ 0);
+ test_assert(err == OS_SUCCESS, "deletable task creation failed");
+ }
+
+ /* Letting the task run for a while then deleting it. A check is
+ performed on the correct execution of the delete handler.*/
+ test_set_step(2);
+ {
+ int32 err;
+
+ (void) OS_TaskDelay(50);
+ err = OS_TaskDelete(tid);
+ test_assert(err == OS_SUCCESS, "delete failed");
+ test_assert_sequence("ABC", "events order violation");
+ }
}
static const testcase_t test_001_004 = {