summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2023-07-22 11:46:08 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2023-07-25 07:37:06 +0200
commitc7afbe1112548f492e284da7b913000802fd34b3 (patch)
treec4a237bed715f2bdf967ea83e38c1c8bcf97ce11 /spec
parentb3a911efa72d6de5ef9acbdc8760039d673f2b77 (diff)
spec: Clarify thread exitted extension
Diffstat (limited to 'spec')
-rw-r--r--spec/rtems/userext/req/thread-exitted.yml15
-rw-r--r--spec/rtems/userext/val/userext.yml67
-rw-r--r--spec/testsuites/userext.yml2
3 files changed, 83 insertions, 1 deletions
diff --git a/spec/rtems/userext/req/thread-exitted.yml b/spec/rtems/userext/req/thread-exitted.yml
new file mode 100644
index 00000000..1cb5bb93
--- /dev/null
+++ b/spec/rtems/userext/req/thread-exitted.yml
@@ -0,0 +1,15 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2023 embedded brains GmbH & Co. KG
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/group
+functional-type: function
+rationale: null
+references: []
+requirement-type: functional
+text: |
+ When a ${/glossary/task-entry:/term} returns, the thread exitted
+ ${/glossary/userextensions:/term} shall be invoked.
+type: requirement
diff --git a/spec/rtems/userext/val/userext.yml b/spec/rtems/userext/val/userext.yml
index 6dd9d194..4a872912 100644
--- a/spec/rtems/userext/val/userext.yml
+++ b/spec/rtems/userext/val/userext.yml
@@ -181,6 +181,8 @@ test-actions:
CheckForward( THREAD_EXITTED, 1, 1, thread, NULL );
links:
- role: validation
+ uid: ../req/thread-exitted
+ - role: validation
uid: ../req/thread-exitted-iterate-remove
- role: validation
uid: ../req/thread-exitted-order
@@ -334,6 +336,51 @@ test-actions:
- role: validation
uid: ../req/thread-terminate-iterate-remove
links: []
+- action-brief: |
+ Create five dynamic extensions. Let an idle thread return from its entry.
+ Delete three dynamic extension during the thread exitted invocation. Clean
+ up the used resources.
+ action-code: |
+ rtems_tcb *thread;
+ rtems_id id;
+
+ /* ID of idle thread of processor 0 */
+ id = 0x09010001;
+ thread = GetThread( id );
+ SendEvents( id, RTEMS_EVENT_0 );
+ SetPriority( id, PRIO_HIGH );
+ checks:
+ - brief: |
+ Check that the thread exitted extensions were invoked in the right order.
+ code: |
+ CheckForward( THREAD_EXITTED, 1, 1, thread, NULL );
+ links:
+ - role: validation
+ uid: ../req/thread-exitted
+ - role: validation
+ uid: ../req/thread-exitted-iterate-remove
+ - role: validation
+ uid: ../req/thread-exitted-order
+ - brief: |
+ Check that the other extensions were not invoked.
+ code: |
+ CheckForward( THREAD_BEGIN, 0, 0, NULL, NULL );
+ CheckForward( THREAD_CREATE, 0, 0, NULL, NULL );
+ CheckReverse( THREAD_DELETE, 0, 0, NULL, NULL );
+ CheckForward( THREAD_RESTART, 0, 0, NULL, NULL );
+ CheckForward( THREAD_START, 0, 0, NULL, NULL );
+ CheckForward( THREAD_SWITCH, 0, 0, NULL, NULL );
+ CheckReverse( THREAD_TERMINATE, 0, 0, NULL, NULL );
+ links: []
+ - brief: |
+ Check that the thread exitted extension of the extension set deleted
+ before its turn in the invocation was not invoked.
+ code: |
+ CheckDeletedNotInvoked( THREAD_EXITTED );
+ links:
+ - role: validation
+ uid: ../req/thread-exitted-iterate-remove
+ links: []
test-brief: |
Tests the thread user extensions.
test-context: []
@@ -485,7 +532,13 @@ test-support: |
if ( index == 6 && ( kind == THREAD_EXITTED || kind == THREAD_RESTART ) ) {
StopTestCase();
- rtems_task_exit();
+
+ if ( GetExecuting()->is_idle ) {
+ SetSelfPriority( RTEMS_MAXIMUM_PRIORITY );
+ _CPU_Thread_Idle_body( 0 );
+ } else {
+ rtems_task_exit();
+ }
}
if ( index == 0 && kind == THREAD_TERMINATE ) {
@@ -707,6 +760,18 @@ test-support: |
(void) StartTestCase( THREAD_TERMINATE );
rtems_task_exit();
}
+
+ void *IdleBody( uintptr_t arg )
+ {
+ rtems_event_set events;
+
+ do {
+ events = PollAnyEvents();
+ } while ( events == 0 );
+
+ (void) StartTestCase( THREAD_EXITTED );
+ return (void *) arg;
+ }
test-target: testsuites/validation/tc-userext.c
test-teardown:
brief: null
diff --git a/spec/testsuites/userext.yml b/spec/testsuites/userext.yml
index b449486d..6b8e706c 100644
--- a/spec/testsuites/userext.yml
+++ b/spec/testsuites/userext.yml
@@ -34,6 +34,8 @@ test-code: |
.thread_terminate = ThreadTerminateExtension1 \
}
+ #define CONFIGURE_IDLE_TASK_BODY IdleBody
+
#include "ts-default.h"
test-description: null
test-includes: []