summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorabutterfield-ext <Andrew.Butterfield@scss.tcd.ie>2021-11-05 16:40:10 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-11-12 11:28:30 +0100
commit5fb769bcd37c323481e518afd707d20decf2de84 (patch)
tree211a760b4bbe7ebae3de268efb8c947299e31277
parentcbccf8145b7df42bb32b09cca0fa68140dc6489c (diff)
adds model-based tests for QR2 QDP
-rw-r--r--spec/build/testsuites/validation/model-0.yml31
-rw-r--r--testsuites/validation/tc-model-events-mgr.c110
-rw-r--r--testsuites/validation/tr-model-chains-api-0.c76
-rw-r--r--testsuites/validation/tr-model-chains-api-1.c72
-rw-r--r--testsuites/validation/tr-model-chains-api-10.c167
-rw-r--r--testsuites/validation/tr-model-chains-api-11.c167
-rw-r--r--testsuites/validation/tr-model-chains-api-12.c169
-rw-r--r--testsuites/validation/tr-model-chains-api-13.c167
-rw-r--r--testsuites/validation/tr-model-chains-api-14.c169
-rw-r--r--testsuites/validation/tr-model-chains-api-15.c167
-rw-r--r--testsuites/validation/tr-model-chains-api-16.c167
-rw-r--r--testsuites/validation/tr-model-chains-api-17.c167
-rw-r--r--testsuites/validation/tr-model-chains-api-18.c169
-rw-r--r--testsuites/validation/tr-model-chains-api-19.c167
-rw-r--r--testsuites/validation/tr-model-chains-api-2.c165
-rw-r--r--testsuites/validation/tr-model-chains-api-20.c169
-rw-r--r--testsuites/validation/tr-model-chains-api-3.c167
-rw-r--r--testsuites/validation/tr-model-chains-api-4.c167
-rw-r--r--testsuites/validation/tr-model-chains-api-5.c169
-rw-r--r--testsuites/validation/tr-model-chains-api-6.c167
-rw-r--r--testsuites/validation/tr-model-chains-api-7.c169
-rw-r--r--testsuites/validation/tr-model-chains-api-8.c167
-rw-r--r--testsuites/validation/tr-model-chains-api-9.c165
-rw-r--r--testsuites/validation/tr-model-chains-api.c2
-rw-r--r--testsuites/validation/tr-model-chains-api.h2
-rw-r--r--testsuites/validation/tr-model-events-mgr-0.c66
-rw-r--r--testsuites/validation/tr-model-events-mgr-1.c70
-rw-r--r--testsuites/validation/tr-model-events-mgr-2.c82
-rw-r--r--testsuites/validation/tr-model-events-mgr-3.c79
-rw-r--r--testsuites/validation/tr-model-events-mgr-4.c88
-rw-r--r--testsuites/validation/tr-model-events-mgr-5.c361
-rw-r--r--testsuites/validation/tr-model-events-mgr-6.c383
-rw-r--r--testsuites/validation/tr-model-events-mgr-7.c388
-rw-r--r--testsuites/validation/tr-model-events-mgr-8.c375
-rw-r--r--testsuites/validation/tr-model-events-mgr.c14
-rw-r--r--testsuites/validation/tr-model-events-mgr.h45
36 files changed, 5210 insertions, 215 deletions
diff --git a/spec/build/testsuites/validation/model-0.yml b/spec/build/testsuites/validation/model-0.yml
index eb603a8854..8ffff78215 100644
--- a/spec/build/testsuites/validation/model-0.yml
+++ b/spec/build/testsuites/validation/model-0.yml
@@ -12,16 +12,39 @@ ldflags: []
links: []
source:
- testsuites/validation/ts-model-0.c
+- testsuites/validation/tr-model-chains-api-0.c
+- testsuites/validation/tr-model-chains-api-1.c
+- testsuites/validation/tr-model-chains-api-10.c
+- testsuites/validation/tr-model-chains-api-11.c
+- testsuites/validation/tr-model-chains-api-12.c
+- testsuites/validation/tr-model-chains-api-13.c
+- testsuites/validation/tr-model-chains-api-14.c
+- testsuites/validation/tr-model-chains-api-15.c
+- testsuites/validation/tr-model-chains-api-16.c
+- testsuites/validation/tr-model-chains-api-17.c
+- testsuites/validation/tr-model-chains-api-18.c
+- testsuites/validation/tr-model-chains-api-19.c
+- testsuites/validation/tr-model-chains-api-2.c
+- testsuites/validation/tr-model-chains-api-20.c
+- testsuites/validation/tr-model-chains-api-3.c
+- testsuites/validation/tr-model-chains-api-4.c
+- testsuites/validation/tr-model-chains-api-5.c
+- testsuites/validation/tr-model-chains-api-6.c
+- testsuites/validation/tr-model-chains-api-7.c
+- testsuites/validation/tr-model-chains-api-8.c
+- testsuites/validation/tr-model-chains-api-9.c
+- testsuites/validation/tr-model-chains-api.c
- testsuites/validation/tc-model-events-mgr.c
-- testsuites/validation/tr-model-events-mgr.c
- testsuites/validation/tr-model-events-mgr-0.c
- testsuites/validation/tr-model-events-mgr-1.c
- testsuites/validation/tr-model-events-mgr-2.c
- testsuites/validation/tr-model-events-mgr-3.c
- testsuites/validation/tr-model-events-mgr-4.c
-- testsuites/validation/tr-model-chains-api.c
-- testsuites/validation/tr-model-chains-api-0.c
-- testsuites/validation/tr-model-chains-api-1.c
+- testsuites/validation/tr-model-events-mgr-5.c
+- testsuites/validation/tr-model-events-mgr-6.c
+- testsuites/validation/tr-model-events-mgr-7.c
+- testsuites/validation/tr-model-events-mgr-8.c
+- testsuites/validation/tr-model-events-mgr.c
stlib: []
target: testsuites/validation/ts-model-0.exe
type: build
diff --git a/testsuites/validation/tc-model-events-mgr.c b/testsuites/validation/tc-model-events-mgr.c
index 2c4a0f8421..d05953e970 100644
--- a/testsuites/validation/tc-model-events-mgr.c
+++ b/testsuites/validation/tc-model-events-mgr.c
@@ -148,6 +148,61 @@ T_TEST_CASE( RtemsModelEventsMgr3 )
);
}
+T_TEST_CASE( RtemsModelEventsMgr4 )
+{
+ RtemsModelEventsMgr_Run4(
+ EventSend,
+ EventReceive,
+ GetPendingEvents,
+ THREAD_WAIT_CLASS_EVENT,
+ STATES_WAITING_FOR_EVENT
+ );
+}
+
+T_TEST_CASE( RtemsModelEventsMgr5 )
+{
+ RtemsModelEventsMgr_Run5(
+ EventSend,
+ EventReceive,
+ GetPendingEvents,
+ THREAD_WAIT_CLASS_EVENT,
+ STATES_WAITING_FOR_EVENT
+ );
+}
+
+T_TEST_CASE( RtemsModelEventsMgr6 )
+{
+ RtemsModelEventsMgr_Run6(
+ EventSend,
+ EventReceive,
+ GetPendingEvents,
+ THREAD_WAIT_CLASS_EVENT,
+ STATES_WAITING_FOR_EVENT
+ );
+}
+
+T_TEST_CASE( RtemsModelEventsMgr7 )
+{
+ RtemsModelEventsMgr_Run7(
+ EventSend,
+ EventReceive,
+ GetPendingEvents,
+ THREAD_WAIT_CLASS_EVENT,
+ STATES_WAITING_FOR_EVENT
+ );
+}
+
+T_TEST_CASE( RtemsModelEventsMgr8 )
+{
+ RtemsModelEventsMgr_Run8(
+ EventSend,
+ EventReceive,
+ GetPendingEvents,
+ THREAD_WAIT_CLASS_EVENT,
+ STATES_WAITING_FOR_EVENT
+ );
+}
+
/** @} */
/**
@@ -245,4 +300,59 @@ T_TEST_CASE( RtemsModelSystemEventsMgr3 )
);
}
+T_TEST_CASE( RtemsModelSystemEventsMgr4 )
+{
+ RtemsModelEventsMgr_Run4(
+ EventSystemSend,
+ EventSystemReceive,
+ GetPendingSystemEvents,
+ THREAD_WAIT_CLASS_SYSTEM_EVENT,
+ STATES_WAITING_FOR_SYSTEM_EVENT
+ );
+}
+
+T_TEST_CASE( RtemsModelSystemEventsMgr5 )
+{
+ RtemsModelEventsMgr_Run5(
+ EventSystemSend,
+ EventSystemReceive,
+ GetPendingSystemEvents,
+ THREAD_WAIT_CLASS_SYSTEM_EVENT,
+ STATES_WAITING_FOR_SYSTEM_EVENT
+ );
+}
+
+T_TEST_CASE( RtemsModelSystemEventsMgr6 )
+{
+ RtemsModelEventsMgr_Run6(
+ EventSystemSend,
+ EventSystemReceive,
+ GetPendingSystemEvents,
+ THREAD_WAIT_CLASS_SYSTEM_EVENT,
+ STATES_WAITING_FOR_SYSTEM_EVENT
+ );
+}
+
+T_TEST_CASE( RtemsModelSystemEventsMgr7 )
+{
+ RtemsModelEventsMgr_Run7(
+ EventSystemSend,
+ EventSystemReceive,
+ GetPendingSystemEvents,
+ THREAD_WAIT_CLASS_SYSTEM_EVENT,
+ STATES_WAITING_FOR_SYSTEM_EVENT
+ );
+}
+
+T_TEST_CASE( RtemsModelSystemEventsMgr8 )
+{
+ RtemsModelEventsMgr_Run8(
+ EventSystemSend,
+ EventSystemReceive,
+ GetPendingSystemEvents,
+ THREAD_WAIT_CLASS_SYSTEM_EVENT,
+ STATES_WAITING_FOR_SYSTEM_EVENT
+ );
+}
+
/** @} */
diff --git a/testsuites/validation/tr-model-chains-api-0.c b/testsuites/validation/tr-model-chains-api-0.c
index 0b6c50806f..e4e7fccb78 100644
--- a/testsuites/validation/tr-model-chains-api-0.c
+++ b/testsuites/validation/tr-model-chains-api-0.c
@@ -1,7 +1,7 @@
/******************************************************************************
* FV2-201
*
- * Copyright (c) 2020 Trinity College Dublin, Ireland
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
*
* All rights reserved.
*
@@ -40,7 +40,7 @@
#include <rtems/chain.h>
#include "tr-model-chains-api.h"
-/* =============================================== */
+// ===============================================
// @@@ 0 NAME Chain_AutoGen
// @@@ 0 DEF MAX_SIZE 8
@@ -52,7 +52,7 @@ static item * nptr = NULL;
// @@@ 0 DECL Control chain
static rtems_chain_control chain;
-/* ===== TEST CODE SEGMENT 0 =====*/
+// ===== TEST CODE SEGMENT 0 =====
static void TestSegment0( Context* ctx ) {
const char rtems_test_name[] = "Model_Chain_API";
@@ -66,49 +66,49 @@ static void TestSegment0( Context* ctx ) {
T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
T_eq_ptr( nptr, NULL );
- T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
- memory[3].val = 22;
- rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
T_log(T_NORMAL,"@@@ 0 SEQ chain");
- T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
T_log(T_NORMAL,"@@@ 0 END chain");
show_chain( &chain, ctx->buffer );
- T_eq_str( ctx->buffer, " 22 0" );
+ T_eq_str( ctx->buffer, " 23 0" );
- T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
- memory[6].val = 21;
- rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
T_log(T_NORMAL,"@@@ 0 SEQ chain");
- T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
- T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
T_log(T_NORMAL,"@@@ 0 END chain");
show_chain( &chain, ctx->buffer );
- T_eq_str( ctx->buffer, " 22 21 0" );
+ T_eq_str( ctx->buffer, " 0" );
- T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
- memory[4].val = 23;
- rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
T_log(T_NORMAL,"@@@ 0 SEQ chain");
T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
- T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
- T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
T_log(T_NORMAL,"@@@ 0 END chain");
show_chain( &chain, ctx->buffer );
- T_eq_str( ctx->buffer, " 22 21 23 0" );
+ T_eq_str( ctx->buffer, " 22 0" );
T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
nptr = get_item( &chain );
T_eq_ptr( nptr, &memory[3] );
T_log(T_NORMAL,"@@@ 0 SEQ chain");
- T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
- T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
T_log(T_NORMAL,"@@@ 0 END chain");
show_chain( &chain, ctx->buffer );
- T_eq_str( ctx->buffer, " 21 23 0" );
+ T_eq_str( ctx->buffer, " 0" );
T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
T_eq_ptr( nptr, &memory[3] );
@@ -116,40 +116,34 @@ static void TestSegment0( Context* ctx ) {
T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
T_eq_int( nptr->val, 22 );
T_log(T_NORMAL,"@@@ 0 END nptr");
- T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
- nptr = get_item( &chain );
- T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
T_log(T_NORMAL,"@@@ 0 SEQ chain");
- T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
T_log(T_NORMAL,"@@@ 0 END chain");
show_chain( &chain, ctx->buffer );
- T_eq_str( ctx->buffer, " 23 0" );
+ T_eq_str( ctx->buffer, " 21 0" );
- T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
- T_eq_ptr( nptr, &memory[6] );
- T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
- T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
- T_eq_int( nptr->val, 21 );
- T_log(T_NORMAL,"@@@ 0 END nptr");
- T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
nptr = get_item( &chain );
- T_eq_ptr( nptr, &memory[4] );
+ T_eq_ptr( nptr, &memory[6] );
T_log(T_NORMAL,"@@@ 0 SEQ chain");
T_log(T_NORMAL,"@@@ 0 END chain");
show_chain( &chain, ctx->buffer );
T_eq_str( ctx->buffer, " 0" );
- T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
- T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
- T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
- T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
T_log(T_NORMAL,"@@@ 0 END nptr");
}
-/* =============================================== */
+// ===============================================
/* post-amble empty for now */
diff --git a/testsuites/validation/tr-model-chains-api-1.c b/testsuites/validation/tr-model-chains-api-1.c
index 45b910bcf6..ec5141c096 100644
--- a/testsuites/validation/tr-model-chains-api-1.c
+++ b/testsuites/validation/tr-model-chains-api-1.c
@@ -1,7 +1,7 @@
/******************************************************************************
* FV2-201
*
- * Copyright (c) 2020 Trinity College Dublin, Ireland
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
*
* All rights reserved.
*
@@ -40,7 +40,7 @@
#include <rtems/chain.h>
#include "tr-model-chains-api.h"
-/* =============================================== */
+// ===============================================
// @@@ 0 NAME Chain_AutoGen
// @@@ 0 DEF MAX_SIZE 8
@@ -52,7 +52,7 @@ static item * nptr = NULL;
// @@@ 0 DECL Control chain
static rtems_chain_control chain;
-/* ===== TEST CODE SEGMENT 0 =====*/
+// ===== TEST CODE SEGMENT 0 =====
static void TestSegment0( Context* ctx ) {
const char rtems_test_name[] = "Model_Chain_API";
@@ -66,30 +66,34 @@ static void TestSegment0( Context* ctx ) {
T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
T_eq_ptr( nptr, NULL );
- T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
- memory[6].val = 21;
- rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
T_log(T_NORMAL,"@@@ 0 SEQ chain");
- T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
T_log(T_NORMAL,"@@@ 0 END chain");
show_chain( &chain, ctx->buffer );
- T_eq_str( ctx->buffer, " 21 0" );
+ T_eq_str( ctx->buffer, " 23 0" );
- T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
- memory[3].val = 22;
- rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
T_log(T_NORMAL,"@@@ 0 SEQ chain");
- T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
- T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
T_log(T_NORMAL,"@@@ 0 END chain");
show_chain( &chain, ctx->buffer );
- T_eq_str( ctx->buffer, " 21 22 0" );
+ T_eq_str( ctx->buffer, " 0" );
- T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
- nptr = get_item( &chain );
- T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
T_log(T_NORMAL,"@@@ 0 SEQ chain");
T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
@@ -97,32 +101,26 @@ static void TestSegment0( Context* ctx ) {
show_chain( &chain, ctx->buffer );
T_eq_str( ctx->buffer, " 22 0" );
- T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
- T_eq_ptr( nptr, &memory[6] );
- T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
- T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
- T_eq_int( nptr->val, 21 );
- T_log(T_NORMAL,"@@@ 0 END nptr");
- T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
- memory[4].val = 23;
- rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
T_log(T_NORMAL,"@@@ 0 SEQ chain");
T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
- T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
T_log(T_NORMAL,"@@@ 0 END chain");
show_chain( &chain, ctx->buffer );
- T_eq_str( ctx->buffer, " 22 23 0" );
+ T_eq_str( ctx->buffer, " 22 21 0" );
T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
nptr = get_item( &chain );
T_eq_ptr( nptr, &memory[3] );
T_log(T_NORMAL,"@@@ 0 SEQ chain");
- T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
T_log(T_NORMAL,"@@@ 0 END chain");
show_chain( &chain, ctx->buffer );
- T_eq_str( ctx->buffer, " 23 0" );
+ T_eq_str( ctx->buffer, " 21 0" );
T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
T_eq_ptr( nptr, &memory[3] );
@@ -130,24 +128,24 @@ static void TestSegment0( Context* ctx ) {
T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
T_eq_int( nptr->val, 22 );
T_log(T_NORMAL,"@@@ 0 END nptr");
- T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
nptr = get_item( &chain );
- T_eq_ptr( nptr, &memory[4] );
+ T_eq_ptr( nptr, &memory[6] );
T_log(T_NORMAL,"@@@ 0 SEQ chain");
T_log(T_NORMAL,"@@@ 0 END chain");
show_chain( &chain, ctx->buffer );
T_eq_str( ctx->buffer, " 0" );
- T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
- T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
- T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
- T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
T_log(T_NORMAL,"@@@ 0 END nptr");
}
-/* =============================================== */
+// ===============================================
/* post-amble empty for now */
diff --git a/testsuites/validation/tr-model-chains-api-10.c b/testsuites/validation/tr-model-chains-api-10.c
new file mode 100644
index 0000000000..214dc90d91
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-10.c
@@ -0,0 +1,167 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run10(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI10 )
+{
+ RtemsModelChainsAPI_Run10( );
+}
diff --git a/testsuites/validation/tr-model-chains-api-11.c b/testsuites/validation/tr-model-chains-api-11.c
new file mode 100644
index 0000000000..6010770a73
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-11.c
@@ -0,0 +1,167 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run11(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI11 )
+{
+ RtemsModelChainsAPI_Run11( );
+}
diff --git a/testsuites/validation/tr-model-chains-api-12.c b/testsuites/validation/tr-model-chains-api-12.c
new file mode 100644
index 0000000000..f2feb2a71a
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-12.c
@@ -0,0 +1,169 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run12(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI12 )
+{
+ RtemsModelChainsAPI_Run12( );
+}
diff --git a/testsuites/validation/tr-model-chains-api-13.c b/testsuites/validation/tr-model-chains-api-13.c
new file mode 100644
index 0000000000..1be41250ed
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-13.c
@@ -0,0 +1,167 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run13(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI13 )
+{
+ RtemsModelChainsAPI_Run13( );
+}
diff --git a/testsuites/validation/tr-model-chains-api-14.c b/testsuites/validation/tr-model-chains-api-14.c
new file mode 100644
index 0000000000..171f3c4b92
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-14.c
@@ -0,0 +1,169 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run14(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI14 )
+{
+ RtemsModelChainsAPI_Run14( );
+}
diff --git a/testsuites/validation/tr-model-chains-api-15.c b/testsuites/validation/tr-model-chains-api-15.c
new file mode 100644
index 0000000000..7720f5c21a
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-15.c
@@ -0,0 +1,167 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run15(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI15 )
+{
+ RtemsModelChainsAPI_Run15( );
+}
diff --git a/testsuites/validation/tr-model-chains-api-16.c b/testsuites/validation/tr-model-chains-api-16.c
new file mode 100644
index 0000000000..0282772c5c
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-16.c
@@ -0,0 +1,167 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run16(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI16 )
+{
+ RtemsModelChainsAPI_Run16( );
+}
diff --git a/testsuites/validation/tr-model-chains-api-17.c b/testsuites/validation/tr-model-chains-api-17.c
new file mode 100644
index 0000000000..e462e9a6c1
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-17.c
@@ -0,0 +1,167 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run17(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI17 )
+{
+ RtemsModelChainsAPI_Run17( );
+}
diff --git a/testsuites/validation/tr-model-chains-api-18.c b/testsuites/validation/tr-model-chains-api-18.c
new file mode 100644
index 0000000000..3c99bd78fb
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-18.c
@@ -0,0 +1,169 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run18(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI18 )
+{
+ RtemsModelChainsAPI_Run18( );
+}
diff --git a/testsuites/validation/tr-model-chains-api-19.c b/testsuites/validation/tr-model-chains-api-19.c
new file mode 100644
index 0000000000..be5fbf2e09
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-19.c
@@ -0,0 +1,167 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run19(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI19 )
+{
+ RtemsModelChainsAPI_Run19( );
+}
diff --git a/testsuites/validation/tr-model-chains-api-2.c b/testsuites/validation/tr-model-chains-api-2.c
new file mode 100644
index 0000000000..879ddfa85f
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-2.c
@@ -0,0 +1,165 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run2(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI2 )
+{
+ RtemsModelChainsAPI_Run2( );
+}
diff --git a/testsuites/validation/tr-model-chains-api-20.c b/testsuites/validation/tr-model-chains-api-20.c
new file mode 100644
index 0000000000..ae398d397f
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-20.c
@@ -0,0 +1,169 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run20(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI20 )
+{
+ RtemsModelChainsAPI_Run20( );
+}
diff --git a/testsuites/validation/tr-model-chains-api-3.c b/testsuites/validation/tr-model-chains-api-3.c
new file mode 100644
index 0000000000..5e0db8dc36
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-3.c
@@ -0,0 +1,167 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run3(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI3 )
+{
+ RtemsModelChainsAPI_Run3( );
+}
diff --git a/testsuites/validation/tr-model-chains-api-4.c b/testsuites/validation/tr-model-chains-api-4.c
new file mode 100644
index 0000000000..8a51535425
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-4.c
@@ -0,0 +1,167 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run4(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI4 )
+{
+ RtemsModelChainsAPI_Run4( );
+}
diff --git a/testsuites/validation/tr-model-chains-api-5.c b/testsuites/validation/tr-model-chains-api-5.c
new file mode 100644
index 0000000000..97f8d91d37
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-5.c
@@ -0,0 +1,169 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run5(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI5 )
+{
+ RtemsModelChainsAPI_Run5( );
+}
diff --git a/testsuites/validation/tr-model-chains-api-6.c b/testsuites/validation/tr-model-chains-api-6.c
new file mode 100644
index 0000000000..691cc0414d
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-6.c
@@ -0,0 +1,167 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run6(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI6 )
+{
+ RtemsModelChainsAPI_Run6( );
+}
diff --git a/testsuites/validation/tr-model-chains-api-7.c b/testsuites/validation/tr-model-chains-api-7.c
new file mode 100644
index 0000000000..c23d2cdab0
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-7.c
@@ -0,0 +1,169 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run7(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI7 )
+{
+ RtemsModelChainsAPI_Run7( );
+}
diff --git a/testsuites/validation/tr-model-chains-api-8.c b/testsuites/validation/tr-model-chains-api-8.c
new file mode 100644
index 0000000000..9505b1f4c4
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-8.c
@@ -0,0 +1,167 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run8(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI8 )
+{
+ RtemsModelChainsAPI_Run8( );
+}
diff --git a/testsuites/validation/tr-model-chains-api-9.c b/testsuites/validation/tr-model-chains-api-9.c
new file mode 100644
index 0000000000..75cbc2b6e4
--- /dev/null
+++ b/testsuites/validation/tr-model-chains-api-9.c
@@ -0,0 +1,165 @@
+/******************************************************************************
+ * FV2-201
+ *
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+
+
+#include <rtems.h>
+#include <rtems/test.h>
+#include <rtems/chain.h>
+#include "tr-model-chains-api.h"
+
+// ===============================================
+
+// @@@ 0 NAME Chain_AutoGen
+// @@@ 0 DEF MAX_SIZE 8
+#define MAX_SIZE 8
+// @@@ 0 DCLARRAY Node memory MAX_SIZE
+static item memory[MAX_SIZE];
+// @@@ 0 DECL unsigned nptr NULL
+static item * nptr = NULL;
+// @@@ 0 DECL Control chain
+static rtems_chain_control chain;
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ const char rtems_test_name[] = "Model_Chain_API";
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ rtems_chain_initialize_empty( &chain );
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 0");
+ T_eq_ptr( nptr, NULL );
+ T_log(T_NORMAL,"@@@ 0 CALL append 22 3");
+ memory[3].val = 22;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 22");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 22 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 3");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[3] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 3");
+ T_eq_ptr( nptr, &memory[3] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 22");
+ T_eq_int( nptr->val, 22 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 21 6");
+ memory[6].val = 21;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 21");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 21 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 6");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[6] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 6");
+ T_eq_ptr( nptr, &memory[6] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 21");
+ T_eq_int( nptr->val, 21 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+ T_log(T_NORMAL,"@@@ 0 CALL append 23 4");
+ memory[4].val = 23;
+ rtems_chain_append_unprotected( &chain, (rtems_chain_node*)&memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 SCALAR _ 23");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 23 0" );
+
+ T_log(T_NORMAL,"@@@ 0 CALL getNonNull 4");
+ nptr = get_item( &chain );
+ T_eq_ptr( nptr, &memory[4] );
+
+ T_log(T_NORMAL,"@@@ 0 SEQ chain");
+ T_log(T_NORMAL,"@@@ 0 END chain");
+ show_chain( &chain, ctx->buffer );
+ T_eq_str( ctx->buffer, " 0" );
+
+ T_log(T_NORMAL,"@@@ 0 PTR nptr 4");
+ T_eq_ptr( nptr, &memory[4] );
+ T_log(T_NORMAL,"@@@ 0 STRUCT nptr");
+ T_log(T_NORMAL,"@@@ 0 SCALAR itm 23");
+ T_eq_int( nptr->val, 23 );
+ T_log(T_NORMAL,"@@@ 0 END nptr");
+}
+
+// ===============================================
+
+
+/* post-amble empty for now */
+void RtemsModelChainsAPI_Run9(
+)
+{
+ Context ctx;
+
+ memset( &ctx, 0, sizeof( ctx ) );
+
+ T_set_verbosity( T_NORMAL );
+
+ TestSegment0( &ctx );
+}
+
+T_TEST_CASE( RtemsModelChainAPI9 )
+{
+ RtemsModelChainsAPI_Run9( );
+}
diff --git a/testsuites/validation/tr-model-chains-api.c b/testsuites/validation/tr-model-chains-api.c
index 09686ca21b..3083fdea36 100644
--- a/testsuites/validation/tr-model-chains-api.c
+++ b/testsuites/validation/tr-model-chains-api.c
@@ -1,7 +1,7 @@
/******************************************************************************
* FV2-201
*
- * Copyright (c) 2020 Trinity College Dublin, Ireland
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
*
* All rights reserved.
*
diff --git a/testsuites/validation/tr-model-chains-api.h b/testsuites/validation/tr-model-chains-api.h
index cb7f95f7a9..bcf81e8963 100644
--- a/testsuites/validation/tr-model-chains-api.h
+++ b/testsuites/validation/tr-model-chains-api.h
@@ -1,7 +1,7 @@
/******************************************************************************
* FV2-201
*
- * Copyright (c) 2020 Trinity College Dublin, Ireland
+ * Copyright (C) 2019-2021 Trinity College Dublin (www.tcd.ie)
*
* All rights reserved.
*
diff --git a/testsuites/validation/tr-model-events-mgr-0.c b/testsuites/validation/tr-model-events-mgr-0.c
index 43548a8381..db6c4bcfa2 100644
--- a/testsuites/validation/tr-model-events-mgr-0.c
+++ b/testsuites/validation/tr-model-events-mgr-0.c
@@ -69,10 +69,10 @@
#define EVT_3 8
// @@@ 0 DEF NO_TIMEOUT 0
#define NO_TIMEOUT 0
-// @@@ 0 DEF TASK_MAX 2
-#define TASK_MAX 2
-// @@@ 0 DEF BAD_ID 2
-#define BAD_ID 2
+// @@@ 0 DEF TASK_MAX 3
+#define TASK_MAX 3
+// @@@ 0 DEF BAD_ID 3
+#define BAD_ID 3
// @@@ 0 DEF SEMA_MAX 2
#define SEMA_MAX 2
// @@@ 0 DEF RC_OK RTEMS_SUCCESSFUL
@@ -85,14 +85,14 @@
#define RC_Unsat RTEMS_UNSATISFIED
// @@@ 0 DEF RC_Timeout RTEMS_TIMEOUT
#define RC_Timeout RTEMS_TIMEOUT
-// @@@ 0 DCLARRAY EvtSet pending TASK_MAX
-static rtems_event_set pending[TASK_MAX];
// @@@ 0 DECL byte sendrc 0
static rtems_status_code sendrc = 0;
// @@@ 0 DECL byte recrc 0
static rtems_status_code recrc = 0;
-// @@@ 0 DECL byte recout 0
-static rtems_event_set recout = 0;
+// @@@ 0 DCLARRAY EvtSet pending TASK_MAX
+static rtems_event_set pending[TASK_MAX];
+// @@@ 0 DCLARRAY byte recout TASK_MAX
+static rtems_event_set recout[TASK_MAX];
// @@@ 0 DCLARRAY Semaphore semaphore SEMA_MAX
static rtems_id semaphore[SEMA_MAX];
@@ -112,21 +112,42 @@ static void TestSegment0( Context* ctx ) {
static void TestSegment3( Context* ctx ) {
T_log(T_NORMAL,"@@@ 3 TASK Worker");
checkTaskIs( ctx->worker_id );
+
+ T_log(T_NORMAL,"@@@ 3 CALL EqualPriority");
+ SetSelfPriority( PRIO_NORMAL );
+ rtems_task_priority prio;
+ rtems_status_code sc;
+ sc = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio );
+ T_rsc_success( sc );
+ T_eq_u32( prio, PRIO_NORMAL );
+
T_log(T_NORMAL,"@@@ 3 WAIT 0");
Wait( semaphore[0] );
- T_log(T_NORMAL,"@@@ 3 CALL event_send 0 2 10 sendrc");
- T_log( T_NORMAL, "Calling Send(%d,%d)", mapid( ctx, 2), 10 );
- sendrc = ( *ctx->send )( mapid( ctx, 2 ), 10 );
+ T_log(T_NORMAL,"@@@ 3 CALL StartLog");
+ T_thread_switch_log *log;
+ log = T_thread_switch_record_4( &ctx->thread_switch_log );
+
+ T_log(T_NORMAL,"@@@ 3 CALL event_send 1 3 10 sendrc");
+ T_log( T_NORMAL, "Calling Send(%d,%d)", mapid( ctx, 3), 10 );
+ sendrc = ( *ctx->send )( mapid( ctx, 3 ), 10 );
T_log( T_NORMAL, "Returned 0x%x from Send", sendrc );
+ T_log(T_NORMAL,"@@@ 3 CALL CheckNoPreemption");
+ log = &ctx->thread_switch_log;
+ T_le_sz( log->header.recorded, 1 );
+ for ( size_t i = 0; i < log->header.recorded; ++i ) {
+ T_ne_u32( log->events[ i ].executing, ctx->worker_id );
+ T_eq_u32( log->events[ i ].heir, ctx->runner_id );
+ }
+
T_log(T_NORMAL,"@@@ 3 SCALAR sendrc 4");
T_rsc( sendrc, 4 );
T_log(T_NORMAL,"@@@ 3 SIGNAL 1");
Wakeup( semaphore[1] );
- T_log(T_NORMAL,"@@@ 3 STATE 0 Zombie");
- /* Code to check that Task 0 has terminated */
+ T_log(T_NORMAL,"@@@ 3 STATE 1 Zombie");
+ /* Code to check that Task 1 has terminated */
}
// ===== TEST CODE SEGMENT 4 =====
@@ -134,6 +155,7 @@ static void TestSegment3( Context* ctx ) {
static void TestSegment4( Context* ctx ) {
T_log(T_NORMAL,"@@@ 4 TASK Runner");
checkTaskIs( ctx->runner_id );
+
T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
Wakeup( semaphore[0] );
@@ -143,8 +165,8 @@ static void TestSegment4( Context* ctx ) {
T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
Wakeup( semaphore[0] );
- T_log(T_NORMAL,"@@@ 4 STATE 1 Zombie");
- /* Code to check that Task 1 has terminated */
+ T_log(T_NORMAL,"@@@ 4 STATE 2 Zombie");
+ /* Code to check that Task 2 has terminated */
}
// ===============================================
@@ -161,6 +183,7 @@ static void Runner( RtemsModelEventsMgr_Context *ctx )
static void Worker0( rtems_task_argument arg )
{
Context *ctx;
+ rtems_event_set events;
ctx = (Context *) arg;
@@ -168,7 +191,12 @@ static void Worker0( rtems_task_argument arg )
TestSegment3( ctx );
T_log( T_NORMAL, "Worker finished" );
- (void) rtems_task_suspend( RTEMS_SELF );
+ // (void) rtems_task_suspend( RTEMS_SELF );
+ // Ensure we hold no semaphores
+ Wakeup( ctx->worker_wakeup );
+ Wakeup( ctx->runner_wakeup );
+ // Wait for events so we don't terminate
+ rtems_event_receive( RTEMS_ALL_EVENTS, RTEMS_DEFAULT_OPTIONS, 0, &events );
}
@@ -202,7 +230,10 @@ static void RtemsModelEventsMgr_Setup0(
memset( ctx, 0, sizeof( *ctx ) );
ctx->runner_thread = _Thread_Get_executing();
ctx->runner_id = ctx->runner_thread->Object.id;
+
+ T_log( T_NORMAL, "Creating Worker Wakeup Semaphore" );
ctx->worker_wakeup = CreateWakeupSema();
+ T_log( T_NORMAL, "Creating Runner Wakeup Semaphore" );
ctx->runner_wakeup = CreateWakeupSema();
sc = rtems_task_get_scheduler( RTEMS_SELF, &ctx->runner_sched );
@@ -274,6 +305,7 @@ void RtemsModelEventsMgr_Run0(
&RtemsModelEventsMgr_Node0,
&RtemsModelEventsMgr_Fixture0
);
+ // This runs RtemsModelEventsMgr_Fixture
T_log( T_NORMAL, "Test Fixture Pushed" );
@@ -304,7 +336,9 @@ void RtemsModelEventsMgr_Run0(
RtemsModelEventsMgr_Cleanup( ctx );
T_log( T_NORMAL, "Run Pop Fixture" );
+ ShowWorkerSemaId( ctx );
T_pop_fixture();
+ ShowWorkerSemaId( ctx );
}
/** @} */
diff --git a/testsuites/validation/tr-model-events-mgr-1.c b/testsuites/validation/tr-model-events-mgr-1.c
index df01fa0b6c..90f3f5489b 100644
--- a/testsuites/validation/tr-model-events-mgr-1.c
+++ b/testsuites/validation/tr-model-events-mgr-1.c
@@ -69,10 +69,10 @@
#define EVT_3 8
// @@@ 0 DEF NO_TIMEOUT 0
#define NO_TIMEOUT 0
-// @@@ 0 DEF TASK_MAX 2
-#define TASK_MAX 2
-// @@@ 0 DEF BAD_ID 2
-#define BAD_ID 2
+// @@@ 0 DEF TASK_MAX 3
+#define TASK_MAX 3
+// @@@ 0 DEF BAD_ID 3
+#define BAD_ID 3
// @@@ 0 DEF SEMA_MAX 2
#define SEMA_MAX 2
// @@@ 0 DEF RC_OK RTEMS_SUCCESSFUL
@@ -85,14 +85,14 @@
#define RC_Unsat RTEMS_UNSATISFIED
// @@@ 0 DEF RC_Timeout RTEMS_TIMEOUT
#define RC_Timeout RTEMS_TIMEOUT
-// @@@ 0 DCLARRAY EvtSet pending TASK_MAX
-static rtems_event_set pending[TASK_MAX];
// @@@ 0 DECL byte sendrc 0
static rtems_status_code sendrc = 0;
// @@@ 0 DECL byte recrc 0
static rtems_status_code recrc = 0;
-// @@@ 0 DECL byte recout 0
-static rtems_event_set recout = 0;
+// @@@ 0 DCLARRAY EvtSet pending TASK_MAX
+static rtems_event_set pending[TASK_MAX];
+// @@@ 0 DCLARRAY byte recout TASK_MAX
+static rtems_event_set recout[TASK_MAX];
// @@@ 0 DCLARRAY Semaphore semaphore SEMA_MAX
static rtems_id semaphore[SEMA_MAX];
@@ -112,14 +112,23 @@ static void TestSegment0( Context* ctx ) {
static void TestSegment3( Context* ctx ) {
T_log(T_NORMAL,"@@@ 3 TASK Worker");
checkTaskIs( ctx->worker_id );
+
+ T_log(T_NORMAL,"@@@ 3 CALL EqualPriority");
+ SetSelfPriority( PRIO_NORMAL );
+ rtems_task_priority prio;
+ rtems_status_code sc;
+ sc = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio );
+ T_rsc_success( sc );
+ T_eq_u32( prio, PRIO_NORMAL );
+
T_log(T_NORMAL,"@@@ 3 WAIT 0");
Wait( semaphore[0] );
T_log(T_NORMAL,"@@@ 3 SIGNAL 1");
Wakeup( semaphore[1] );
- T_log(T_NORMAL,"@@@ 3 STATE 0 Zombie");
- /* Code to check that Task 0 has terminated */
+ T_log(T_NORMAL,"@@@ 3 STATE 1 Zombie");
+ /* Code to check that Task 1 has terminated */
}
// ===== TEST CODE SEGMENT 4 =====
@@ -127,34 +136,35 @@ static void TestSegment3( Context* ctx ) {
static void TestSegment4( Context* ctx ) {
T_log(T_NORMAL,"@@@ 4 TASK Runner");
checkTaskIs( ctx->runner_id );
+
T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
Wakeup( semaphore[0] );
T_log(T_NORMAL,"@@@ 4 WAIT 1");
Wait( semaphore[1] );
- T_log(T_NORMAL,"@@@ 4 SCALAR pending 1 0");
- pending[1] = GetPending( ctx );
- T_eq_int( pending[1], 0 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR pending 2 0");
+ pending[2] = GetPending( ctx );
+ T_eq_int( pending[2], 0 );
- T_log(T_NORMAL,"@@@ 4 CALL event_receive 10 0 1 0 recout recrc");
- T_log( T_NORMAL, "Calling Receive(%d,%d,%d,%d)", 10, mergeopts( 0, 1 ) ,0 ,&recout );
- recrc = ( *ctx->receive )( 10, mergeopts( 0, 1 ), 0, &recout );
+ T_log(T_NORMAL,"@@@ 4 CALL event_receive 10 0 1 0 2 recrc");
+ T_log( T_NORMAL, "Calling Receive(%d,%d,%d,%d)", 10, mergeopts( 0, 1 ) ,0 , 2 ? &recout[2] : NULL );
+ recrc = ( *ctx->receive )( 10, mergeopts( 0, 1 ), 0, 2 ? &recout[2] : NULL );
T_log( T_NORMAL, "Returned 0x%x from Receive", recrc );
T_log(T_NORMAL,"@@@ 4 SCALAR recrc 13");
T_rsc( recrc, 13 );
- T_log(T_NORMAL,"@@@ 4 SCALAR recout 0");
- T_eq_int( recout, 0 );
- T_log(T_NORMAL,"@@@ 4 SCALAR pending 1 0");
- pending[1] = GetPending( ctx );
- T_eq_int( pending[1], 0 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR recout 2 0");
+ T_eq_int( recout[2], 0 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR pending 2 0");
+ pending[2] = GetPending( ctx );
+ T_eq_int( pending[2], 0 );
T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
Wakeup( semaphore[0] );
- T_log(T_NORMAL,"@@@ 4 STATE 1 Zombie");
- /* Code to check that Task 1 has terminated */
+ T_log(T_NORMAL,"@@@ 4 STATE 2 Zombie");
+ /* Code to check that Task 2 has terminated */
}
// ===============================================
@@ -171,6 +181,7 @@ static void Runner( RtemsModelEventsMgr_Context *ctx )
static void Worker1( rtems_task_argument arg )
{
Context *ctx;
+ rtems_event_set events;
ctx = (Context *) arg;
@@ -178,7 +189,12 @@ static void Worker1( rtems_task_argument arg )
TestSegment3( ctx );
T_log( T_NORMAL, "Worker finished" );
- (void) rtems_task_suspend( RTEMS_SELF );
+ // (void) rtems_task_suspend( RTEMS_SELF );
+ // Ensure we hold no semaphores
+ Wakeup( ctx->worker_wakeup );
+ Wakeup( ctx->runner_wakeup );
+ // Wait for events so we don't terminate
+ rtems_event_receive( RTEMS_ALL_EVENTS, RTEMS_DEFAULT_OPTIONS, 0, &events );
}
@@ -212,7 +228,10 @@ static void RtemsModelEventsMgr_Setup1(
memset( ctx, 0, sizeof( *ctx ) );
ctx->runner_thread = _Thread_Get_executing();
ctx->runner_id = ctx->runner_thread->Object.id;
+
+ T_log( T_NORMAL, "Creating Worker Wakeup Semaphore" );
ctx->worker_wakeup = CreateWakeupSema();
+ T_log( T_NORMAL, "Creating Runner Wakeup Semaphore" );
ctx->runner_wakeup = CreateWakeupSema();
sc = rtems_task_get_scheduler( RTEMS_SELF, &ctx->runner_sched );
@@ -284,6 +303,7 @@ void RtemsModelEventsMgr_Run1(
&RtemsModelEventsMgr_Node1,
&RtemsModelEventsMgr_Fixture1
);
+ // This runs RtemsModelEventsMgr_Fixture
T_log( T_NORMAL, "Test Fixture Pushed" );
@@ -314,7 +334,9 @@ void RtemsModelEventsMgr_Run1(
RtemsModelEventsMgr_Cleanup( ctx );
T_log( T_NORMAL, "Run Pop Fixture" );
+ ShowWorkerSemaId( ctx );
T_pop_fixture();
+ ShowWorkerSemaId( ctx );
}
/** @} */
diff --git a/testsuites/validation/tr-model-events-mgr-2.c b/testsuites/validation/tr-model-events-mgr-2.c
index d761bbd8f5..96395fd11c 100644
--- a/testsuites/validation/tr-model-events-mgr-2.c
+++ b/testsuites/validation/tr-model-events-mgr-2.c
@@ -69,10 +69,10 @@
#define EVT_3 8
// @@@ 0 DEF NO_TIMEOUT 0
#define NO_TIMEOUT 0
-// @@@ 0 DEF TASK_MAX 2
-#define TASK_MAX 2
-// @@@ 0 DEF BAD_ID 2
-#define BAD_ID 2
+// @@@ 0 DEF TASK_MAX 3
+#define TASK_MAX 3
+// @@@ 0 DEF BAD_ID 3
+#define BAD_ID 3
// @@@ 0 DEF SEMA_MAX 2
#define SEMA_MAX 2
// @@@ 0 DEF RC_OK RTEMS_SUCCESSFUL
@@ -85,14 +85,14 @@
#define RC_Unsat RTEMS_UNSATISFIED
// @@@ 0 DEF RC_Timeout RTEMS_TIMEOUT
#define RC_Timeout RTEMS_TIMEOUT
-// @@@ 0 DCLARRAY EvtSet pending TASK_MAX
-static rtems_event_set pending[TASK_MAX];
// @@@ 0 DECL byte sendrc 0
static rtems_status_code sendrc = 0;
// @@@ 0 DECL byte recrc 0
static rtems_status_code recrc = 0;
-// @@@ 0 DECL byte recout 0
-static rtems_event_set recout = 0;
+// @@@ 0 DCLARRAY EvtSet pending TASK_MAX
+static rtems_event_set pending[TASK_MAX];
+// @@@ 0 DCLARRAY byte recout TASK_MAX
+static rtems_event_set recout[TASK_MAX];
// @@@ 0 DCLARRAY Semaphore semaphore SEMA_MAX
static rtems_id semaphore[SEMA_MAX];
@@ -110,8 +110,9 @@ static void TestSegment0( Context* ctx ) {
// ===== TEST CODE SEGMENT 2 =====
static void TestSegment2( Context* ctx ) {
- T_log(T_NORMAL,"@@@ 2 STATE 1 Ready");
- /* We (Task 1) can't check we are ready because we are running */
+ T_log(T_NORMAL,"@@@ 2 STATE 2 Ready");
+ /* We (Task 2) must have been recently ready because we are running */
+
}
// ===== TEST CODE SEGMENT 3 =====
@@ -119,14 +120,23 @@ static void TestSegment2( Context* ctx ) {
static void TestSegment3( Context* ctx ) {
T_log(T_NORMAL,"@@@ 3 TASK Worker");
checkTaskIs( ctx->worker_id );
+
+ T_log(T_NORMAL,"@@@ 3 CALL EqualPriority");
+ SetSelfPriority( PRIO_NORMAL );
+ rtems_task_priority prio;
+ rtems_status_code sc;
+ sc = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio );
+ T_rsc_success( sc );
+ T_eq_u32( prio, PRIO_NORMAL );
+
T_log(T_NORMAL,"@@@ 3 WAIT 0");
Wait( semaphore[0] );
T_log(T_NORMAL,"@@@ 3 SIGNAL 1");
Wakeup( semaphore[1] );
- T_log(T_NORMAL,"@@@ 3 STATE 0 Zombie");
- /* Code to check that Task 0 has terminated */
+ T_log(T_NORMAL,"@@@ 3 STATE 1 Zombie");
+ /* Code to check that Task 1 has terminated */
}
// ===== TEST CODE SEGMENT 4 =====
@@ -134,38 +144,40 @@ static void TestSegment3( Context* ctx ) {
static void TestSegment4( Context* ctx ) {
T_log(T_NORMAL,"@@@ 4 TASK Runner");
checkTaskIs( ctx->runner_id );
+
T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
Wakeup( semaphore[0] );
T_log(T_NORMAL,"@@@ 4 WAIT 1");
Wait( semaphore[1] );
- T_log(T_NORMAL,"@@@ 4 SCALAR pending 1 0");
- pending[1] = GetPending( ctx );
- T_eq_int( pending[1], 0 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR pending 2 0");
+ pending[2] = GetPending( ctx );
+ T_eq_int( pending[2], 0 );
- T_log(T_NORMAL,"@@@ 4 CALL event_receive 10 1 1 4 recout recrc");
- T_log( T_NORMAL, "Calling Receive(%d,%d,%d,%d)", 10, mergeopts( 1, 1 ) ,4 ,&recout );
- recrc = ( *ctx->receive )( 10, mergeopts( 1, 1 ), 4, &recout );
+ T_log(T_NORMAL,"@@@ 4 CALL event_receive 10 1 1 4 2 recrc");
+ T_log( T_NORMAL, "Calling Receive(%d,%d,%d,%d)", 10, mergeopts( 1, 1 ) ,4 , 2 ? &recout[2] : NULL );
+ recrc = ( *ctx->receive )( 10, mergeopts( 1, 1 ), 4, 2 ? &recout[2] : NULL );
T_log( T_NORMAL, "Returned 0x%x from Receive", recrc );
- T_log(T_NORMAL,"@@@ 4 STATE 1 TimeWait 4");
+ T_log(T_NORMAL,"@@@ 4 STATE 2 TimeWait 4");
// DON'T KNOW HOW TO REFINE: 4 'STATE
- T_log(T_NORMAL,"@@@ 4 STATE 1 Ready");
- /* We (Task 1) can't check we are ready because we are running */
+ T_log(T_NORMAL,"@@@ 4 STATE 2 Ready");
+ /* We (Task 2) must have been recently ready because we are running */
+
T_log(T_NORMAL,"@@@ 4 SCALAR recrc 6");
T_rsc( recrc, 6 );
- T_log(T_NORMAL,"@@@ 4 SCALAR recout 0");
- T_eq_int( recout, 0 );
- T_log(T_NORMAL,"@@@ 4 SCALAR pending 1 0");
- pending[1] = GetPending( ctx );
- T_eq_int( pending[1], 0 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR recout 2 0");
+ T_eq_int( recout[2], 0 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR pending 2 0");
+ pending[2] = GetPending( ctx );
+ T_eq_int( pending[2], 0 );
T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
Wakeup( semaphore[0] );
- T_log(T_NORMAL,"@@@ 4 STATE 1 Zombie");
- /* Code to check that Task 1 has terminated */
+ T_log(T_NORMAL,"@@@ 4 STATE 2 Zombie");
+ /* Code to check that Task 2 has terminated */
}
// ===============================================
@@ -182,6 +194,7 @@ static void Runner( RtemsModelEventsMgr_Context *ctx )
static void Worker2( rtems_task_argument arg )
{
Context *ctx;
+ rtems_event_set events;
ctx = (Context *) arg;
@@ -189,7 +202,12 @@ static void Worker2( rtems_task_argument arg )
TestSegment3( ctx );
T_log( T_NORMAL, "Worker finished" );
- (void) rtems_task_suspend( RTEMS_SELF );
+ // (void) rtems_task_suspend( RTEMS_SELF );
+ // Ensure we hold no semaphores
+ Wakeup( ctx->worker_wakeup );
+ Wakeup( ctx->runner_wakeup );
+ // Wait for events so we don't terminate
+ rtems_event_receive( RTEMS_ALL_EVENTS, RTEMS_DEFAULT_OPTIONS, 0, &events );
}
@@ -223,7 +241,10 @@ static void RtemsModelEventsMgr_Setup2(
memset( ctx, 0, sizeof( *ctx ) );
ctx->runner_thread = _Thread_Get_executing();
ctx->runner_id = ctx->runner_thread->Object.id;
+
+ T_log( T_NORMAL, "Creating Worker Wakeup Semaphore" );
ctx->worker_wakeup = CreateWakeupSema();
+ T_log( T_NORMAL, "Creating Runner Wakeup Semaphore" );
ctx->runner_wakeup = CreateWakeupSema();
sc = rtems_task_get_scheduler( RTEMS_SELF, &ctx->runner_sched );
@@ -295,6 +316,7 @@ void RtemsModelEventsMgr_Run2(
&RtemsModelEventsMgr_Node2,
&RtemsModelEventsMgr_Fixture2
);
+ // This runs RtemsModelEventsMgr_Fixture
T_log( T_NORMAL, "Test Fixture Pushed" );
@@ -325,7 +347,9 @@ void RtemsModelEventsMgr_Run2(
RtemsModelEventsMgr_Cleanup( ctx );
T_log( T_NORMAL, "Run Pop Fixture" );
+ ShowWorkerSemaId( ctx );
T_pop_fixture();
+ ShowWorkerSemaId( ctx );
}
/** @} */
diff --git a/testsuites/validation/tr-model-events-mgr-3.c b/testsuites/validation/tr-model-events-mgr-3.c
index c7437801ba..2aaa70abe0 100644
--- a/testsuites/validation/tr-model-events-mgr-3.c
+++ b/testsuites/validation/tr-model-events-mgr-3.c
@@ -69,10 +69,10 @@
#define EVT_3 8
// @@@ 0 DEF NO_TIMEOUT 0
#define NO_TIMEOUT 0
-// @@@ 0 DEF TASK_MAX 2
-#define TASK_MAX 2
-// @@@ 0 DEF BAD_ID 2
-#define BAD_ID 2
+// @@@ 0 DEF TASK_MAX 3
+#define TASK_MAX 3
+// @@@ 0 DEF BAD_ID 3
+#define BAD_ID 3
// @@@ 0 DEF SEMA_MAX 2
#define SEMA_MAX 2
// @@@ 0 DEF RC_OK RTEMS_SUCCESSFUL
@@ -85,14 +85,14 @@
#define RC_Unsat RTEMS_UNSATISFIED
// @@@ 0 DEF RC_Timeout RTEMS_TIMEOUT
#define RC_Timeout RTEMS_TIMEOUT
-// @@@ 0 DCLARRAY EvtSet pending TASK_MAX
-static rtems_event_set pending[TASK_MAX];
// @@@ 0 DECL byte sendrc 0
static rtems_status_code sendrc = 0;
// @@@ 0 DECL byte recrc 0
static rtems_status_code recrc = 0;
-// @@@ 0 DECL byte recout 0
-static rtems_event_set recout = 0;
+// @@@ 0 DCLARRAY EvtSet pending TASK_MAX
+static rtems_event_set pending[TASK_MAX];
+// @@@ 0 DCLARRAY byte recout TASK_MAX
+static rtems_event_set recout[TASK_MAX];
// @@@ 0 DCLARRAY Semaphore semaphore SEMA_MAX
static rtems_id semaphore[SEMA_MAX];
@@ -112,21 +112,23 @@ static void TestSegment0( Context* ctx ) {
static void TestSegment3( Context* ctx ) {
T_log(T_NORMAL,"@@@ 3 TASK Worker");
checkTaskIs( ctx->worker_id );
+
+ T_log(T_NORMAL,"@@@ 3 CALL EqualPriority");
+ SetSelfPriority( PRIO_NORMAL );
+ rtems_task_priority prio;
+ rtems_status_code sc;
+ sc = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio );
+ T_rsc_success( sc );
+ T_eq_u32( prio, PRIO_NORMAL );
+
T_log(T_NORMAL,"@@@ 3 WAIT 0");
Wait( semaphore[0] );
- T_log(T_NORMAL,"@@@ 3 CALL event_send 0 1 14 sendrc");
- T_log( T_NORMAL, "Calling Send(%d,%d)", mapid( ctx, 1), 14 );
- sendrc = ( *ctx->send )( mapid( ctx, 1 ), 14 );
- T_log( T_NORMAL, "Returned 0x%x from Send", sendrc );
-
- T_log(T_NORMAL,"@@@ 3 SCALAR sendrc 0");
- T_rsc( sendrc, 0 );
T_log(T_NORMAL,"@@@ 3 SIGNAL 1");
Wakeup( semaphore[1] );
- T_log(T_NORMAL,"@@@ 3 STATE 0 Zombie");
- /* Code to check that Task 0 has terminated */
+ T_log(T_NORMAL,"@@@ 3 STATE 1 Zombie");
+ /* Code to check that Task 1 has terminated */
}
// ===== TEST CODE SEGMENT 4 =====
@@ -134,34 +136,33 @@ static void TestSegment3( Context* ctx ) {
static void TestSegment4( Context* ctx ) {
T_log(T_NORMAL,"@@@ 4 TASK Runner");
checkTaskIs( ctx->runner_id );
+
T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
Wakeup( semaphore[0] );
T_log(T_NORMAL,"@@@ 4 WAIT 1");
Wait( semaphore[1] );
- T_log(T_NORMAL,"@@@ 4 SCALAR pending 1 14");
- pending[1] = GetPending( ctx );
- T_eq_int( pending[1], 14 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR pending 2 0");
+ pending[2] = GetPending( ctx );
+ T_eq_int( pending[2], 0 );
- T_log(T_NORMAL,"@@@ 4 CALL event_receive 10 1 1 0 recout recrc");
- T_log( T_NORMAL, "Calling Receive(%d,%d,%d,%d)", 10, mergeopts( 1, 1 ) ,0 ,&recout );
- recrc = ( *ctx->receive )( 10, mergeopts( 1, 1 ), 0, &recout );
+ T_log(T_NORMAL,"@@@ 4 CALL event_receive 10 1 1 0 0 recrc");
+ T_log( T_NORMAL, "Calling Receive(%d,%d,%d,%d)", 10, mergeopts( 1, 1 ) ,0 , 0 ? &recout[0] : NULL );
+ recrc = ( *ctx->receive )( 10, mergeopts( 1, 1 ), 0, 0 ? &recout[0] : NULL );
T_log( T_NORMAL, "Returned 0x%x from Receive", recrc );
- T_log(T_NORMAL,"@@@ 4 SCALAR recrc 0");
- T_rsc( recrc, 0 );
- T_log(T_NORMAL,"@@@ 4 SCALAR recout 10");
- T_eq_int( recout, 10 );
- T_log(T_NORMAL,"@@@ 4 SCALAR pending 1 4");
- pending[1] = GetPending( ctx );
- T_eq_int( pending[1], 4 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR recrc 9");
+ T_rsc( recrc, 9 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR pending 2 0");
+ pending[2] = GetPending( ctx );
+ T_eq_int( pending[2], 0 );
T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
Wakeup( semaphore[0] );
- T_log(T_NORMAL,"@@@ 4 STATE 1 Zombie");
- /* Code to check that Task 1 has terminated */
+ T_log(T_NORMAL,"@@@ 4 STATE 2 Zombie");
+ /* Code to check that Task 2 has terminated */
}
// ===============================================
@@ -178,6 +179,7 @@ static void Runner( RtemsModelEventsMgr_Context *ctx )
static void Worker3( rtems_task_argument arg )
{
Context *ctx;
+ rtems_event_set events;
ctx = (Context *) arg;
@@ -185,7 +187,12 @@ static void Worker3( rtems_task_argument arg )
TestSegment3( ctx );
T_log( T_NORMAL, "Worker finished" );
- (void) rtems_task_suspend( RTEMS_SELF );
+ // (void) rtems_task_suspend( RTEMS_SELF );
+ // Ensure we hold no semaphores
+ Wakeup( ctx->worker_wakeup );
+ Wakeup( ctx->runner_wakeup );
+ // Wait for events so we don't terminate
+ rtems_event_receive( RTEMS_ALL_EVENTS, RTEMS_DEFAULT_OPTIONS, 0, &events );
}
@@ -219,7 +226,10 @@ static void RtemsModelEventsMgr_Setup3(
memset( ctx, 0, sizeof( *ctx ) );
ctx->runner_thread = _Thread_Get_executing();
ctx->runner_id = ctx->runner_thread->Object.id;
+
+ T_log( T_NORMAL, "Creating Worker Wakeup Semaphore" );
ctx->worker_wakeup = CreateWakeupSema();
+ T_log( T_NORMAL, "Creating Runner Wakeup Semaphore" );
ctx->runner_wakeup = CreateWakeupSema();
sc = rtems_task_get_scheduler( RTEMS_SELF, &ctx->runner_sched );
@@ -291,6 +301,7 @@ void RtemsModelEventsMgr_Run3(
&RtemsModelEventsMgr_Node3,
&RtemsModelEventsMgr_Fixture3
);
+ // This runs RtemsModelEventsMgr_Fixture
T_log( T_NORMAL, "Test Fixture Pushed" );
@@ -321,7 +332,9 @@ void RtemsModelEventsMgr_Run3(
RtemsModelEventsMgr_Cleanup( ctx );
T_log( T_NORMAL, "Run Pop Fixture" );
+ ShowWorkerSemaId( ctx );
T_pop_fixture();
+ ShowWorkerSemaId( ctx );
}
/** @} */
diff --git a/testsuites/validation/tr-model-events-mgr-4.c b/testsuites/validation/tr-model-events-mgr-4.c
index 2c6b1f7eba..290e5c236b 100644
--- a/testsuites/validation/tr-model-events-mgr-4.c
+++ b/testsuites/validation/tr-model-events-mgr-4.c
@@ -69,10 +69,10 @@
#define EVT_3 8
// @@@ 0 DEF NO_TIMEOUT 0
#define NO_TIMEOUT 0
-// @@@ 0 DEF TASK_MAX 2
-#define TASK_MAX 2
-// @@@ 0 DEF BAD_ID 2
-#define BAD_ID 2
+// @@@ 0 DEF TASK_MAX 3
+#define TASK_MAX 3
+// @@@ 0 DEF BAD_ID 3
+#define BAD_ID 3
// @@@ 0 DEF SEMA_MAX 2
#define SEMA_MAX 2
// @@@ 0 DEF RC_OK RTEMS_SUCCESSFUL
@@ -85,14 +85,14 @@
#define RC_Unsat RTEMS_UNSATISFIED
// @@@ 0 DEF RC_Timeout RTEMS_TIMEOUT
#define RC_Timeout RTEMS_TIMEOUT
-// @@@ 0 DCLARRAY EvtSet pending TASK_MAX
-static rtems_event_set pending[TASK_MAX];
// @@@ 0 DECL byte sendrc 0
static rtems_status_code sendrc = 0;
// @@@ 0 DECL byte recrc 0
static rtems_status_code recrc = 0;
-// @@@ 0 DECL byte recout 0
-static rtems_event_set recout = 0;
+// @@@ 0 DCLARRAY EvtSet pending TASK_MAX
+static rtems_event_set pending[TASK_MAX];
+// @@@ 0 DCLARRAY byte recout TASK_MAX
+static rtems_event_set recout[TASK_MAX];
// @@@ 0 DCLARRAY Semaphore semaphore SEMA_MAX
static rtems_id semaphore[SEMA_MAX];
@@ -112,21 +112,42 @@ static void TestSegment0( Context* ctx ) {
static void TestSegment3( Context* ctx ) {
T_log(T_NORMAL,"@@@ 3 TASK Worker");
checkTaskIs( ctx->worker_id );
+
+ T_log(T_NORMAL,"@@@ 3 CALL EqualPriority");
+ SetSelfPriority( PRIO_NORMAL );
+ rtems_task_priority prio;
+ rtems_status_code sc;
+ sc = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio );
+ T_rsc_success( sc );
+ T_eq_u32( prio, PRIO_NORMAL );
+
T_log(T_NORMAL,"@@@ 3 WAIT 0");
Wait( semaphore[0] );
- T_log(T_NORMAL,"@@@ 3 CALL event_send 0 1 11 sendrc");
- T_log( T_NORMAL, "Calling Send(%d,%d)", mapid( ctx, 1), 11 );
- sendrc = ( *ctx->send )( mapid( ctx, 1 ), 11 );
+ T_log(T_NORMAL,"@@@ 3 CALL StartLog");
+ T_thread_switch_log *log;
+ log = T_thread_switch_record_4( &ctx->thread_switch_log );
+
+ T_log(T_NORMAL,"@@@ 3 CALL event_send 1 2 14 sendrc");
+ T_log( T_NORMAL, "Calling Send(%d,%d)", mapid( ctx, 2), 14 );
+ sendrc = ( *ctx->send )( mapid( ctx, 2 ), 14 );
T_log( T_NORMAL, "Returned 0x%x from Send", sendrc );
+ T_log(T_NORMAL,"@@@ 3 CALL CheckNoPreemption");
+ log = &ctx->thread_switch_log;
+ T_le_sz( log->header.recorded, 1 );
+ for ( size_t i = 0; i < log->header.recorded; ++i ) {
+ T_ne_u32( log->events[ i ].executing, ctx->worker_id );
+ T_eq_u32( log->events[ i ].heir, ctx->runner_id );
+ }
+
T_log(T_NORMAL,"@@@ 3 SCALAR sendrc 0");
T_rsc( sendrc, 0 );
T_log(T_NORMAL,"@@@ 3 SIGNAL 1");
Wakeup( semaphore[1] );
- T_log(T_NORMAL,"@@@ 3 STATE 0 Zombie");
- /* Code to check that Task 0 has terminated */
+ T_log(T_NORMAL,"@@@ 3 STATE 1 Zombie");
+ /* Code to check that Task 1 has terminated */
}
// ===== TEST CODE SEGMENT 4 =====
@@ -134,34 +155,35 @@ static void TestSegment3( Context* ctx ) {
static void TestSegment4( Context* ctx ) {
T_log(T_NORMAL,"@@@ 4 TASK Runner");
checkTaskIs( ctx->runner_id );
+
T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
Wakeup( semaphore[0] );
T_log(T_NORMAL,"@@@ 4 WAIT 1");
Wait( semaphore[1] );
- T_log(T_NORMAL,"@@@ 4 SCALAR pending 1 11");
- pending[1] = GetPending( ctx );
- T_eq_int( pending[1], 11 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR pending 2 14");
+ pending[2] = GetPending( ctx );
+ T_eq_int( pending[2], 14 );
- T_log(T_NORMAL,"@@@ 4 CALL event_receive 10 1 1 0 recout recrc");
- T_log( T_NORMAL, "Calling Receive(%d,%d,%d,%d)", 10, mergeopts( 1, 1 ) ,0 ,&recout );
- recrc = ( *ctx->receive )( 10, mergeopts( 1, 1 ), 0, &recout );
+ T_log(T_NORMAL,"@@@ 4 CALL event_receive 10 1 1 0 2 recrc");
+ T_log( T_NORMAL, "Calling Receive(%d,%d,%d,%d)", 10, mergeopts( 1, 1 ) ,0 , 2 ? &recout[2] : NULL );
+ recrc = ( *ctx->receive )( 10, mergeopts( 1, 1 ), 0, 2 ? &recout[2] : NULL );
T_log( T_NORMAL, "Returned 0x%x from Receive", recrc );
T_log(T_NORMAL,"@@@ 4 SCALAR recrc 0");
T_rsc( recrc, 0 );
- T_log(T_NORMAL,"@@@ 4 SCALAR recout 10");
- T_eq_int( recout, 10 );
- T_log(T_NORMAL,"@@@ 4 SCALAR pending 1 1");
- pending[1] = GetPending( ctx );
- T_eq_int( pending[1], 1 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR recout 2 10");
+ T_eq_int( recout[2], 10 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR pending 2 4");
+ pending[2] = GetPending( ctx );
+ T_eq_int( pending[2], 4 );
T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
Wakeup( semaphore[0] );
- T_log(T_NORMAL,"@@@ 4 STATE 1 Zombie");
- /* Code to check that Task 1 has terminated */
+ T_log(T_NORMAL,"@@@ 4 STATE 2 Zombie");
+ /* Code to check that Task 2 has terminated */
}
// ===============================================
@@ -178,6 +200,7 @@ static void Runner( RtemsModelEventsMgr_Context *ctx )
static void Worker4( rtems_task_argument arg )
{
Context *ctx;
+ rtems_event_set events;
ctx = (Context *) arg;
@@ -185,7 +208,12 @@ static void Worker4( rtems_task_argument arg )
TestSegment3( ctx );
T_log( T_NORMAL, "Worker finished" );
- (void) rtems_task_suspend( RTEMS_SELF );
+ // (void) rtems_task_suspend( RTEMS_SELF );
+ // Ensure we hold no semaphores
+ Wakeup( ctx->worker_wakeup );
+ Wakeup( ctx->runner_wakeup );
+ // Wait for events so we don't terminate
+ rtems_event_receive( RTEMS_ALL_EVENTS, RTEMS_DEFAULT_OPTIONS, 0, &events );
}
@@ -219,7 +247,10 @@ static void RtemsModelEventsMgr_Setup4(
memset( ctx, 0, sizeof( *ctx ) );
ctx->runner_thread = _Thread_Get_executing();
ctx->runner_id = ctx->runner_thread->Object.id;
+
+ T_log( T_NORMAL, "Creating Worker Wakeup Semaphore" );
ctx->worker_wakeup = CreateWakeupSema();
+ T_log( T_NORMAL, "Creating Runner Wakeup Semaphore" );
ctx->runner_wakeup = CreateWakeupSema();
sc = rtems_task_get_scheduler( RTEMS_SELF, &ctx->runner_sched );
@@ -291,6 +322,7 @@ void RtemsModelEventsMgr_Run4(
&RtemsModelEventsMgr_Node4,
&RtemsModelEventsMgr_Fixture4
);
+ // This runs RtemsModelEventsMgr_Fixture
T_log( T_NORMAL, "Test Fixture Pushed" );
@@ -321,7 +353,9 @@ void RtemsModelEventsMgr_Run4(
RtemsModelEventsMgr_Cleanup( ctx );
T_log( T_NORMAL, "Run Pop Fixture" );
+ ShowWorkerSemaId( ctx );
T_pop_fixture();
+ ShowWorkerSemaId( ctx );
}
/** @} */
diff --git a/testsuites/validation/tr-model-events-mgr-5.c b/testsuites/validation/tr-model-events-mgr-5.c
new file mode 100644
index 0000000000..b188ab7230
--- /dev/null
+++ b/testsuites/validation/tr-model-events-mgr-5.c
@@ -0,0 +1,361 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseRtemsModelEventsMgr
+ */
+
+/*
+ * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ * Trinity College Dublin (http://www.tcd.ie)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This file was automatically generated. Do not edit it manually.
+ * Please have a look at
+ *
+ * https://docs.rtems.org/branches/master/eng/req/howto.html
+ *
+ * for information how to maintain and re-generate this file.
+ */
+
+#ifndef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/score/threadimpl.h>
+
+
+#include "tr-model-events-mgr.h"
+
+// ===============================================
+
+// @@@ 0 NAME Event_Manager_TestGen
+// @@@ 0 DEF NO_OF_EVENTS 4
+#define NO_OF_EVENTS 4
+// @@@ 0 DEF EVTS_NONE 0
+#define EVTS_NONE 0
+// @@@ 0 DEF EVTS_PENDING 0
+#define EVTS_PENDING 0
+// @@@ 0 DEF EVT_0 1
+#define EVT_0 1
+// @@@ 0 DEF EVT_1 2
+#define EVT_1 2
+// @@@ 0 DEF EVT_2 4
+#define EVT_2 4
+// @@@ 0 DEF EVT_3 8
+#define EVT_3 8
+// @@@ 0 DEF NO_TIMEOUT 0
+#define NO_TIMEOUT 0
+// @@@ 0 DEF TASK_MAX 3
+#define TASK_MAX 3
+// @@@ 0 DEF BAD_ID 3
+#define BAD_ID 3
+// @@@ 0 DEF SEMA_MAX 2
+#define SEMA_MAX 2
+// @@@ 0 DEF RC_OK RTEMS_SUCCESSFUL
+#define RC_OK RTEMS_SUCCESSFUL
+// @@@ 0 DEF RC_InvId RTEMS_INVALID_ID
+#define RC_InvId RTEMS_INVALID_ID
+// @@@ 0 DEF RC_InvAddr RTEMS_INVALID_ADDRESS
+#define RC_InvAddr RTEMS_INVALID_ADDRESS
+// @@@ 0 DEF RC_Unsat RTEMS_UNSATISFIED
+#define RC_Unsat RTEMS_UNSATISFIED
+// @@@ 0 DEF RC_Timeout RTEMS_TIMEOUT
+#define RC_Timeout RTEMS_TIMEOUT
+// @@@ 0 DECL byte sendrc 0
+static rtems_status_code sendrc = 0;
+// @@@ 0 DECL byte recrc 0
+static rtems_status_code recrc = 0;
+// @@@ 0 DCLARRAY EvtSet pending TASK_MAX
+static rtems_event_set pending[TASK_MAX];
+// @@@ 0 DCLARRAY byte recout TASK_MAX
+static rtems_event_set recout[TASK_MAX];
+// @@@ 0 DCLARRAY Semaphore semaphore SEMA_MAX
+static rtems_id semaphore[SEMA_MAX];
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ /* Test Name is defined in the Test Case code (tc-model-events-mgr.c) */
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ initialise_pending( pending, TASK_MAX );
+ initialise_semaphore( ctx, semaphore );
+
+}
+
+// ===== TEST CODE SEGMENT 3 =====
+
+static void TestSegment3( Context* ctx ) {
+ T_log(T_NORMAL,"@@@ 3 TASK Worker");
+ checkTaskIs( ctx->worker_id );
+
+ T_log(T_NORMAL,"@@@ 3 CALL EqualPriority");
+ SetSelfPriority( PRIO_NORMAL );
+ rtems_task_priority prio;
+ rtems_status_code sc;
+ sc = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio );
+ T_rsc_success( sc );
+ T_eq_u32( prio, PRIO_NORMAL );
+
+ T_log(T_NORMAL,"@@@ 3 WAIT 0");
+ Wait( semaphore[0] );
+
+ T_log(T_NORMAL,"@@@ 3 CALL StartLog");
+ T_thread_switch_log *log;
+ log = T_thread_switch_record_4( &ctx->thread_switch_log );
+
+ T_log(T_NORMAL,"@@@ 3 CALL event_send 1 2 11 sendrc");
+ T_log( T_NORMAL, "Calling Send(%d,%d)", mapid( ctx, 2), 11 );
+ sendrc = ( *ctx->send )( mapid( ctx, 2 ), 11 );
+ T_log( T_NORMAL, "Returned 0x%x from Send", sendrc );
+
+ T_log(T_NORMAL,"@@@ 3 CALL CheckNoPreemption");
+ log = &ctx->thread_switch_log;
+ T_le_sz( log->header.recorded, 1 );
+ for ( size_t i = 0; i < log->header.recorded; ++i ) {
+ T_ne_u32( log->events[ i ].executing, ctx->worker_id );
+ T_eq_u32( log->events[ i ].heir, ctx->runner_id );
+ }
+
+ T_log(T_NORMAL,"@@@ 3 SCALAR sendrc 0");
+ T_rsc( sendrc, 0 );
+ T_log(T_NORMAL,"@@@ 3 SIGNAL 1");
+ Wakeup( semaphore[1] );
+
+ T_log(T_NORMAL,"@@@ 3 STATE 1 Zombie");
+ /* Code to check that Task 1 has terminated */
+}
+
+// ===== TEST CODE SEGMENT 4 =====
+
+static void TestSegment4( Context* ctx ) {
+ T_log(T_NORMAL,"@@@ 4 TASK Runner");
+ checkTaskIs( ctx->runner_id );
+
+ T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
+ Wakeup( semaphore[0] );
+
+ T_log(T_NORMAL,"@@@ 4 WAIT 1");
+ Wait( semaphore[1] );
+
+ T_log(T_NORMAL,"@@@ 4 SCALAR pending 2 11");
+ pending[2] = GetPending( ctx );
+ T_eq_int( pending[2], 11 );
+
+ T_log(T_NORMAL,"@@@ 4 CALL event_receive 10 1 1 0 2 recrc");
+ T_log( T_NORMAL, "Calling Receive(%d,%d,%d,%d)", 10, mergeopts( 1, 1 ) ,0 , 2 ? &recout[2] : NULL );
+ recrc = ( *ctx->receive )( 10, mergeopts( 1, 1 ), 0, 2 ? &recout[2] : NULL );
+ T_log( T_NORMAL, "Returned 0x%x from Receive", recrc );
+
+ T_log(T_NORMAL,"@@@ 4 SCALAR recrc 0");
+ T_rsc( recrc, 0 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR recout 2 10");
+ T_eq_int( recout[2], 10 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR pending 2 1");
+ pending[2] = GetPending( ctx );
+ T_eq_int( pending[2], 1 );
+
+ T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
+ Wakeup( semaphore[0] );
+
+ T_log(T_NORMAL,"@@@ 4 STATE 2 Zombie");
+ /* Code to check that Task 2 has terminated */
+}
+
+// ===============================================
+
+
+
+static void Runner( RtemsModelEventsMgr_Context *ctx )
+{
+ T_log( T_NORMAL, "Runner running" );
+ TestSegment4( ctx );
+ T_log( T_NORMAL, "Runner finished" );
+}
+
+static void Worker5( rtems_task_argument arg )
+{
+ Context *ctx;
+ rtems_event_set events;
+
+ ctx = (Context *) arg;
+
+ T_log( T_NORMAL, "Worker Running" );
+ TestSegment3( ctx );
+ T_log( T_NORMAL, "Worker finished" );
+
+ // (void) rtems_task_suspend( RTEMS_SELF );
+ // Ensure we hold no semaphores
+ Wakeup( ctx->worker_wakeup );
+ Wakeup( ctx->runner_wakeup );
+ // Wait for events so we don't terminate
+ rtems_event_receive( RTEMS_ALL_EVENTS, RTEMS_DEFAULT_OPTIONS, 0, &events );
+
+}
+
+RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) static char WorkerStorage5[
+ RTEMS_TASK_STORAGE_SIZE(
+ MAX_TLS_SIZE + RTEMS_MINIMUM_STACK_SIZE,
+ WORKER_ATTRIBUTES
+ )
+];
+
+static const rtems_task_config WorkerConfig5 = {
+ .name = rtems_build_name( 'W', 'O', 'R', 'K' ),
+ .initial_priority = PRIO_LOW,
+ .storage_area = WorkerStorage5,
+ .storage_size = sizeof( WorkerStorage5 ),
+ .maximum_thread_local_storage_size = MAX_TLS_SIZE,
+ .initial_modes = RTEMS_DEFAULT_MODES,
+ .attributes = WORKER_ATTRIBUTES
+};
+
+
+static void RtemsModelEventsMgr_Setup5(
+ RtemsModelEventsMgr_Context *ctx
+)
+{
+ rtems_status_code sc;
+ rtems_task_priority prio;
+
+ T_log( T_NORMAL, "Runner Setup" );
+
+ memset( ctx, 0, sizeof( *ctx ) );
+ ctx->runner_thread = _Thread_Get_executing();
+ ctx->runner_id = ctx->runner_thread->Object.id;
+
+ T_log( T_NORMAL, "Creating Worker Wakeup Semaphore" );
+ ctx->worker_wakeup = CreateWakeupSema();
+ T_log( T_NORMAL, "Creating Runner Wakeup Semaphore" );
+ ctx->runner_wakeup = CreateWakeupSema();
+
+ sc = rtems_task_get_scheduler( RTEMS_SELF, &ctx->runner_sched );
+ T_rsc_success( sc );
+
+ #if defined(RTEMS_SMP)
+ sc = rtems_scheduler_ident_by_processor( 1, &ctx->other_sched );
+ T_rsc_success( sc );
+ T_ne_u32( ctx->runner_sched, ctx->other_sched );
+ #endif
+
+ prio = 0;
+ sc = rtems_task_set_priority( RTEMS_SELF, PRIO_NORMAL, &prio );
+ T_rsc_success( sc );
+ T_eq_u32( prio, PRIO_HIGH );
+
+ sc = rtems_task_construct( &WorkerConfig5, &ctx->worker_id );
+ T_log( T_NORMAL, "Construct Worker, sc = %x", sc );
+ T_assert_rsc_success( sc );
+
+ T_log( T_NORMAL, "Starting Worker..." );
+ sc = rtems_task_start( ctx->worker_id, Worker5, (rtems_task_argument) ctx );
+ T_log( T_NORMAL, "Started Worker, sc = %x", sc );
+ T_assert_rsc_success( sc );
+}
+
+
+static void RtemsModelEventsMgr_Setup_Wrap5( void *arg )
+{
+ RtemsModelEventsMgr_Context *ctx;
+
+ ctx = arg;
+ RtemsModelEventsMgr_Setup5( ctx );
+}
+
+
+static RtemsModelEventsMgr_Context RtemsModelEventsMgr_Instance5;
+
+static T_fixture RtemsModelEventsMgr_Fixture5 = {
+ .setup = RtemsModelEventsMgr_Setup_Wrap5,
+ .stop = NULL,
+ .teardown = RtemsModelEventsMgr_Teardown_Wrap,
+ .scope = RtemsModelEventsMgr_Scope,
+ .initial_context = &RtemsModelEventsMgr_Instance5
+};
+
+static T_fixture_node RtemsModelEventsMgr_Node5;
+
+void RtemsModelEventsMgr_Run5(
+ rtems_status_code ( *send )( rtems_id, rtems_event_set ),
+ rtems_status_code ( *receive )( rtems_event_set, rtems_option, rtems_interval, rtems_event_set * ),
+ rtems_event_set ( *get_pending_events )( Thread_Control * ),
+ unsigned int wait_class,
+ int waiting_for_event
+)
+{
+ RtemsModelEventsMgr_Context *ctx;
+
+ T_set_verbosity( T_NORMAL );
+
+ T_log( T_NORMAL, "Runner Invoked" );
+ T_log( T_NORMAL, "Runner Wait Class: %d", wait_class );
+ T_log( T_NORMAL, "Runner WaitForEvent: %d", waiting_for_event );
+
+ T_log( T_NORMAL, "Pushing Test Fixture..." );
+
+
+ ctx = T_push_fixture(
+ &RtemsModelEventsMgr_Node5,
+ &RtemsModelEventsMgr_Fixture5
+ );
+ // This runs RtemsModelEventsMgr_Fixture
+
+ T_log( T_NORMAL, "Test Fixture Pushed" );
+
+
+ ctx->send = send;
+ ctx->receive = receive;
+ ctx->get_pending_events = get_pending_events;
+ ctx->wait_class = wait_class;
+ ctx->waiting_for_event = waiting_for_event;
+
+ ctx->this_test_number = 5;
+
+ // RtemsModelEventsMgr_Prepare( ctx );
+ ctx->events_to_send = 0;
+ ctx->send_status = RTEMS_INCORRECT_STATE;
+ ctx->received_events = 0xffffffff;
+ ctx->receive_option_set = 0;
+ ctx->receive_timeout = RTEMS_NO_TIMEOUT;
+ ctx->unsatisfied_pending = 0xffffffff;
+ memset( &ctx->thread_switch_log, 0, sizeof( ctx->thread_switch_log ) );
+ T_eq_u32( GetPending( ctx ), 0 );
+ _Thread_Wait_flags_set( ctx->runner_thread, THREAD_WAIT_FLAGS_INITIAL );
+
+ TestSegment0( ctx );
+
+ Runner( ctx );
+
+ RtemsModelEventsMgr_Cleanup( ctx );
+
+ T_log( T_NORMAL, "Run Pop Fixture" );
+ ShowWorkerSemaId( ctx );
+ T_pop_fixture();
+ ShowWorkerSemaId( ctx );
+}
+
+/** @} */
diff --git a/testsuites/validation/tr-model-events-mgr-6.c b/testsuites/validation/tr-model-events-mgr-6.c
new file mode 100644
index 0000000000..9d4616ee78
--- /dev/null
+++ b/testsuites/validation/tr-model-events-mgr-6.c
@@ -0,0 +1,383 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseRtemsModelEventsMgr
+ */
+
+/*
+ * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ * Trinity College Dublin (http://www.tcd.ie)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This file was automatically generated. Do not edit it manually.
+ * Please have a look at
+ *
+ * https://docs.rtems.org/branches/master/eng/req/howto.html
+ *
+ * for information how to maintain and re-generate this file.
+ */
+
+#ifndef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/score/threadimpl.h>
+
+
+#include "tr-model-events-mgr.h"
+
+// ===============================================
+
+// @@@ 0 NAME Event_Manager_TestGen
+// @@@ 0 DEF NO_OF_EVENTS 4
+#define NO_OF_EVENTS 4
+// @@@ 0 DEF EVTS_NONE 0
+#define EVTS_NONE 0
+// @@@ 0 DEF EVTS_PENDING 0
+#define EVTS_PENDING 0
+// @@@ 0 DEF EVT_0 1
+#define EVT_0 1
+// @@@ 0 DEF EVT_1 2
+#define EVT_1 2
+// @@@ 0 DEF EVT_2 4
+#define EVT_2 4
+// @@@ 0 DEF EVT_3 8
+#define EVT_3 8
+// @@@ 0 DEF NO_TIMEOUT 0
+#define NO_TIMEOUT 0
+// @@@ 0 DEF TASK_MAX 3
+#define TASK_MAX 3
+// @@@ 0 DEF BAD_ID 3
+#define BAD_ID 3
+// @@@ 0 DEF SEMA_MAX 2
+#define SEMA_MAX 2
+// @@@ 0 DEF RC_OK RTEMS_SUCCESSFUL
+#define RC_OK RTEMS_SUCCESSFUL
+// @@@ 0 DEF RC_InvId RTEMS_INVALID_ID
+#define RC_InvId RTEMS_INVALID_ID
+// @@@ 0 DEF RC_InvAddr RTEMS_INVALID_ADDRESS
+#define RC_InvAddr RTEMS_INVALID_ADDRESS
+// @@@ 0 DEF RC_Unsat RTEMS_UNSATISFIED
+#define RC_Unsat RTEMS_UNSATISFIED
+// @@@ 0 DEF RC_Timeout RTEMS_TIMEOUT
+#define RC_Timeout RTEMS_TIMEOUT
+// @@@ 0 DECL byte sendrc 0
+static rtems_status_code sendrc = 0;
+// @@@ 0 DECL byte recrc 0
+static rtems_status_code recrc = 0;
+// @@@ 0 DCLARRAY EvtSet pending TASK_MAX
+static rtems_event_set pending[TASK_MAX];
+// @@@ 0 DCLARRAY byte recout TASK_MAX
+static rtems_event_set recout[TASK_MAX];
+// @@@ 0 DCLARRAY Semaphore semaphore SEMA_MAX
+static rtems_id semaphore[SEMA_MAX];
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ /* Test Name is defined in the Test Case code (tc-model-events-mgr.c) */
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ initialise_pending( pending, TASK_MAX );
+ initialise_semaphore( ctx, semaphore );
+
+}
+
+// ===== TEST CODE SEGMENT 1 =====
+
+static void TestSegment1( Context* ctx ) {
+ T_log(T_NORMAL,"@@@ 1 STATE 1 Ready");
+ /* We (Task 1) must have been recently ready because we are running */
+
+}
+
+// ===== TEST CODE SEGMENT 3 =====
+
+static void TestSegment3( Context* ctx ) {
+ T_log(T_NORMAL,"@@@ 3 TASK Worker");
+ checkTaskIs( ctx->worker_id );
+
+ T_log(T_NORMAL,"@@@ 3 CALL LowerPriority");
+ SetSelfPriority( PRIO_LOW );
+ rtems_task_priority prio;
+ rtems_status_code sc;
+ sc = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio );
+ T_rsc_success( sc );
+ T_eq_u32( prio, PRIO_LOW );
+
+ T_log(T_NORMAL,"@@@ 3 WAIT 0");
+ Wait( semaphore[0] );
+
+ T_log(T_NORMAL,"@@@ 3 CALL StartLog");
+ T_thread_switch_log *log;
+ log = T_thread_switch_record_4( &ctx->thread_switch_log );
+
+ T_log(T_NORMAL,"@@@ 3 CALL event_send 1 2 10 sendrc");
+ T_log( T_NORMAL, "Calling Send(%d,%d)", mapid( ctx, 2), 10 );
+ sendrc = ( *ctx->send )( mapid( ctx, 2 ), 10 );
+ T_log( T_NORMAL, "Returned 0x%x from Send", sendrc );
+
+ T_log(T_NORMAL,"@@@ 3 CALL CheckPreemption");
+ log = &ctx->thread_switch_log;
+ T_eq_sz( log->header.recorded, 2 );
+ T_eq_u32( log->events[ 0 ].heir, ctx->runner_id );
+ T_eq_u32( log->events[ 1 ].heir, ctx->worker_id );
+
+ T_log(T_NORMAL,"@@@ 3 STATE 2 Ready");
+ /* We (Task 2) must have been recently ready because we are running */
+
+ T_log(T_NORMAL,"@@@ 3 STATE 1 OtherWait");
+ /* Code to check that Task 1 is waiting (after pre-emption) */
+ T_log(T_NORMAL,"@@@ 3 STATE 1 Ready");
+ /* We (Task 1) must have been recently ready because we are running */
+
+ T_log(T_NORMAL,"@@@ 3 SCALAR sendrc 0");
+ T_rsc( sendrc, 0 );
+ T_log(T_NORMAL,"@@@ 3 SIGNAL 1");
+ Wakeup( semaphore[1] );
+
+ T_log(T_NORMAL,"@@@ 3 STATE 1 Zombie");
+ /* Code to check that Task 1 has terminated */
+}
+
+// ===== TEST CODE SEGMENT 4 =====
+
+static void TestSegment4( Context* ctx ) {
+ T_log(T_NORMAL,"@@@ 4 TASK Runner");
+ checkTaskIs( ctx->runner_id );
+
+ T_log(T_NORMAL,"@@@ 4 SIGNAL 1");
+ Wakeup( semaphore[1] );
+
+ T_log(T_NORMAL,"@@@ 4 WAIT 1");
+ Wait( semaphore[1] );
+
+ T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
+ Wakeup( semaphore[0] );
+
+ T_log(T_NORMAL,"@@@ 4 SCALAR pending 2 0");
+ pending[2] = GetPending( ctx );
+ T_eq_int( pending[2], 0 );
+
+ T_log(T_NORMAL,"@@@ 4 CALL event_receive 10 1 1 0 2 recrc");
+ T_log( T_NORMAL, "Calling Receive(%d,%d,%d,%d)", 10, mergeopts( 1, 1 ) ,0 , 2 ? &recout[2] : NULL );
+ recrc = ( *ctx->receive )( 10, mergeopts( 1, 1 ), 0, 2 ? &recout[2] : NULL );
+ T_log( T_NORMAL, "Returned 0x%x from Receive", recrc );
+
+ T_log(T_NORMAL,"@@@ 4 STATE 2 EventWait");
+ /* Code to check that Task 2 is waiting on events */
+ T_log(T_NORMAL,"@@@ 4 STATE 2 Ready");
+ /* We (Task 2) must have been recently ready because we are running */
+
+ T_log(T_NORMAL,"@@@ 4 SCALAR recrc 0");
+ T_rsc( recrc, 0 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR recout 2 10");
+ T_eq_int( recout[2], 10 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR pending 2 0");
+ pending[2] = GetPending( ctx );
+ T_eq_int( pending[2], 0 );
+
+ T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
+ Wakeup( semaphore[0] );
+
+ T_log(T_NORMAL,"@@@ 4 STATE 2 Zombie");
+ /* Code to check that Task 2 has terminated */
+}
+
+// ===============================================
+
+
+
+static void Runner( RtemsModelEventsMgr_Context *ctx )
+{
+ T_log( T_NORMAL, "Runner running" );
+ TestSegment4( ctx );
+ T_log( T_NORMAL, "Runner finished" );
+}
+
+static void Worker6( rtems_task_argument arg )
+{
+ Context *ctx;
+ rtems_event_set events;
+
+ ctx = (Context *) arg;
+
+ T_log( T_NORMAL, "Worker Running" );
+ TestSegment3( ctx );
+ T_log( T_NORMAL, "Worker finished" );
+
+ // (void) rtems_task_suspend( RTEMS_SELF );
+ // Ensure we hold no semaphores
+ Wakeup( ctx->worker_wakeup );
+ Wakeup( ctx->runner_wakeup );
+ // Wait for events so we don't terminate
+ rtems_event_receive( RTEMS_ALL_EVENTS, RTEMS_DEFAULT_OPTIONS, 0, &events );
+
+}
+
+RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) static char WorkerStorage6[
+ RTEMS_TASK_STORAGE_SIZE(
+ MAX_TLS_SIZE + RTEMS_MINIMUM_STACK_SIZE,
+ WORKER_ATTRIBUTES
+ )
+];
+
+static const rtems_task_config WorkerConfig6 = {
+ .name = rtems_build_name( 'W', 'O', 'R', 'K' ),
+ .initial_priority = PRIO_LOW,
+ .storage_area = WorkerStorage6,
+ .storage_size = sizeof( WorkerStorage6 ),
+ .maximum_thread_local_storage_size = MAX_TLS_SIZE,
+ .initial_modes = RTEMS_DEFAULT_MODES,
+ .attributes = WORKER_ATTRIBUTES
+};
+
+
+static void RtemsModelEventsMgr_Setup6(
+ RtemsModelEventsMgr_Context *ctx
+)
+{
+ rtems_status_code sc;
+ rtems_task_priority prio;
+
+ T_log( T_NORMAL, "Runner Setup" );
+
+ memset( ctx, 0, sizeof( *ctx ) );
+ ctx->runner_thread = _Thread_Get_executing();
+ ctx->runner_id = ctx->runner_thread->Object.id;
+
+ T_log( T_NORMAL, "Creating Worker Wakeup Semaphore" );
+ ctx->worker_wakeup = CreateWakeupSema();
+ T_log( T_NORMAL, "Creating Runner Wakeup Semaphore" );
+ ctx->runner_wakeup = CreateWakeupSema();
+
+ sc = rtems_task_get_scheduler( RTEMS_SELF, &ctx->runner_sched );
+ T_rsc_success( sc );
+
+ #if defined(RTEMS_SMP)
+ sc = rtems_scheduler_ident_by_processor( 1, &ctx->other_sched );
+ T_rsc_success( sc );
+ T_ne_u32( ctx->runner_sched, ctx->other_sched );
+ #endif
+
+ prio = 0;
+ sc = rtems_task_set_priority( RTEMS_SELF, PRIO_NORMAL, &prio );
+ T_rsc_success( sc );
+ T_eq_u32( prio, PRIO_HIGH );
+
+ sc = rtems_task_construct( &WorkerConfig6, &ctx->worker_id );
+ T_log( T_NORMAL, "Construct Worker, sc = %x", sc );
+ T_assert_rsc_success( sc );
+
+ T_log( T_NORMAL, "Starting Worker..." );
+ sc = rtems_task_start( ctx->worker_id, Worker6, (rtems_task_argument) ctx );
+ T_log( T_NORMAL, "Started Worker, sc = %x", sc );
+ T_assert_rsc_success( sc );
+}
+
+
+static void RtemsModelEventsMgr_Setup_Wrap6( void *arg )
+{
+ RtemsModelEventsMgr_Context *ctx;
+
+ ctx = arg;
+ RtemsModelEventsMgr_Setup6( ctx );
+}
+
+
+static RtemsModelEventsMgr_Context RtemsModelEventsMgr_Instance6;
+
+static T_fixture RtemsModelEventsMgr_Fixture6 = {
+ .setup = RtemsModelEventsMgr_Setup_Wrap6,
+ .stop = NULL,
+ .teardown = RtemsModelEventsMgr_Teardown_Wrap,
+ .scope = RtemsModelEventsMgr_Scope,
+ .initial_context = &RtemsModelEventsMgr_Instance6
+};
+
+static T_fixture_node RtemsModelEventsMgr_Node6;
+
+void RtemsModelEventsMgr_Run6(
+ rtems_status_code ( *send )( rtems_id, rtems_event_set ),
+ rtems_status_code ( *receive )( rtems_event_set, rtems_option, rtems_interval, rtems_event_set * ),
+ rtems_event_set ( *get_pending_events )( Thread_Control * ),
+ unsigned int wait_class,
+ int waiting_for_event
+)
+{
+ RtemsModelEventsMgr_Context *ctx;
+
+ T_set_verbosity( T_NORMAL );
+
+ T_log( T_NORMAL, "Runner Invoked" );
+ T_log( T_NORMAL, "Runner Wait Class: %d", wait_class );
+ T_log( T_NORMAL, "Runner WaitForEvent: %d", waiting_for_event );
+
+ T_log( T_NORMAL, "Pushing Test Fixture..." );
+
+
+ ctx = T_push_fixture(
+ &RtemsModelEventsMgr_Node6,
+ &RtemsModelEventsMgr_Fixture6
+ );
+ // This runs RtemsModelEventsMgr_Fixture
+
+ T_log( T_NORMAL, "Test Fixture Pushed" );
+
+
+ ctx->send = send;
+ ctx->receive = receive;
+ ctx->get_pending_events = get_pending_events;
+ ctx->wait_class = wait_class;
+ ctx->waiting_for_event = waiting_for_event;
+
+ ctx->this_test_number = 6;
+
+ // RtemsModelEventsMgr_Prepare( ctx );
+ ctx->events_to_send = 0;
+ ctx->send_status = RTEMS_INCORRECT_STATE;
+ ctx->received_events = 0xffffffff;
+ ctx->receive_option_set = 0;
+ ctx->receive_timeout = RTEMS_NO_TIMEOUT;
+ ctx->unsatisfied_pending = 0xffffffff;
+ memset( &ctx->thread_switch_log, 0, sizeof( ctx->thread_switch_log ) );
+ T_eq_u32( GetPending( ctx ), 0 );
+ _Thread_Wait_flags_set( ctx->runner_thread, THREAD_WAIT_FLAGS_INITIAL );
+
+ TestSegment0( ctx );
+
+ Runner( ctx );
+
+ RtemsModelEventsMgr_Cleanup( ctx );
+
+ T_log( T_NORMAL, "Run Pop Fixture" );
+ ShowWorkerSemaId( ctx );
+ T_pop_fixture();
+ ShowWorkerSemaId( ctx );
+}
+
+/** @} */
diff --git a/testsuites/validation/tr-model-events-mgr-7.c b/testsuites/validation/tr-model-events-mgr-7.c
new file mode 100644
index 0000000000..22fa5a6fd0
--- /dev/null
+++ b/testsuites/validation/tr-model-events-mgr-7.c
@@ -0,0 +1,388 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseRtemsModelEventsMgr
+ */
+
+/*
+ * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ * Trinity College Dublin (http://www.tcd.ie)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This file was automatically generated. Do not edit it manually.
+ * Please have a look at
+ *
+ * https://docs.rtems.org/branches/master/eng/req/howto.html
+ *
+ * for information how to maintain and re-generate this file.
+ */
+
+#ifndef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/score/threadimpl.h>
+
+
+#include "tr-model-events-mgr.h"
+
+// ===============================================
+
+// @@@ 0 NAME Event_Manager_TestGen
+// @@@ 0 DEF NO_OF_EVENTS 4
+#define NO_OF_EVENTS 4
+// @@@ 0 DEF EVTS_NONE 0
+#define EVTS_NONE 0
+// @@@ 0 DEF EVTS_PENDING 0
+#define EVTS_PENDING 0
+// @@@ 0 DEF EVT_0 1
+#define EVT_0 1
+// @@@ 0 DEF EVT_1 2
+#define EVT_1 2
+// @@@ 0 DEF EVT_2 4
+#define EVT_2 4
+// @@@ 0 DEF EVT_3 8
+#define EVT_3 8
+// @@@ 0 DEF NO_TIMEOUT 0
+#define NO_TIMEOUT 0
+// @@@ 0 DEF TASK_MAX 3
+#define TASK_MAX 3
+// @@@ 0 DEF BAD_ID 3
+#define BAD_ID 3
+// @@@ 0 DEF SEMA_MAX 2
+#define SEMA_MAX 2
+// @@@ 0 DEF RC_OK RTEMS_SUCCESSFUL
+#define RC_OK RTEMS_SUCCESSFUL
+// @@@ 0 DEF RC_InvId RTEMS_INVALID_ID
+#define RC_InvId RTEMS_INVALID_ID
+// @@@ 0 DEF RC_InvAddr RTEMS_INVALID_ADDRESS
+#define RC_InvAddr RTEMS_INVALID_ADDRESS
+// @@@ 0 DEF RC_Unsat RTEMS_UNSATISFIED
+#define RC_Unsat RTEMS_UNSATISFIED
+// @@@ 0 DEF RC_Timeout RTEMS_TIMEOUT
+#define RC_Timeout RTEMS_TIMEOUT
+// @@@ 0 DECL byte sendrc 0
+static rtems_status_code sendrc = 0;
+// @@@ 0 DECL byte recrc 0
+static rtems_status_code recrc = 0;
+// @@@ 0 DCLARRAY EvtSet pending TASK_MAX
+static rtems_event_set pending[TASK_MAX];
+// @@@ 0 DCLARRAY byte recout TASK_MAX
+static rtems_event_set recout[TASK_MAX];
+// @@@ 0 DCLARRAY Semaphore semaphore SEMA_MAX
+static rtems_id semaphore[SEMA_MAX];
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ /* Test Name is defined in the Test Case code (tc-model-events-mgr.c) */
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ initialise_pending( pending, TASK_MAX );
+ initialise_semaphore( ctx, semaphore );
+
+}
+
+// ===== TEST CODE SEGMENT 3 =====
+
+static void TestSegment3( Context* ctx ) {
+ T_log(T_NORMAL,"@@@ 3 TASK Worker");
+ checkTaskIs( ctx->worker_id );
+
+ T_log(T_NORMAL,"@@@ 3 CALL EqualPriority");
+ SetSelfPriority( PRIO_NORMAL );
+ rtems_task_priority prio;
+ rtems_status_code sc;
+ sc = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio );
+ T_rsc_success( sc );
+ T_eq_u32( prio, PRIO_NORMAL );
+
+ T_log(T_NORMAL,"@@@ 3 WAIT 0");
+ Wait( semaphore[0] );
+
+ T_log(T_NORMAL,"@@@ 3 CALL StartLog");
+ T_thread_switch_log *log;
+ log = T_thread_switch_record_4( &ctx->thread_switch_log );
+
+ T_log(T_NORMAL,"@@@ 3 CALL event_send 1 2 2 sendrc");
+ T_log( T_NORMAL, "Calling Send(%d,%d)", mapid( ctx, 2), 2 );
+ sendrc = ( *ctx->send )( mapid( ctx, 2 ), 2 );
+ T_log( T_NORMAL, "Returned 0x%x from Send", sendrc );
+
+ T_log(T_NORMAL,"@@@ 3 CALL CheckNoPreemption");
+ log = &ctx->thread_switch_log;
+ T_le_sz( log->header.recorded, 1 );
+ for ( size_t i = 0; i < log->header.recorded; ++i ) {
+ T_ne_u32( log->events[ i ].executing, ctx->worker_id );
+ T_eq_u32( log->events[ i ].heir, ctx->runner_id );
+ }
+
+ T_log(T_NORMAL,"@@@ 3 SCALAR sendrc 0");
+ T_rsc( sendrc, 0 );
+ T_log(T_NORMAL,"@@@ 3 SIGNAL 1");
+ Wakeup( semaphore[1] );
+
+ T_log(T_NORMAL,"@@@ 3 WAIT 0");
+ Wait( semaphore[0] );
+
+ T_log(T_NORMAL,"@@@ 3 CALL event_send 1 2 8 sendrc");
+ T_log( T_NORMAL, "Calling Send(%d,%d)", mapid( ctx, 2), 8 );
+ sendrc = ( *ctx->send )( mapid( ctx, 2 ), 8 );
+ T_log( T_NORMAL, "Returned 0x%x from Send", sendrc );
+
+ T_log(T_NORMAL,"@@@ 3 STATE 2 Ready");
+ /* We (Task 2) must have been recently ready because we are running */
+
+ T_log(T_NORMAL,"@@@ 3 STATE 1 Ready");
+ /* We (Task 1) must have been recently ready because we are running */
+
+ T_log(T_NORMAL,"@@@ 3 SCALAR sendrc 0");
+ T_rsc( sendrc, 0 );
+ T_log(T_NORMAL,"@@@ 3 SIGNAL 1");
+ Wakeup( semaphore[1] );
+
+ T_log(T_NORMAL,"@@@ 3 STATE 1 Zombie");
+ /* Code to check that Task 1 has terminated */
+}
+
+// ===== TEST CODE SEGMENT 4 =====
+
+static void TestSegment4( Context* ctx ) {
+ T_log(T_NORMAL,"@@@ 4 TASK Runner");
+ checkTaskIs( ctx->runner_id );
+
+ T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
+ Wakeup( semaphore[0] );
+
+ T_log(T_NORMAL,"@@@ 4 WAIT 1");
+ Wait( semaphore[1] );
+
+ T_log(T_NORMAL,"@@@ 4 SCALAR pending 2 2");
+ pending[2] = GetPending( ctx );
+ T_eq_int( pending[2], 2 );
+
+ T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
+ Wakeup( semaphore[0] );
+
+ T_log(T_NORMAL,"@@@ 4 CALL event_receive 10 1 1 0 2 recrc");
+ T_log( T_NORMAL, "Calling Receive(%d,%d,%d,%d)", 10, mergeopts( 1, 1 ) ,0 , 2 ? &recout[2] : NULL );
+ recrc = ( *ctx->receive )( 10, mergeopts( 1, 1 ), 0, 2 ? &recout[2] : NULL );
+ T_log( T_NORMAL, "Returned 0x%x from Receive", recrc );
+
+ T_log(T_NORMAL,"@@@ 4 STATE 2 EventWait");
+ /* Code to check that Task 2 is waiting on events */
+ T_log(T_NORMAL,"@@@ 4 STATE 2 Ready");
+ /* We (Task 2) must have been recently ready because we are running */
+
+ T_log(T_NORMAL,"@@@ 4 SCALAR recrc 0");
+ T_rsc( recrc, 0 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR recout 2 10");
+ T_eq_int( recout[2], 10 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR pending 2 0");
+ pending[2] = GetPending( ctx );
+ T_eq_int( pending[2], 0 );
+
+ T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
+ Wakeup( semaphore[0] );
+
+ T_log(T_NORMAL,"@@@ 4 STATE 2 Zombie");
+ /* Code to check that Task 2 has terminated */
+}
+
+// ===============================================
+
+
+
+static void Runner( RtemsModelEventsMgr_Context *ctx )
+{
+ T_log( T_NORMAL, "Runner running" );
+ TestSegment4( ctx );
+ T_log( T_NORMAL, "Runner finished" );
+}
+
+static void Worker7( rtems_task_argument arg )
+{
+ Context *ctx;
+ rtems_event_set events;
+
+ ctx = (Context *) arg;
+
+ T_log( T_NORMAL, "Worker Running" );
+ TestSegment3( ctx );
+ T_log( T_NORMAL, "Worker finished" );
+
+ // (void) rtems_task_suspend( RTEMS_SELF );
+ // Ensure we hold no semaphores
+ Wakeup( ctx->worker_wakeup );
+ Wakeup( ctx->runner_wakeup );
+ // Wait for events so we don't terminate
+ rtems_event_receive( RTEMS_ALL_EVENTS, RTEMS_DEFAULT_OPTIONS, 0, &events );
+
+}
+
+RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) static char WorkerStorage7[
+ RTEMS_TASK_STORAGE_SIZE(
+ MAX_TLS_SIZE + RTEMS_MINIMUM_STACK_SIZE,
+ WORKER_ATTRIBUTES
+ )
+];
+
+static const rtems_task_config WorkerConfig7 = {
+ .name = rtems_build_name( 'W', 'O', 'R', 'K' ),
+ .initial_priority = PRIO_LOW,
+ .storage_area = WorkerStorage7,
+ .storage_size = sizeof( WorkerStorage7 ),
+ .maximum_thread_local_storage_size = MAX_TLS_SIZE,
+ .initial_modes = RTEMS_DEFAULT_MODES,
+ .attributes = WORKER_ATTRIBUTES
+};
+
+
+static void RtemsModelEventsMgr_Setup7(
+ RtemsModelEventsMgr_Context *ctx
+)
+{
+ rtems_status_code sc;
+ rtems_task_priority prio;
+
+ T_log( T_NORMAL, "Runner Setup" );
+
+ memset( ctx, 0, sizeof( *ctx ) );
+ ctx->runner_thread = _Thread_Get_executing();
+ ctx->runner_id = ctx->runner_thread->Object.id;
+
+ T_log( T_NORMAL, "Creating Worker Wakeup Semaphore" );
+ ctx->worker_wakeup = CreateWakeupSema();
+ T_log( T_NORMAL, "Creating Runner Wakeup Semaphore" );
+ ctx->runner_wakeup = CreateWakeupSema();
+
+ sc = rtems_task_get_scheduler( RTEMS_SELF, &ctx->runner_sched );
+ T_rsc_success( sc );
+
+ #if defined(RTEMS_SMP)
+ sc = rtems_scheduler_ident_by_processor( 1, &ctx->other_sched );
+ T_rsc_success( sc );
+ T_ne_u32( ctx->runner_sched, ctx->other_sched );
+ #endif
+
+ prio = 0;
+ sc = rtems_task_set_priority( RTEMS_SELF, PRIO_NORMAL, &prio );
+ T_rsc_success( sc );
+ T_eq_u32( prio, PRIO_HIGH );
+
+ sc = rtems_task_construct( &WorkerConfig7, &ctx->worker_id );
+ T_log( T_NORMAL, "Construct Worker, sc = %x", sc );
+ T_assert_rsc_success( sc );
+
+ T_log( T_NORMAL, "Starting Worker..." );
+ sc = rtems_task_start( ctx->worker_id, Worker7, (rtems_task_argument) ctx );
+ T_log( T_NORMAL, "Started Worker, sc = %x", sc );
+ T_assert_rsc_success( sc );
+}
+
+
+static void RtemsModelEventsMgr_Setup_Wrap7( void *arg )
+{
+ RtemsModelEventsMgr_Context *ctx;
+
+ ctx = arg;
+ RtemsModelEventsMgr_Setup7( ctx );
+}
+
+
+static RtemsModelEventsMgr_Context RtemsModelEventsMgr_Instance7;
+
+static T_fixture RtemsModelEventsMgr_Fixture7 = {
+ .setup = RtemsModelEventsMgr_Setup_Wrap7,
+ .stop = NULL,
+ .teardown = RtemsModelEventsMgr_Teardown_Wrap,
+ .scope = RtemsModelEventsMgr_Scope,
+ .initial_context = &RtemsModelEventsMgr_Instance7
+};
+
+static T_fixture_node RtemsModelEventsMgr_Node7;
+
+void RtemsModelEventsMgr_Run7(
+ rtems_status_code ( *send )( rtems_id, rtems_event_set ),
+ rtems_status_code ( *receive )( rtems_event_set, rtems_option, rtems_interval, rtems_event_set * ),
+ rtems_event_set ( *get_pending_events )( Thread_Control * ),
+ unsigned int wait_class,
+ int waiting_for_event
+)
+{
+ RtemsModelEventsMgr_Context *ctx;
+
+ T_set_verbosity( T_NORMAL );
+
+ T_log( T_NORMAL, "Runner Invoked" );
+ T_log( T_NORMAL, "Runner Wait Class: %d", wait_class );
+ T_log( T_NORMAL, "Runner WaitForEvent: %d", waiting_for_event );
+
+ T_log( T_NORMAL, "Pushing Test Fixture..." );
+
+
+ ctx = T_push_fixture(
+ &RtemsModelEventsMgr_Node7,
+ &RtemsModelEventsMgr_Fixture7
+ );
+ // This runs RtemsModelEventsMgr_Fixture
+
+ T_log( T_NORMAL, "Test Fixture Pushed" );
+
+
+ ctx->send = send;
+ ctx->receive = receive;
+ ctx->get_pending_events = get_pending_events;
+ ctx->wait_class = wait_class;
+ ctx->waiting_for_event = waiting_for_event;
+
+ ctx->this_test_number = 7;
+
+ // RtemsModelEventsMgr_Prepare( ctx );
+ ctx->events_to_send = 0;
+ ctx->send_status = RTEMS_INCORRECT_STATE;
+ ctx->received_events = 0xffffffff;
+ ctx->receive_option_set = 0;
+ ctx->receive_timeout = RTEMS_NO_TIMEOUT;
+ ctx->unsatisfied_pending = 0xffffffff;
+ memset( &ctx->thread_switch_log, 0, sizeof( ctx->thread_switch_log ) );
+ T_eq_u32( GetPending( ctx ), 0 );
+ _Thread_Wait_flags_set( ctx->runner_thread, THREAD_WAIT_FLAGS_INITIAL );
+
+ TestSegment0( ctx );
+
+ Runner( ctx );
+
+ RtemsModelEventsMgr_Cleanup( ctx );
+
+ T_log( T_NORMAL, "Run Pop Fixture" );
+ ShowWorkerSemaId( ctx );
+ T_pop_fixture();
+ ShowWorkerSemaId( ctx );
+}
+
+/** @} */
diff --git a/testsuites/validation/tr-model-events-mgr-8.c b/testsuites/validation/tr-model-events-mgr-8.c
new file mode 100644
index 0000000000..23183cff79
--- /dev/null
+++ b/testsuites/validation/tr-model-events-mgr-8.c
@@ -0,0 +1,375 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseRtemsModelEventsMgr
+ */
+
+/*
+ * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ * Trinity College Dublin (http://www.tcd.ie)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This file was automatically generated. Do not edit it manually.
+ * Please have a look at
+ *
+ * https://docs.rtems.org/branches/master/eng/req/howto.html
+ *
+ * for information how to maintain and re-generate this file.
+ */
+
+#ifndef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/score/threadimpl.h>
+
+
+#include "tr-model-events-mgr.h"
+
+// ===============================================
+
+// @@@ 0 NAME Event_Manager_TestGen
+// @@@ 0 DEF NO_OF_EVENTS 4
+#define NO_OF_EVENTS 4
+// @@@ 0 DEF EVTS_NONE 0
+#define EVTS_NONE 0
+// @@@ 0 DEF EVTS_PENDING 0
+#define EVTS_PENDING 0
+// @@@ 0 DEF EVT_0 1
+#define EVT_0 1
+// @@@ 0 DEF EVT_1 2
+#define EVT_1 2
+// @@@ 0 DEF EVT_2 4
+#define EVT_2 4
+// @@@ 0 DEF EVT_3 8
+#define EVT_3 8
+// @@@ 0 DEF NO_TIMEOUT 0
+#define NO_TIMEOUT 0
+// @@@ 0 DEF TASK_MAX 3
+#define TASK_MAX 3
+// @@@ 0 DEF BAD_ID 3
+#define BAD_ID 3
+// @@@ 0 DEF SEMA_MAX 2
+#define SEMA_MAX 2
+// @@@ 0 DEF RC_OK RTEMS_SUCCESSFUL
+#define RC_OK RTEMS_SUCCESSFUL
+// @@@ 0 DEF RC_InvId RTEMS_INVALID_ID
+#define RC_InvId RTEMS_INVALID_ID
+// @@@ 0 DEF RC_InvAddr RTEMS_INVALID_ADDRESS
+#define RC_InvAddr RTEMS_INVALID_ADDRESS
+// @@@ 0 DEF RC_Unsat RTEMS_UNSATISFIED
+#define RC_Unsat RTEMS_UNSATISFIED
+// @@@ 0 DEF RC_Timeout RTEMS_TIMEOUT
+#define RC_Timeout RTEMS_TIMEOUT
+// @@@ 0 DECL byte sendrc 0
+static rtems_status_code sendrc = 0;
+// @@@ 0 DECL byte recrc 0
+static rtems_status_code recrc = 0;
+// @@@ 0 DCLARRAY EvtSet pending TASK_MAX
+static rtems_event_set pending[TASK_MAX];
+// @@@ 0 DCLARRAY byte recout TASK_MAX
+static rtems_event_set recout[TASK_MAX];
+// @@@ 0 DCLARRAY Semaphore semaphore SEMA_MAX
+static rtems_id semaphore[SEMA_MAX];
+
+// ===== TEST CODE SEGMENT 0 =====
+
+static void TestSegment0( Context* ctx ) {
+ /* Test Name is defined in the Test Case code (tc-model-events-mgr.c) */
+
+ T_log(T_NORMAL,"@@@ 0 INIT");
+ initialise_pending( pending, TASK_MAX );
+ initialise_semaphore( ctx, semaphore );
+
+}
+
+// ===== TEST CODE SEGMENT 3 =====
+
+static void TestSegment3( Context* ctx ) {
+ T_log(T_NORMAL,"@@@ 3 TASK Worker");
+ checkTaskIs( ctx->worker_id );
+
+ T_log(T_NORMAL,"@@@ 3 CALL SetProcessor 1");
+ T_eq_u32( rtems_scheduler_get_processor_maximum(), 2 );
+ uint32_t processor = 1;
+ cpu_set_t cpuset;
+ CPU_ZERO(&cpuset);
+ CPU_SET(processor, &cpuset);
+
+ T_log(T_NORMAL,"@@@ 3 CALL EqualPriority");
+ SetSelfPriority( PRIO_NORMAL );
+ rtems_task_priority prio;
+ rtems_status_code sc;
+ sc = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio );
+ T_rsc_success( sc );
+ T_eq_u32( prio, PRIO_NORMAL );
+
+ T_log(T_NORMAL,"@@@ 3 WAIT 0");
+ Wait( semaphore[0] );
+
+ T_log(T_NORMAL,"@@@ 3 CALL StartLog");
+ T_thread_switch_log *log;
+ log = T_thread_switch_record_4( &ctx->thread_switch_log );
+
+ T_log(T_NORMAL,"@@@ 3 CALL event_send 1 2 10 sendrc");
+ T_log( T_NORMAL, "Calling Send(%d,%d)", mapid( ctx, 2), 10 );
+ sendrc = ( *ctx->send )( mapid( ctx, 2 ), 10 );
+ T_log( T_NORMAL, "Returned 0x%x from Send", sendrc );
+
+ T_log(T_NORMAL,"@@@ 3 CALL CheckNoPreemption");
+ log = &ctx->thread_switch_log;
+ T_le_sz( log->header.recorded, 1 );
+ for ( size_t i = 0; i < log->header.recorded; ++i ) {
+ T_ne_u32( log->events[ i ].executing, ctx->worker_id );
+ T_eq_u32( log->events[ i ].heir, ctx->runner_id );
+ }
+
+ T_log(T_NORMAL,"@@@ 3 SCALAR sendrc 0");
+ T_rsc( sendrc, 0 );
+ T_log(T_NORMAL,"@@@ 3 SIGNAL 1");
+ Wakeup( semaphore[1] );
+
+ T_log(T_NORMAL,"@@@ 3 STATE 1 Zombie");
+ /* Code to check that Task 1 has terminated */
+}
+
+// ===== TEST CODE SEGMENT 4 =====
+
+static void TestSegment4( Context* ctx ) {
+ T_log(T_NORMAL,"@@@ 4 TASK Runner");
+ checkTaskIs( ctx->runner_id );
+
+ T_log(T_NORMAL,"@@@ 4 CALL SetProcessor 0");
+ T_eq_u32( rtems_scheduler_get_processor_maximum(), 2 );
+ uint32_t processor = 0;
+ cpu_set_t cpuset;
+ CPU_ZERO(&cpuset);
+ CPU_SET(processor, &cpuset);
+
+ T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
+ Wakeup( semaphore[0] );
+
+ T_log(T_NORMAL,"@@@ 4 WAIT 1");
+ Wait( semaphore[1] );
+
+ T_log(T_NORMAL,"@@@ 4 SCALAR pending 2 10");
+ pending[2] = GetPending( ctx );
+ T_eq_int( pending[2], 10 );
+
+ T_log(T_NORMAL,"@@@ 4 CALL event_receive 10 1 1 0 2 recrc");
+ T_log( T_NORMAL, "Calling Receive(%d,%d,%d,%d)", 10, mergeopts( 1, 1 ) ,0 , 2 ? &recout[2] : NULL );
+ recrc = ( *ctx->receive )( 10, mergeopts( 1, 1 ), 0, 2 ? &recout[2] : NULL );
+ T_log( T_NORMAL, "Returned 0x%x from Receive", recrc );
+
+ T_log(T_NORMAL,"@@@ 4 SCALAR recrc 0");
+ T_rsc( recrc, 0 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR recout 2 10");
+ T_eq_int( recout[2], 10 );
+ T_log(T_NORMAL,"@@@ 4 SCALAR pending 2 0");
+ pending[2] = GetPending( ctx );
+ T_eq_int( pending[2], 0 );
+
+ T_log(T_NORMAL,"@@@ 4 SIGNAL 0");
+ Wakeup( semaphore[0] );
+
+ T_log(T_NORMAL,"@@@ 4 STATE 2 Zombie");
+ /* Code to check that Task 2 has terminated */
+}
+
+// ===============================================
+
+
+
+static void Runner( RtemsModelEventsMgr_Context *ctx )
+{
+ T_log( T_NORMAL, "Runner running" );
+ TestSegment4( ctx );
+ T_log( T_NORMAL, "Runner finished" );
+}
+
+static void Worker8( rtems_task_argument arg )
+{
+ Context *ctx;
+ rtems_event_set events;
+
+ ctx = (Context *) arg;
+
+ T_log( T_NORMAL, "Worker Running" );
+ TestSegment3( ctx );
+ T_log( T_NORMAL, "Worker finished" );
+
+ // (void) rtems_task_suspend( RTEMS_SELF );
+ // Ensure we hold no semaphores
+ Wakeup( ctx->worker_wakeup );
+ Wakeup( ctx->runner_wakeup );
+ // Wait for events so we don't terminate
+ rtems_event_receive( RTEMS_ALL_EVENTS, RTEMS_DEFAULT_OPTIONS, 0, &events );
+
+}
+
+RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) static char WorkerStorage8[
+ RTEMS_TASK_STORAGE_SIZE(
+ MAX_TLS_SIZE + RTEMS_MINIMUM_STACK_SIZE,
+ WORKER_ATTRIBUTES
+ )
+];
+
+static const rtems_task_config WorkerConfig8 = {
+ .name = rtems_build_name( 'W', 'O', 'R', 'K' ),
+ .initial_priority = PRIO_LOW,
+ .storage_area = WorkerStorage8,
+ .storage_size = sizeof( WorkerStorage8 ),
+ .maximum_thread_local_storage_size = MAX_TLS_SIZE,
+ .initial_modes = RTEMS_DEFAULT_MODES,
+ .attributes = WORKER_ATTRIBUTES
+};
+
+
+static void RtemsModelEventsMgr_Setup8(
+ RtemsModelEventsMgr_Context *ctx
+)
+{
+ rtems_status_code sc;
+ rtems_task_priority prio;
+
+ T_log( T_NORMAL, "Runner Setup" );
+
+ memset( ctx, 0, sizeof( *ctx ) );
+ ctx->runner_thread = _Thread_Get_executing();
+ ctx->runner_id = ctx->runner_thread->Object.id;
+
+ T_log( T_NORMAL, "Creating Worker Wakeup Semaphore" );
+ ctx->worker_wakeup = CreateWakeupSema();
+ T_log( T_NORMAL, "Creating Runner Wakeup Semaphore" );
+ ctx->runner_wakeup = CreateWakeupSema();
+
+ sc = rtems_task_get_scheduler( RTEMS_SELF, &ctx->runner_sched );
+ T_rsc_success( sc );
+
+ #if defined(RTEMS_SMP)
+ sc = rtems_scheduler_ident_by_processor( 1, &ctx->other_sched );
+ T_rsc_success( sc );
+ T_ne_u32( ctx->runner_sched, ctx->other_sched );
+ #endif
+
+ prio = 0;
+ sc = rtems_task_set_priority( RTEMS_SELF, PRIO_NORMAL, &prio );
+ T_rsc_success( sc );
+ T_eq_u32( prio, PRIO_HIGH );
+
+ sc = rtems_task_construct( &WorkerConfig8, &ctx->worker_id );
+ T_log( T_NORMAL, "Construct Worker, sc = %x", sc );
+ T_assert_rsc_success( sc );
+
+ T_log( T_NORMAL, "Starting Worker..." );
+ sc = rtems_task_start( ctx->worker_id, Worker8, (rtems_task_argument) ctx );
+ T_log( T_NORMAL, "Started Worker, sc = %x", sc );
+ T_assert_rsc_success( sc );
+}
+
+
+static void RtemsModelEventsMgr_Setup_Wrap8( void *arg )
+{
+ RtemsModelEventsMgr_Context *ctx;
+
+ ctx = arg;
+ RtemsModelEventsMgr_Setup8( ctx );
+}
+
+
+static RtemsModelEventsMgr_Context RtemsModelEventsMgr_Instance8;
+
+static T_fixture RtemsModelEventsMgr_Fixture8 = {
+ .setup = RtemsModelEventsMgr_Setup_Wrap8,
+ .stop = NULL,
+ .teardown = RtemsModelEventsMgr_Teardown_Wrap,
+ .scope = RtemsModelEventsMgr_Scope,
+ .initial_context = &RtemsModelEventsMgr_Instance8
+};
+
+static T_fixture_node RtemsModelEventsMgr_Node8;
+
+void RtemsModelEventsMgr_Run8(
+ rtems_status_code ( *send )( rtems_id, rtems_event_set ),
+ rtems_status_code ( *receive )( rtems_event_set, rtems_option, rtems_interval, rtems_event_set * ),
+ rtems_event_set ( *get_pending_events )( Thread_Control * ),
+ unsigned int wait_class,
+ int waiting_for_event
+)
+{
+ RtemsModelEventsMgr_Context *ctx;
+
+ T_set_verbosity( T_NORMAL );
+
+ T_log( T_NORMAL, "Runner Invoked" );
+ T_log( T_NORMAL, "Runner Wait Class: %d", wait_class );
+ T_log( T_NORMAL, "Runner WaitForEvent: %d", waiting_for_event );
+
+ T_log( T_NORMAL, "Pushing Test Fixture..." );
+
+
+ ctx = T_push_fixture(
+ &RtemsModelEventsMgr_Node8,
+ &RtemsModelEventsMgr_Fixture8
+ );
+ // This runs RtemsModelEventsMgr_Fixture
+
+ T_log( T_NORMAL, "Test Fixture Pushed" );
+
+
+ ctx->send = send;
+ ctx->receive = receive;
+ ctx->get_pending_events = get_pending_events;
+ ctx->wait_class = wait_class;
+ ctx->waiting_for_event = waiting_for_event;
+
+ ctx->this_test_number = 8;
+
+ // RtemsModelEventsMgr_Prepare( ctx );
+ ctx->events_to_send = 0;
+ ctx->send_status = RTEMS_INCORRECT_STATE;
+ ctx->received_events = 0xffffffff;
+ ctx->receive_option_set = 0;
+ ctx->receive_timeout = RTEMS_NO_TIMEOUT;
+ ctx->unsatisfied_pending = 0xffffffff;
+ memset( &ctx->thread_switch_log, 0, sizeof( ctx->thread_switch_log ) );
+ T_eq_u32( GetPending( ctx ), 0 );
+ _Thread_Wait_flags_set( ctx->runner_thread, THREAD_WAIT_FLAGS_INITIAL );
+
+ TestSegment0( ctx );
+
+ Runner( ctx );
+
+ RtemsModelEventsMgr_Cleanup( ctx );
+
+ T_log( T_NORMAL, "Run Pop Fixture" );
+ ShowWorkerSemaId( ctx );
+ T_pop_fixture();
+ ShowWorkerSemaId( ctx );
+}
+
+/** @} */
diff --git a/testsuites/validation/tr-model-events-mgr.c b/testsuites/validation/tr-model-events-mgr.c
index 77a5d1a977..1c2cadc75e 100644
--- a/testsuites/validation/tr-model-events-mgr.c
+++ b/testsuites/validation/tr-model-events-mgr.c
@@ -135,8 +135,8 @@ rtems_id mapid( Context *ctx, int pid )
rtems_id mapped_id;
switch ( pid ) {
- case 0 : mapped_id = ctx->worker_id ; break;
- case 1 : mapped_id = ctx->runner_id; break;
+ case 1 : mapped_id = ctx->worker_id ; break;
+ case 2 : mapped_id = ctx->runner_id; break;
default : mapped_id = 0xffffffff; break;
}
return mapped_id;
@@ -165,6 +165,13 @@ void initialise_semaphore( Context *ctx, rtems_id semaphore[] )
semaphore[1] = ctx->runner_wakeup;
}
+void ShowWorkerSemaId( Context *ctx ) {
+ T_printf( "L:ctx->worker_wakeup = %d\n", ctx->worker_wakeup );
+}
+
+void ShowRunnerSemaId( Context *ctx ) {
+ T_printf( "L:ctx->runner_wakeup = %d\n", ctx->runner_wakeup );
+}
static void RtemsModelEventsMgr_Teardown(
RtemsModelEventsMgr_Context *ctx
@@ -181,11 +188,14 @@ static void RtemsModelEventsMgr_Teardown(
T_eq_u32( prio, PRIO_NORMAL );
if ( ctx->worker_id != 0 ) {
+ T_printf( "L:Deleting Task id : %d\n", ctx->worker_id );
sc = rtems_task_delete( ctx->worker_id );
T_rsc_success( sc );
}
+ T_log( T_NORMAL, "Deleting Worker Wakeup Semaphore" );
DeleteWakeupSema( ctx->worker_wakeup );
+ T_log( T_NORMAL, "Deleting Runner Wakeup Semaphore" );
DeleteWakeupSema( ctx->runner_wakeup );
}
diff --git a/testsuites/validation/tr-model-events-mgr.h b/testsuites/validation/tr-model-events-mgr.h
index 8d7712457a..b2b2e57741 100644
--- a/testsuites/validation/tr-model-events-mgr.h
+++ b/testsuites/validation/tr-model-events-mgr.h
@@ -126,10 +126,15 @@ void checkTaskIs( rtems_id expected_id ) ;
void initialise_pending( rtems_event_set pending[], int max );
+void ShowWorkerSemaId( Context *ctx ) ;
+
+void ShowRunnerSemaId( Context *ctx ) ;
+
void initialise_semaphore( Context *ctx, rtems_id semaphore[] );
void RtemsModelEventsMgr_Setup_Wrap( void *arg ) ;
+
void RtemsModelEventsMgr_Teardown_Wrap( void *arg ) ;
size_t RtemsModelEventsMgr_Scope( void *arg, char *buf, size_t n ) ;
@@ -182,6 +187,46 @@ void RtemsModelEventsMgr_Run3(
int waiting_for_event
);
+void RtemsModelEventsMgr_Run4(
+ rtems_status_code ( *send )( rtems_id, rtems_event_set ),
+ rtems_status_code ( *receive )( rtems_event_set, rtems_option, rtems_interval, rtems_event_set * ),
+ rtems_event_set ( *get_pending_events )( Thread_Control * ),
+ unsigned int wait_class,
+ int waiting_for_event
+);
+
+void RtemsModelEventsMgr_Run5(
+ rtems_status_code ( *send )( rtems_id, rtems_event_set ),
+ rtems_status_code ( *receive )( rtems_event_set, rtems_option, rtems_interval, rtems_event_set * ),
+ rtems_event_set ( *get_pending_events )( Thread_Control * ),
+ unsigned int wait_class,
+ int waiting_for_event
+);
+
+void RtemsModelEventsMgr_Run6(
+ rtems_status_code ( *send )( rtems_id, rtems_event_set ),
+ rtems_status_code ( *receive )( rtems_event_set, rtems_option, rtems_interval, rtems_event_set * ),
+ rtems_event_set ( *get_pending_events )( Thread_Control * ),
+ unsigned int wait_class,
+ int waiting_for_event
+);
+
+void RtemsModelEventsMgr_Run7(
+ rtems_status_code ( *send )( rtems_id, rtems_event_set ),
+ rtems_status_code ( *receive )( rtems_event_set, rtems_option, rtems_interval, rtems_event_set * ),
+ rtems_event_set ( *get_pending_events )( Thread_Control * ),
+ unsigned int wait_class,
+ int waiting_for_event
+);
+
+void RtemsModelEventsMgr_Run8(
+ rtems_status_code ( *send )( rtems_id, rtems_event_set ),
+ rtems_status_code ( *receive )( rtems_event_set, rtems_option, rtems_interval, rtems_event_set * ),
+ rtems_event_set ( *get_pending_events )( Thread_Control * ),
+ unsigned int wait_class,
+ int waiting_for_event
+);
+
#ifdef __cplusplus
}
#endif