summaryrefslogtreecommitdiffstats
path: root/spec/score/tq/req/enqueue-fifo.yml
blob: ba100681ad247a83a085cc110be91d58eb6dd331 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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: true
functional-type: action
links: []
post-conditions:
- name: Position
  states:
  - name: First
    test-code: |
      T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_A ) );
      T_eq_ptr( GetUnblock( ctx, &i ), NULL );
    text: |
      The thread shall be the first thread in the queue.
  - name: Last
    test-code: |
      T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_B ) );
      T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_A ) );
      T_eq_ptr( GetUnblock( ctx, &i ), NULL );
    text: |
      The thread shall be the last thread in the queue.
  test-epilogue: null
  test-prologue: |
    size_t i;

    i = 0;
pre-conditions:
- name: Empty
  states:
  - name: 'Yes'
    test-code: |
      /* This is the default */
    text: |
      While the queue is empty.
  - name: 'No'
    test-code: |
      TQSend( ctx->tq_ctx, TQ_BLOCKER_B, TQ_EVENT_ENQUEUE );
    text: |
      While the queue is non-empty.
  test-epilogue: null
  test-prologue: null
rationale: null
references: []
requirement-type: functional
skip-reasons: {}
test-action: |
  TQPrepare( ctx->tq_ctx );
  TQSchedulerRecordStart( ctx->tq_ctx );
  TQSend( ctx->tq_ctx, TQ_BLOCKER_A, TQ_EVENT_ENQUEUE );
  TQDequeueAll( ctx->tq_ctx );
  TQSchedulerRecordStop( ctx->tq_ctx );
  TQCleanup( ctx->tq_ctx );
test-brief: null
test-cleanup: null
test-context: []
test-context-support: null
test-description: null
test-header:
  code: null
  includes: []
  local-includes:
  - tx-thread-queue.h
  run-params:
  - description: |
      is the thread queue context.
    dir: inout
    name: tq_ctx
    specifier: TQContext *${.:name}
  target: testsuites/validation/tr-tq-enqueue-fifo.h
test-includes: []
test-local-includes:
- tr-tq-enqueue-fifo.h
test-prepare: null
test-setup: null
test-stop: null
test-support: |
  typedef ScoreTqReqEnqueueFifo_Context Context;

  static const T_scheduler_event *GetUnblock( Context *ctx, size_t *index )
  {
    return TQGetNextUnblock( ctx->tq_ctx, index );
  }

  static const rtems_tcb *GetTCB( Context *ctx, TQWorkerKind worker )
  {
    return ctx->tq_ctx->worker_tcb[ TQ_BLOCKER_A ];
  }
test-target: testsuites/validation/tr-tq-enqueue-fifo.c
test-teardown: null
text: ${.:text-template}
transition-map:
- enabled-by: true
  post-conditions:
    Position: First
  pre-conditions:
    Empty:
    - 'Yes'
- enabled-by: true
  post-conditions:
    Position: Last
  pre-conditions:
    Empty:
    - 'No'
type: requirement