Skip to content

Commit cfadad6

Browse files
authored
Merge pull request #1759 from nasa/integration-candidate
cFE Integration candidate: 2021-08-03
2 parents c4ae5b2 + 36ae395 commit cfadad6

File tree

15 files changed

+348
-21
lines changed

15 files changed

+348
-21
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob
1010

1111
## Version History
1212

13+
### Development Build: v6.8.0-rc1+dev810
14+
15+
- Add null pointer check to table GetAddresses and ReleaseAddresses
16+
- Explain FS Header offset & add offset functional tests.
17+
- Handle fail status in GetTypeFromMsgId
18+
- Add Functional Test for EVS Send Event API
19+
- Remove SB get last message sender info requirement
20+
- Update UTs to use UtAssert_MIR
21+
- Add Functional Tests cFE Message ID
22+
- Add Time Conversion Functional Test
23+
- See <https://github.com/nasa/cFE/pull/1759> and <https://github.com/nasa/cFS/pull/328>
24+
1325
### Development Build: v6.8.0-rc1+dev789
1426

1527
- Correct return code check

docs/cFE_FunctionalRequirements.csv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ SB: Receive Message No Timeout,cSB4306,"Upon receipt of a Request to receive a S
350350
SB: Receive Message With Timeout,cSB4307,"Upon receipt of a Request to receive a SB Message from a Pipe with a pending timeout, the cFE shall suspend execution of the Application until a SB Message is present on the Pipe or the timeout has expired.","A receive Request with a suspension timeout provides a blocking method of retrieving SB messages. This is useful for data driven Applications and has been used on all heritage missions with a SB. The timeout is useful for fault recovery for Applications that always expect data to arrive or to allow periodic processing for Applications that are not purely data driven. If a SB Message is queued on the Pipe then the SB Message will be provided to the Application and the Application’s execution will not be suspended. Tasks that process telemetry packets often receive many types of packets from different sources. There should be a mechanism that allows a task to wait for many different types of messages simultaneously. Heritage implementations of SB do this by directing the messages into one queue (or several queues, to implement priority levels).
351351
"
352352
SB: Receive Message Infinite Timeout,cSB4308,"Upon receipt of a Request to receive a SB Message from a Pipe with an infinite timeout, the cFE shall suspend execution of the Application until a SB Message is present on the Pipe.",This mode of receiving has been the most commonly used mode on the heritage SB.
353-
SB: Last Message Sender Info,cSB4309,"Upon receipt of a Request, the cFE shall provide sender information for the last message received on an Application's Pipe.","Heritage SB did a 'valid senders check' before delivering a packet to a pipe. Since the cFE supports a dynamic environment and the sender of a packet is somewhat unknown, the cFE must provide a means for the application to do the 'valid sender check'."
354353
SB: Get Message ID,cSB4311,"Upon receipt of a Request, the cFE shall provide the message ID of the requested message.",Message management utility.
355354
SB: Set Message ID,cSB4312,"Upon receipt of a Request, the cFE shall set the received message with the received message ID.",Message management utility.
356355
SB: Get Message String,cSB4313,"Upon receipt of a Request, the cFE shall provide the requested string from the requested message.",Message management utility.

modules/cfe_testcase/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ add_cfe_app(cfe_testcase
77
src/es_cds_test.c
88
src/es_misc_test.c
99
src/es_mempool_test.c
10+
src/evs_send_test.c
1011
src/fs_header_test.c
1112
src/fs_util_test.c
13+
src/message_id_test.c
1214
src/sb_pipe_mang_test.c
1315
src/time_arithmetic_test.c
1416
src/time_current_test.c
17+
src/time_conversion_test.c
1518
)
1619

1720
# register the dependency on cfe_assert

modules/cfe_testcase/src/cfe_test.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,14 @@ void CFE_TestMain(void)
5656
ESMemPoolTestSetup();
5757
ESMiscTestSetup();
5858
ESTaskTestSetup();
59+
EVSSendTestSetup();
5960
FSHeaderTestSetup();
6061
FSUtilTestSetup();
62+
MessageIdTestSetup();
6163
SBPipeMangSetup();
6264
TimeArithmeticTestSetup();
6365
TimeCurrentTestSetup();
66+
TimeConversionTestSetup();
6467

6568
/*
6669
* Execute the tests

modules/cfe_testcase/src/cfe_test.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,21 @@ typedef struct
7777
/* Log calls to void functions */
7878
#define cFE_FTAssert_VOIDCALL(func) (func, UtAssert(true, #func, __FILE__, __LINE__))
7979

80+
bool TimeInRange(CFE_TIME_SysTime_t Time, CFE_TIME_SysTime_t Target, OS_time_t difference);
81+
8082
void CFE_TestMain(void);
8183
void ESCDSTestSetup(void);
8284
void ESInfoTestSetup(void);
8385
void ESMemPoolTestSetup(void);
8486
void ESMiscTestSetup(void);
8587
void ESTaskTestSetup(void);
88+
void EVSSendTestSetup(void);
8689
void FSHeaderTestSetup(void);
8790
void FSUtilTestSetup(void);
91+
void MessageIdTestSetup(void);
8892
void SBPipeMangSetup(void);
8993
void TimeArithmeticTestSetup(void);
9094
void TimeCurrentTestSetup(void);
95+
void TimeConversionTestSetup(void);
9196

9297
#endif /* CFE_TEST_H */

modules/cfe_testcase/src/es_misc_test.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ void TestWriteToSysLog(void)
6464
CFE_ES_WriteToSysLog(NULL);
6565
CFE_ES_WriteToSysLog("%s", TestString);
6666

67-
UtAssertEx(false, UTASSERT_CASETYPE_MIR, __FILE__, __LINE__, "%s",
68-
"MIR (Manual Inspection Required) for CFE_ES_WriteToSysLog");
67+
UtAssert_MIR("MIR (Manual Inspection Required) for CFE_ES_WriteToSysLog");
6968
}
7069

7170
void ESMiscTestSetup(void)
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*************************************************************************
2+
**
3+
** GSC-18128-1, "Core Flight Executive Version 6.7"
4+
**
5+
** Copyright (c) 2006-2019 United States Government as represented by
6+
** the Administrator of the National Aeronautics and Space Administration.
7+
** All Rights Reserved.
8+
**
9+
** Licensed under the Apache License, Version 2.0 (the "License");
10+
** you may not use this file except in compliance with the License.
11+
** You may obtain a copy of the License at
12+
**
13+
** http://www.apache.org/licenses/LICENSE-2.0
14+
**
15+
** Unless required by applicable law or agreed to in writing, software
16+
** distributed under the License is distributed on an "AS IS" BASIS,
17+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
** See the License for the specific language governing permissions and
19+
** limitations under the License.
20+
**
21+
** File: evs_send_test.c
22+
**
23+
** Purpose:
24+
** Functional test of basic EVS Send Event APIs
25+
**
26+
** Demonstration of how to register and use the UT assert functions.
27+
**
28+
*************************************************************************/
29+
30+
/*
31+
* Includes
32+
*/
33+
34+
#include "cfe_test.h"
35+
36+
void TestSendEvent(void)
37+
{
38+
UtPrintf("Testing: CFE_EVS_SendEvent");
39+
40+
UtAssert_INT32_EQ(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "OK Send"), CFE_SUCCESS);
41+
UtAssert_INT32_EQ(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, NULL), CFE_EVS_INVALID_PARAMETER);
42+
}
43+
44+
void TestSendEventAppID(void)
45+
{
46+
CFE_ES_AppId_t AppId;
47+
48+
UtPrintf("Testing: CFE_EVS_SendEventWithAppID");
49+
50+
CFE_ES_GetAppID(&AppId);
51+
52+
UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, AppId, "OK App ID"), CFE_SUCCESS);
53+
54+
UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, AppId, NULL),
55+
CFE_EVS_INVALID_PARAMETER);
56+
UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, CFE_ES_APPID_UNDEFINED, "OK"),
57+
CFE_EVS_APP_ILLEGAL_APP_ID);
58+
}
59+
60+
void TestSendTimedEvent(void)
61+
{
62+
CFE_TIME_SysTime_t Time = {1000, 1000};
63+
UtPrintf("Testing: CFE_EVS_SendTimedEvent");
64+
65+
UtAssert_INT32_EQ(CFE_EVS_SendTimedEvent(Time, 0, CFE_EVS_EventType_INFORMATION, "OK Time"), CFE_SUCCESS);
66+
UtAssert_INT32_EQ(CFE_EVS_SendTimedEvent(Time, 0, CFE_EVS_EventType_INFORMATION, NULL), CFE_EVS_INVALID_PARAMETER);
67+
}
68+
69+
void EVSSendTestSetup(void)
70+
{
71+
UtTest_Add(TestSendEvent, NULL, NULL, "Test Send Event");
72+
UtTest_Add(TestSendEventAppID, NULL, NULL, "Test Send Event with App ID");
73+
UtTest_Add(TestSendTimedEvent, NULL, NULL, "Test Send Timed Event");
74+
}

modules/cfe_testcase/src/fs_header_test.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ void TestCreateHeader(void)
5656

5757
cFE_FTAssert_VOIDCALL(CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG));
5858
UtAssert_INT32_EQ(CFE_FS_WriteHeader(fd, &Header), sizeof(CFE_FS_Header_t));
59+
UtAssert_INT32_EQ(OS_lseek(fd, 0, OS_SEEK_CUR), sizeof(CFE_FS_Header_t));
5960

6061
UtAssert_INT32_EQ(CFE_FS_WriteHeader(fd, NULL), CFE_FS_BAD_ARGUMENT);
6162
cFE_FTAssert_NOT_CFE_SUCCESS(CFE_FS_WriteHeader(OS_OBJECT_ID_UNDEFINED, &Header));
@@ -80,6 +81,7 @@ void TestReadHeader(void)
8081
cFE_FTAssert_VOIDCALL(CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG));
8182
UtAssert_INT32_EQ(CFE_FS_WriteHeader(fd, &Header), sizeof(CFE_FS_Header_t));
8283
UtAssert_INT32_EQ(CFE_FS_ReadHeader(&ReadHeader, fd), sizeof(CFE_FS_Header_t));
84+
UtAssert_INT32_EQ(OS_lseek(fd, 0, OS_SEEK_CUR), sizeof(CFE_FS_Header_t));
8385

8486
UtAssert_INT32_EQ(Header.ContentType, ReadHeader.ContentType);
8587
UtAssert_INT32_EQ(Header.SubType, ReadHeader.SubType);
@@ -105,6 +107,8 @@ void TestTimeStamp(void)
105107
cFE_FTAssert_VOIDCALL(CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG));
106108
UtAssert_INT32_EQ(CFE_FS_WriteHeader(fd, &Header), sizeof(CFE_FS_Header_t));
107109
UtAssert_INT32_EQ(CFE_FS_SetTimestamp(fd, NewTimestamp), CFE_SUCCESS);
110+
UtAssert_INT32_EQ(OS_lseek(fd, 0, OS_SEEK_CUR), (offsetof(CFE_FS_Header_t, TimeSeconds) + sizeof(NewTimestamp)));
111+
108112
UtAssert_INT32_EQ(CFE_FS_ReadHeader(&ReadHeader, fd), sizeof(CFE_FS_Header_t));
109113

110114
UtAssert_UINT32_EQ(0xFFFFFFFF, ReadHeader.TimeSeconds);
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*************************************************************************
2+
**
3+
** GSC-18128-1, "Core Flight Executive Version 6.7"
4+
**
5+
** Copyright (c) 2006-2019 United States Government as represented by
6+
** the Administrator of the National Aeronautics and Space Administration.
7+
** All Rights Reserved.
8+
**
9+
** Licensed under the Apache License, Version 2.0 (the "License");
10+
** you may not use this file except in compliance with the License.
11+
** You may obtain a copy of the License at
12+
**
13+
** http://www.apache.org/licenses/LICENSE-2.0
14+
**
15+
** Unless required by applicable law or agreed to in writing, software
16+
** distributed under the License is distributed on an "AS IS" BASIS,
17+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
** See the License for the specific language governing permissions and
19+
** limitations under the License.
20+
**
21+
** File: message_id_test.c
22+
**
23+
** Purpose:
24+
** Functional test of Message ID APIs
25+
**
26+
** Demonstration....
27+
**
28+
*************************************************************************/
29+
30+
/*
31+
* Includes
32+
*/
33+
34+
#include "cfe_test.h"
35+
36+
void TestMsgId(void)
37+
{
38+
UtPrintf("Testing: CFE_MSG_SetMsgId, CFE_MSG_GetMsgId");
39+
CFE_MSG_Message_t msg;
40+
CFE_SB_MsgId_t msgid;
41+
CFE_SB_MsgId_t expectedmsgid = CFE_SB_ValueToMsgId(1);
42+
43+
UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, expectedmsgid), CFE_SUCCESS);
44+
UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS);
45+
UtAssert_UINT32_EQ(msgid, expectedmsgid);
46+
47+
UtAssert_INT32_EQ(CFE_MSG_SetMsgId(NULL, msgid), CFE_MSG_BAD_ARGUMENT);
48+
UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, CFE_SB_INVALID_MSG_ID), CFE_MSG_BAD_ARGUMENT);
49+
50+
UtAssert_INT32_EQ(CFE_MSG_GetMsgId(NULL, &msgid), CFE_MSG_BAD_ARGUMENT);
51+
UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&msg, NULL), CFE_MSG_BAD_ARGUMENT);
52+
}
53+
54+
void TestGetTypeFromMsgId(void)
55+
{
56+
UtPrintf("Testing: CFE_MSG_GetTypeFromMsgId");
57+
CFE_SB_MsgId_t msgid = CFE_SB_ValueToMsgId(0);
58+
CFE_MSG_Type_t msgtype;
59+
int32 status;
60+
61+
/*
62+
* Response not verified because msgid 0 could be out of range based on implementation and
63+
* the msg to type relationship is also implementation defined, black box test just calls the routine
64+
* to confirm things don't "break" with full range values and the implementation exists.
65+
*/
66+
67+
status = CFE_MSG_GetTypeFromMsgId(msgid, &msgtype);
68+
UtAssert_True(status == CFE_SUCCESS || status == CFE_MSG_BAD_ARGUMENT, "CFE_MSG_GetTypeFromMsgId() == (%ld)",
69+
(long)status);
70+
71+
memset(&msgid, 0xFF, sizeof(msgid));
72+
status = CFE_MSG_GetTypeFromMsgId(msgid, &msgtype);
73+
UtAssert_True(status == CFE_SUCCESS || status == CFE_MSG_BAD_ARGUMENT, "CFE_MSG_GetTypeFromMsgId() == (%ld)",
74+
(long)status);
75+
76+
UtAssert_INT32_EQ(CFE_MSG_GetTypeFromMsgId(msgid, NULL), CFE_MSG_BAD_ARGUMENT);
77+
}
78+
79+
void MessageIdTestSetup(void)
80+
{
81+
UtTest_Add(TestMsgId, NULL, NULL, "Test Set/Get Message ID");
82+
UtTest_Add(TestGetTypeFromMsgId, NULL, NULL, "Test Get Type From Message ID");
83+
}

0 commit comments

Comments
 (0)