summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-08-13 14:47:54 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-08-19 11:29:34 +0200
commit8e0b1ae72ef023792d9d15729c17117c8b1e1e93 (patch)
tree97b804e905adab0bcb598c0f20ebe0223a06477c
parentvalidation: Remove explicit test names (diff)
downloadrtems-central-8e0b1ae72ef023792d9d15729c17117c8b1e1e93.tar.bz2
validation: Update due to test API changes
-rw-r--r--rtemsspec/tests/test_validation.py12
-rw-r--r--rtemsspec/validation.py14
2 files changed, 14 insertions, 12 deletions
diff --git a/rtemsspec/tests/test_validation.py b/rtemsspec/tests/test_validation.py
index 665df872..ca7668a3 100644
--- a/rtemsspec/tests/test_validation.py
+++ b/rtemsspec/tests/test_validation.py
@@ -492,15 +492,17 @@ static void Directive_Teardown_Wrap( void *arg )
Directive_Teardown( ctx );
}
-static void Directive_Scope( void *arg, char *buf, size_t n )
+static size_t Directive_Scope( void *arg, char *buf, size_t n )
{
Directive_Context *ctx;
ctx = arg;
if ( ctx->in_action_loop ) {
- T_get_scope( Directive_PreDesc, buf, n, ctx->pcs );
+ return T_get_scope( Directive_PreDesc, buf, n, ctx->pcs );
}
+
+ return 0;
}
static T_fixture Directive_Fixture = {
@@ -1348,15 +1350,17 @@ static void Action2_Teardown_Wrap( void *arg )
Action2_Teardown( ctx );
}
-static void Action2_Scope( void *arg, char *buf, size_t n )
+static size_t Action2_Scope( void *arg, char *buf, size_t n )
{
Action2_Context *ctx;
ctx = arg;
if ( ctx->in_action_loop ) {
- T_get_scope( Action2_PreDesc, buf, n, ctx->pcs );
+ return T_get_scope( Action2_PreDesc, buf, n, ctx->pcs );
}
+
+ return 0;
}
static T_fixture Action2_Fixture = {
diff --git a/rtemsspec/validation.py b/rtemsspec/validation.py
index 467a50b5..53139029 100644
--- a/rtemsspec/validation.py
+++ b/rtemsspec/validation.py
@@ -325,17 +325,15 @@ class _TestDirectiveItem(_TestItem):
f" {self.ident}_Instance;"
])
- def _add_scope_body(self, content: CContent) -> None:
- with content.condition("ctx->in_action_loop"):
- content.call_function(
- None, "T_get_scope",
- [f"{self.ident}_PreDesc", "buf", "n", "ctx->pcs"])
-
def _add_fixture_scope(self, content: CContent) -> None:
params = ["void *arg", "char *buf", "size_t n"]
- with content.function("static void", f"{self.ident}_Scope", params):
+ with content.function("static size_t", f"{self.ident}_Scope", params):
content.add([f"{self.context} *ctx;", "", "ctx = arg;"])
- self._add_scope_body(content)
+ with content.condition("ctx->in_action_loop"):
+ content.call_function(
+ "return", "T_get_scope",
+ [f"{self.ident}_PreDesc", "buf", "n", "ctx->pcs"])
+ content.add("return 0;")
def _add_fixture_method(self, content: CContent,
info: Optional[Dict[str, Optional[str]]],