source: rtems-central/spec/rtems/task/req/ident.yml @ 5c4bfd2

Last change on this file since 5c4bfd2 was 5c4bfd2, checked in by Sebastian Huber <sebastian.huber@…>, on 11/16/21 at 10:34:14

spec: Improve acfg specification

Rework BSP provided configuration settings.

  • Property mode set to 100644
File size: 3.9 KB
Line 
1SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
2copyrights:
3- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
4enabled-by: true
5functional-type: action
6links:
7- role: interface-function
8  uid: ../if/ident
9post-conditions:
10- name: Status
11  states:
12  - name: OkAndSelfId
13    test-code: |
14      T_rsc( ctx->status, RTEMS_SUCCESSFUL );
15      T_eq_ptr( ctx->id, &ctx->id_value );
16      T_eq_u32( ctx->id_value, rtems_task_self() );
17    text: |
18      The return status of ${../if/ident:/name} shall be
19      ${../../status/if/successful:/name}.  The value of the object identifier
20      referenced by the ${../if/ident:/params[0]/name} parameter shall be the
21      identifier of the executing thread.
22  - name: Skip
23    test-code: |
24      /* Checks performed by ${../../req/ident:/test-run}() */
25    text: |
26      There is no status to validate.
27  test-epilogue: null
28  test-prologue: null
29pre-conditions:
30- name: Name
31  states:
32  - name: Self
33    test-code: |
34      ctx->id_value = 0xffffffff;
35      ctx->id = &ctx->id_value;
36    text: |
37      While the ${../if/ident:/params[0]/name} parameter is
38      ${../if/self:/name}.
39  - name: NotSelf
40    test-code: |
41      ctx->id = NULL;
42      /* Preparation performed by ${../../req/ident:/test-run}() */
43    text: |
44      While the ${../if/ident:/params[0]/name} is not ${../if/self:/name} or
45      ${../if/ident:/params[2]/name} parameter is ${/c/if/null:/name}, the
46      behaviour of ${../if/ident:/name} shall be specified by
47      ${../../req/ident}.
48  test-epilogue: null
49  test-prologue: null
50rationale: null
51references: []
52requirement-type: functional
53skip-reasons: {}
54test-action: |
55  if ( ctx->id != NULL ) {
56    ctx->status = rtems_task_ident( RTEMS_SELF, 0xdeadbeef, ctx->id );
57  } else {
58    ${../../req/ident:/test-run}(
59      ctx->id_local_object,
60      ClassicTaskIdentAction
61    );
62  }
63test-brief: null
64test-cleanup: null
65test-context:
66- brief: null
67  description: null
68  member: rtems_status_code status
69- brief: null
70  description: null
71  member: rtems_id *id
72- brief: null
73  description: null
74  member: rtems_id id_value
75- brief: null
76  description: null
77  member: rtems_id id_local_object
78test-context-support: null
79test-description: null
80test-header: null
81test-includes: []
82test-local-includes:
83- tr-object-ident.h
84- ts-config.h
85test-prepare: null
86test-setup:
87  brief: null
88  code: |
89    rtems_status_code sc;
90
91    sc = rtems_task_construct(
92      &ClassicTaskIdentConfig,
93      &ctx->id_local_object
94    );
95    T_assert_rsc_success( sc );
96  description: null
97test-stop: null
98test-support: |
99  static rtems_status_code ClassicTaskIdentAction(
100    rtems_name name,
101    uint32_t   node,
102    rtems_id  *id
103  )
104  {
105    return rtems_task_ident( name, node, id );
106  }
107
108  #define TASK_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES
109
110  #define MAX_TLS_SIZE RTEMS_ALIGN_UP( 64, RTEMS_TASK_STORAGE_ALIGNMENT )
111
112  RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT )
113  static char ClassicTaskIdentStorage[
114    RTEMS_TASK_STORAGE_SIZE(
115      MAX_TLS_SIZE + TEST_MINIMUM_STACK_SIZE,
116      TASK_ATTRIBUTES
117    )
118  ];
119
120  static const rtems_task_config ClassicTaskIdentConfig = {
121    .name = ClassicObjectIdentName,
122    .initial_priority = 1,
123    .storage_area = ClassicTaskIdentStorage,
124    .storage_size = sizeof( ClassicTaskIdentStorage ),
125    .maximum_thread_local_storage_size = MAX_TLS_SIZE,
126    .initial_modes = RTEMS_DEFAULT_MODES,
127    .attributes = TASK_ATTRIBUTES
128  };
129test-target: testsuites/validation/tc-task-ident.c
130test-teardown:
131  brief: null
132  code: |
133    if ( ctx->id_local_object != 0 ) {
134      rtems_status_code sc;
135
136      sc = rtems_task_delete( ctx->id_local_object );
137      T_rsc_success( sc );
138    }
139  description: null
140text: ${.:text-template}
141transition-map:
142- enabled-by: true
143  post-conditions:
144    Status: OkAndSelfId
145  pre-conditions:
146    Name:
147    - Self
148- enabled-by: true
149  post-conditions:
150    Status: Skip
151  pre-conditions:
152    Name:
153    - NotSelf
154type: requirement
Note: See TracBrowser for help on using the repository browser.