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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
copyrights:
- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
enabled-by: true
links: []
test-actions:
- action-brief: |
Validate the non-default option constants.
action-code: |
/* No action */
checks:
- brief: |
Check that RTEMS_EVENT_ANY is a power of two.
code: |
T_step_true( ${.:/step}, IsPowerOfTwo( RTEMS_EVENT_ANY ) );
links:
- role: validation
uid: ../req/bit-set
- role: validation
uid: ../if/event-any
- brief: |
Check that RTEMS_NO_WAIT is a power of two.
code: |
T_step_true( ${.:/step}, IsPowerOfTwo( RTEMS_NO_WAIT ) );
links:
- role: validation
uid: ../req/bit-set
- role: validation
uid: ../if/no-wait
links: []
- action-brief: |
Validate the default option constants.
action-code: |
/* No action */
checks:
- brief: |
Check that RTEMS_DEFAULT_OPTIONS is equal to zero.
code: |
T_step_eq_u32( ${.:/step}, RTEMS_DEFAULT_OPTIONS, 0 );
links:
- role: validation
uid: ../req/default
- role: validation
uid: ../if/default
- brief: |
Check that RTEMS_EVENT_ALL is equal to zero.
code: |
T_step_eq_u32( ${.:/step}, RTEMS_EVENT_ALL, 0 );
links:
- role: validation
uid: ../req/default
- role: validation
uid: ../if/event-all
- brief: |
Check that RTEMS_WAIT is equal to zero.
code: |
T_step_eq_u32( ${.:/step}, RTEMS_WAIT, 0 );
links:
- role: validation
uid: ../req/default
- role: validation
uid: ../if/wait
links: []
- action-brief: |
Calculate the bitwise or of all non-default option constants.
action-code: |
rtems_option options;
options = 0;
options |= RTEMS_EVENT_ANY;
options |= RTEMS_NO_WAIT;
checks:
- brief: |
Check that the count of set bits in the calculated value is equal to the
count of non-default option constants. Since each non-default option
constant is a power of two, this proves that each constant has a unique
value.
code: |
T_step_eq_int( ${.:/step}, PopCount( options ), 2 );
links:
- role: validation
uid: ../req/unique
- role: validation
uid: ../if/event-any
- role: validation
uid: ../if/no-wait
links: []
- action-brief: |
Check the value of ${../if/default:/name}.
action-code: |
/* No action */
checks:
- brief: |
Check ${..//if/default:/name} equals ${../if/wait:/name}.
code: |
T_step_eq_int( ${.:/step}, ${../if/default:/name}, ${../if/wait:/name} );
links:
- role: validation
uid: ../req/default-equals
links: []
test-brief: |
Tests the option constants of the Classic API.
test-context: []
test-context-support: null
test-description: null
test-header: null
test-includes:
- rtems.h
test-local-includes: []
test-setup: null
test-stop: null
test-support: |
static bool IsPowerOfTwo( rtems_option option )
{
return option != 0 && ( option & ( option - 1 ) ) == 0;
}
static int PopCount( rtems_option options )
{
int count;
count = 0;
while ( options != 0 ) {
++count;
options &= options - 1;
}
return count;
}
test-target: testsuites/validation/tc-options.c
test-teardown: null
type: test-case
|