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

Last change on this file since b7282c7 was b7282c7, checked in by Sebastian Huber <sebastian.huber@…>, on 11/18/21 at 08:46:34

spec: Use RTEMS_WHO_AM_I for rtems_task_ident()

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