[rtems-central commit] spec: Specify directive options
Sebastian Huber
sebh at rtems.org
Thu Aug 20 14:13:13 UTC 2020
Module: rtems-central
Branch: master
Commit: 16eaef8eafdffdfdf341cd87aab03cf27772c601
Changeset: http://git.rtems.org/rtems-central/commit/?id=16eaef8eafdffdfdf341cd87aab03cf27772c601
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Mon Aug 17 17:30:51 2020 +0200
spec: Specify directive options
---
spec/req/rtems/options/bit-set.yml | 15 +++++
spec/req/rtems/options/default.yml | 14 ++++
spec/req/rtems/options/unique.yml | 14 ++++
spec/req/rtems/options/val/options.yml | 117 +++++++++++++++++++++++++++++++++
4 files changed, 160 insertions(+)
diff --git a/spec/req/rtems/options/bit-set.yml b/spec/req/rtems/options/bit-set.yml
new file mode 100644
index 0000000..21b3c84
--- /dev/null
+++ b/spec/req/rtems/options/bit-set.yml
@@ -0,0 +1,15 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: /if/rtems/options/group
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ Each non-default directive option constant shall be a power of two
+ representable as an integer of type ${/if/rtems/options/option}.
+type: requirement
diff --git a/spec/req/rtems/options/default.yml b/spec/req/rtems/options/default.yml
new file mode 100644
index 0000000..3f268b3
--- /dev/null
+++ b/spec/req/rtems/options/default.yml
@@ -0,0 +1,14 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: /if/rtems/options/group
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ Each default directive option constant shall have a value of zero.
+type: requirement
diff --git a/spec/req/rtems/options/unique.yml b/spec/req/rtems/options/unique.yml
new file mode 100644
index 0000000..7dd37b2
--- /dev/null
+++ b/spec/req/rtems/options/unique.yml
@@ -0,0 +1,14 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: /if/rtems/options/group
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ The non-default directive option constants shall have unique values.
+type: requirement
diff --git a/spec/req/rtems/options/val/options.yml b/spec/req/rtems/options/val/options.yml
new file mode 100644
index 0000000..21b0151
--- /dev/null
+++ b/spec/req/rtems/options/val/options.yml
@@ -0,0 +1,117 @@
+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: |
+ /* No action */
+ checks:
+ - check: |
+ T_step_true( ${step}, IsPowerOfTwo( RTEMS_EVENT_ANY ) );
+ description: |
+ Check that RTEMS_EVENT_ANY is a power of two.
+ links:
+ - role: validation
+ uid: ../bit-set
+ - role: validation
+ uid: /if/rtems/options/event-any
+ - check: |
+ T_step_true( ${step}, IsPowerOfTwo( RTEMS_NO_WAIT ) );
+ description: |
+ Check that RTEMS_NO_WAIT is a power of two.
+ links:
+ - role: validation
+ uid: ../bit-set
+ - role: validation
+ uid: /if/rtems/options/no-wait
+ description: |
+ Validate the non-default option constants.
+ links: []
+- action: |
+ /* No action */
+ checks:
+ - check: |
+ T_step_eq_u32( ${step}, RTEMS_DEFAULT_OPTIONS, 0 );
+ description: |
+ Check that RTEMS_DEFAULT_OPTIONS is equal to zero.
+ links:
+ - role: validation
+ uid: ../default
+ - role: validation
+ uid: /if/rtems/options/default
+ - check: |
+ T_step_eq_u32( ${step}, RTEMS_EVENT_ALL, 0 );
+ description: |
+ Check that RTEMS_EVENT_ALL is equal to zero.
+ links:
+ - role: validation
+ uid: ../default
+ - role: validation
+ uid: /if/rtems/options/default
+ - check: |
+ T_step_eq_u32( ${step}, RTEMS_WAIT, 0 );
+ description: |
+ Check that RTEMS_WAIT is equal to zero.
+ links:
+ - role: validation
+ uid: ../default
+ - role: validation
+ uid: /if/rtems/options/wait
+ description: |
+ Validate the default option constants.
+ links: []
+- action: |
+ options = 0;
+ options |= RTEMS_EVENT_ANY;
+ options |= RTEMS_NO_WAIT;
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, PopCount( options ), 2 );
+ description: |
+ 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.
+ links:
+ - role: validation
+ uid: ../unique
+ - role: validation
+ uid: /if/rtems/options/event-any
+ - role: validation
+ uid: /if/rtems/options/no-wait
+ description: |
+ Calculate the bitwise or of all non-default option constants.
+ links: []
+test-brief: |
+ Tests the option constants of the Classic API.
+test-description: null
+test-epilogue: null
+test-fixture: null
+test-header: null
+test-includes:
+- rtems.h
+test-local-includes: []
+test-prologue: |
+ rtems_option options;
+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
+type: test-case
More information about the vc
mailing list