[rtems-central commit] validation: Add test context support
Sebastian Huber
sebh at rtems.org
Thu Aug 20 14:13:13 UTC 2020
Module: rtems-central
Branch: master
Commit: 82426ed3a2434541026a817b21f655d7af84a698
Changeset: http://git.rtems.org/rtems-central/commit/?id=82426ed3a2434541026a817b21f655d7af84a698
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue Aug 4 09:14:52 2020 +0200
validation: Add test context support
---
rtemsspec/tests/spec-validation/action2.yml | 2 ++
rtemsspec/tests/spec-validation/directive.yml | 1 +
rtemsspec/tests/test_validation.py | 2 ++
rtemsspec/validation.py | 1 +
spec/req/rtems/ident-local.yml | 1 +
spec/req/rtems/ident.yml | 1 +
spec/req/rtems/tasks/ident.yml | 1 +
spec/spec/requirement-action.yml | 7 +++++++
8 files changed, 16 insertions(+)
diff --git a/rtemsspec/tests/spec-validation/action2.yml b/rtemsspec/tests/spec-validation/action2.yml
index 4cb5e6a..dcb8808 100644
--- a/rtemsspec/tests/spec-validation/action2.yml
+++ b/rtemsspec/tests/spec-validation/action2.yml
@@ -94,6 +94,8 @@ test-context:
Context member description.
member: |
int member
+test-context-support: |
+ /* Context support code */
test-description: |
Test description.
test-header:
diff --git a/rtemsspec/tests/spec-validation/directive.yml b/rtemsspec/tests/spec-validation/directive.yml
index 333a47f..59fadab 100644
--- a/rtemsspec/tests/spec-validation/directive.yml
+++ b/rtemsspec/tests/spec-validation/directive.yml
@@ -190,6 +190,7 @@ test-context:
description: null
member: |
rtems_id id_remote_task
+test-context-support: null
test-description: Test rtems_task_ident() description.
test-header: null
test-includes:
diff --git a/rtemsspec/tests/test_validation.py b/rtemsspec/tests/test_validation.py
index a1b3979..88995fb 100644
--- a/rtemsspec/tests/test_validation.py
+++ b/rtemsspec/tests/test_validation.py
@@ -1159,6 +1159,8 @@ void Action2_Run( int *a, int b, int *c );
* @{
*/
+/* Context support code */
+
/**
* @brief Test context for Action 2 test case.
*/
diff --git a/rtemsspec/validation.py b/rtemsspec/validation.py
index c93ed96..6f93b47 100644
--- a/rtemsspec/validation.py
+++ b/rtemsspec/validation.py
@@ -301,6 +301,7 @@ class _TestDirectiveItem(_TestItem):
content.add("};")
def _add_context(self, content: CContent, header: Dict[str, Any]) -> None:
+ content.add(self.substitute_code(self["test-context-support"]))
with content.doxygen_block():
content.add_brief_description(
f"Test context for {self.name} test case.")
diff --git a/spec/req/rtems/ident-local.yml b/spec/req/rtems/ident-local.yml
index a6ef3a8..146842e 100644
--- a/spec/req/rtems/ident-local.yml
+++ b/spec/req/rtems/ident-local.yml
@@ -103,6 +103,7 @@ test-context:
- brief: null
description: null
member: rtems_id id_value
+test-context-support: null
test-description: null
test-header:
code: |
diff --git a/spec/req/rtems/ident.yml b/spec/req/rtems/ident.yml
index 978bd5f..0ee60c8 100644
--- a/spec/req/rtems/ident.yml
+++ b/spec/req/rtems/ident.yml
@@ -163,6 +163,7 @@ test-context:
- brief: null
description: null
member: rtems_id id_remote_object
+test-context-support: null
test-description: null
test-header:
code: |
diff --git a/spec/req/rtems/tasks/ident.yml b/spec/req/rtems/tasks/ident.yml
index c9b4c1f..27b80b6 100644
--- a/spec/req/rtems/tasks/ident.yml
+++ b/spec/req/rtems/tasks/ident.yml
@@ -70,6 +70,7 @@ test-context:
- brief: null
description: null
member: rtems_id id_local_object
+test-context-support: null
test-description: null
test-header: null
test-includes: []
diff --git a/spec/spec/requirement-action.yml b/spec/spec/requirement-action.yml
index 093ef67..184a7b0 100644
--- a/spec/spec/requirement-action.yml
+++ b/spec/spec/requirement-action.yml
@@ -93,6 +93,7 @@ spec-example: |
- brief: null
description: null
member: option_type option
+ test-context-support: null
test-description: null
test-header: null
test-includes: []
@@ -161,6 +162,12 @@ spec-info:
test-context:
description: null
spec-type: requirement-action-test-context-list
+ test-context-support:
+ description: |
+ If the value is present, then it shall be the test context support
+ code. The context support code is placed at file scope before the
+ test context definition.
+ spec-type: optional-str
test-description:
description: |
If the value is present, then it shall be the test case description.
More information about the vc
mailing list