summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-09-16 16:53:16 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-09-24 12:02:01 +0200
commit1926cec9b31054e3cafc824e4b46822d8d9d600b (patch)
tree982b16036c804870a802f2debcad16f6ec1b2e88
parentvalidation: Add mapper for unspecified functions (diff)
downloadrtems-central-1926cec9b31054e3cafc824e4b46822d8d9d600b.tar.bz2
spec: Thread pin/unpin with only one CPU
-rw-r--r--spec/score/thread/val/smp-one-cpu.yml92
-rw-r--r--spec/testsuites/validation-smp-one-cpu-0.yml23
2 files changed, 115 insertions, 0 deletions
diff --git a/spec/score/thread/val/smp-one-cpu.yml b/spec/score/thread/val/smp-one-cpu.yml
new file mode 100644
index 00000000..ba7a7076
--- /dev/null
+++ b/spec/score/thread/val/smp-one-cpu.yml
@@ -0,0 +1,92 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: RTEMS_SMP
+links: []
+test-actions:
+- action-brief: |
+ Create one worker thread to validate the thread pinning on only one
+ processor using a uniprocessor scheduler.
+ action-code: |
+ Per_CPU_Control *cpu_self;
+ Thread_Control *executing;
+
+ executing = _Thread_Get_executing();
+ SetSelfPriority( PRIO_NORMAL );
+ ctx->counter = 0;
+
+ ctx->worker_id = CreateTask( "WORK", PRIO_HIGH );
+ StartTask( ctx->worker_id, WorkerTask, ctx );
+ checks:
+ - brief: |
+ Pin the runner thread. Preempt the runner thread. Unpin the runner
+ thread.
+ code: |
+ _Thread_Pin( executing );
+
+ /* We have to preempt the runner to end up in _Thread_Do_unpin() */
+ SendEvents( ctx->worker_id, EVENT_COUNT );
+ T_eq_u32( ctx->counter, 1 );
+
+ cpu_self = _Thread_Dispatch_disable();
+ _Thread_Unpin( executing, cpu_self );
+ _Thread_Dispatch_direct( cpu_self );
+ links:
+ - role: validation
+ uid: ../req/pinning-preemptible
+ - brief: |
+ Clean up all used resources.
+ code: |
+ DeleteTask( ctx->worker_id );
+ RestoreRunnerPriority();
+ links: []
+ links: []
+test-brief: |
+ Tests SMP-specific thread behaviour using only one processor and a
+ uniprocessor scheduler.
+test-context:
+- brief: |
+ This member contains the worker thread identifier.
+ description: null
+ member: |
+ rtems_id worker_id
+- brief: |
+ This member contains a counter for EVENT_COUNT.
+ description: null
+ member: |
+ volatile uint32_t counter
+test-context-support: null
+test-description: null
+test-header: null
+test-includes:
+- rtems/score/threadimpl.h
+test-local-includes:
+- tx-support.h
+test-setup: null
+test-stop: null
+test-support: |
+ typedef ${.:/test-context-type} Context;
+
+ typedef enum {
+ EVENT_COUNT = RTEMS_EVENT_0
+ } Event;
+
+ static void WorkerTask( rtems_task_argument arg )
+ {
+ Context *ctx;
+
+ ctx = (Context *) arg;
+
+ while ( true ) {
+ rtems_event_set events;
+
+ events = ReceiveAnyEvents();
+
+ if ( ( events & EVENT_COUNT ) != 0 ) {
+ ++ctx->counter;
+ }
+ }
+ }
+test-target: testsuites/validation/tc-score-thread-smp-one-cpu.c
+test-teardown: null
+type: test-case
diff --git a/spec/testsuites/validation-smp-one-cpu-0.yml b/spec/testsuites/validation-smp-one-cpu-0.yml
new file mode 100644
index 00000000..8e1c75fc
--- /dev/null
+++ b/spec/testsuites/validation-smp-one-cpu-0.yml
@@ -0,0 +1,23 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: RTEMS_SMP
+links:
+- role: requirement-refinement
+ uid: /req/test-suites
+test-brief: |
+ This general purpose validation test suite provides enough resources to run
+ basic tests for all specified managers and functions in a configuration with
+ exactly one processor and an uniprocessor scheduler.
+test-code: |
+ const char rtems_test_name[] = "${.:/test-suite-name}";
+
+ #define CONFIGURE_MAXIMUM_PROCESSORS 1
+
+ #include "ts-default.h"
+test-description: null
+test-includes: []
+test-local-includes: []
+test-suite-name: ValidationSmpOneCpu0
+test-target: testsuites/validation/ts-validation-smp-one-cpu-0.c
+type: test-suite