Skip to content

Commit

Permalink
Merge pull request #1967 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
cFE Integration candidate: 2021-09-21
  • Loading branch information
astrogeco authored Sep 22, 2021
2 parents 64a6a59 + 0352be0 commit 98f78e8
Show file tree
Hide file tree
Showing 25 changed files with 227 additions and 183 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob

## Version History

### Development Build: v6.8.0-rc1+dev1024

- CFE_Assert macro names
- Update msgid testcase to match implementation
- Single time domain in functional time tests
- Add missing inclusions in CFE API headers
- Use existing /ram for FS header test
- Add static local to function test so data section is nonzero
- Make invalid buffer length consistent in es task test
- Only check base filename in library info functional
- Confirm sb/time reset requirements in coverage test
- Avoid alias warning on some compilers
- Fix broken link in Application Developers Guide
- See <https://github.com/nasa/cFE/pull/1967> and <https://github.com/nasa/cFS/pull/359>

### Development Build: v6.8.0-rc1+dev994

- Update directory diagrams in cFE Application Developers Guide
Expand Down
2 changes: 1 addition & 1 deletion docs/cFE Application Developers Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Table of Contents
* [4.1.3 Multi-threaded Applications](#413-multi-threaded-applications)
* [4.2 Best Practices](#42-best-practices)
* [4.2.1 cFS Application Template](#421-cfs-application-template)
* [4.2.2 Avoid "Endian-ness" Dependencies](#422-avoid-endian-ess-dependencies)
* [4.2.2 Avoid "Endian-ness" Dependencies](#422-avoid-endian-ness-dependencies)
* [4.2.3 Avoid Inter-Task Dependencies](#423-avoid-inter-task-dependencies)
* [4.2.4 Consolidate Resource Allocations](#424-consolidate-resource-allocations)
* [5. Executive Services Interface](#5-executive-services-interface)
Expand Down
19 changes: 9 additions & 10 deletions modules/cfe_assert/inc/cfe_assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ typedef void (*CFE_Assert_StatusCallback_t)(uint8 MessageType, const char *Prefi
** None
**
******************************************************************************/
#define CFE_UtAssert_STATUS_OK(FN) \
CFE_UtAssert_StatusCheck(FN, true, UTASSERT_CASETYPE_FAILURE, __FILE__, __LINE__, #FN)
#define CFE_Assert_STATUS_OK(FN) CFE_Assert_StatusCheck(FN, true, UTASSERT_CASETYPE_FAILURE, __FILE__, __LINE__, #FN)

/*****************************************************************************/
/**
Expand All @@ -86,8 +85,8 @@ typedef void (*CFE_Assert_StatusCallback_t)(uint8 MessageType, const char *Prefi
** tests should check for that error instead of using this.
**
******************************************************************************/
#define CFE_UtAssert_STATUS_ERROR(FN) \
CFE_UtAssert_StatusCheck(FN, false, UTASSERT_CASETYPE_FAILURE, __FILE__, __LINE__, #FN)
#define CFE_Assert_STATUS_ERROR(FN) \
CFE_Assert_StatusCheck(FN, false, UTASSERT_CASETYPE_FAILURE, __FILE__, __LINE__, #FN)

/*****************************************************************************/
/**
Expand All @@ -101,7 +100,7 @@ typedef void (*CFE_Assert_StatusCallback_t)(uint8 MessageType, const char *Prefi
** and integers may not be interchangeable with strict type checking.
**
******************************************************************************/
#define CFE_UtAssert_RESOURCEID_EQ(id1, id2) \
#define CFE_Assert_RESOURCEID_EQ(id1, id2) \
UtAssert_GenericUnsignedCompare(CFE_RESOURCEID_TO_ULONG(id1), UtAssert_Compare_EQ, CFE_RESOURCEID_TO_ULONG(id2), \
UtAssert_Radix_HEX, __FILE__, __LINE__, "Resource ID Check: ", #id1, #id2)

Expand All @@ -117,7 +116,7 @@ typedef void (*CFE_Assert_StatusCallback_t)(uint8 MessageType, const char *Prefi
** set of undefined IDs is more than the single value of CFE_RESOURCEID_UNDEFINED.
**
******************************************************************************/
#define CFE_UtAssert_RESOURCEID_UNDEFINED(id) \
#define CFE_Assert_RESOURCEID_UNDEFINED(id) \
UtAssert_True(!CFE_RESOURCEID_TEST_DEFINED(id), "%s (0x%lx) not defined", #id, CFE_RESOURCEID_TO_ULONG(id))

/*****************************************************************************/
Expand All @@ -131,7 +130,7 @@ typedef void (*CFE_Assert_StatusCallback_t)(uint8 MessageType, const char *Prefi
** This is a simple unsigned comparison which logs the values as hexadecimal
**
******************************************************************************/
#define CFE_UtAssert_MEMOFFSET_EQ(off1, off2) \
#define CFE_Assert_MEMOFFSET_EQ(off1, off2) \
UtAssert_GenericUnsignedCompare(off1, UtAssert_Compare_EQ, off2, UtAssert_Radix_HEX, __FILE__, __LINE__, \
"Offset Check: ", #off1, #off2)

Expand All @@ -147,7 +146,7 @@ typedef void (*CFE_Assert_StatusCallback_t)(uint8 MessageType, const char *Prefi
** and integers may not be interchangeable with strict type checking.
**
******************************************************************************/
#define CFE_UtAssert_MSGID_EQ(mid1, mid2) \
#define CFE_Assert_MSGID_EQ(mid1, mid2) \
UtAssert_GenericUnsignedCompare(CFE_SB_MsgIdToValue(mid1), UtAssert_Compare_EQ, CFE_SB_MsgIdToValue(mid2), \
UtAssert_Radix_HEX, __FILE__, __LINE__, "MsgId Check: ", #mid1, #mid2)

Expand Down Expand Up @@ -368,8 +367,8 @@ void CFE_Assert_CloseLogFile(void);
** \returns Test pass status, returns true if status was successful, false if it failed.
**
******************************************************************************/
bool CFE_UtAssert_StatusCheck(CFE_Status_t Status, bool ExpectSuccess, UtAssert_CaseType_t CaseType, const char *File,
uint32 Line, const char *Text);
bool CFE_Assert_StatusCheck(CFE_Status_t Status, bool ExpectSuccess, UtAssert_CaseType_t CaseType, const char *File,
uint32 Line, const char *Text);

/*****************************************************************************/
/**
Expand Down
4 changes: 2 additions & 2 deletions modules/cfe_assert/src/cfe_assert_runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ static CFE_EVS_BinFilter_t CFE_TR_EventFilters[] = {
{UTASSERT_CASETYPE_DEBUG, CFE_EVS_NO_FILTER},
};

bool CFE_UtAssert_StatusCheck(CFE_Status_t Status, bool ExpectSuccess, UtAssert_CaseType_t CaseType, const char *File,
uint32 Line, const char *Text)
bool CFE_Assert_StatusCheck(CFE_Status_t Status, bool ExpectSuccess, UtAssert_CaseType_t CaseType, const char *File,
uint32 Line, const char *Text)
{
bool Result = (Status >= CFE_SUCCESS);
const char *MatchText;
Expand Down
5 changes: 4 additions & 1 deletion modules/cfe_testcase/src/cfe_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ CFE_FT_Global_t CFE_FT_Global;
*/
void CFE_TestMain(void)
{
/* Static local so data section is not zero when checking app info */
static char TestName[] = "CFE API";

/* Constant Table information used by all table tests */
CFE_FT_Global.TblName = "TestTable";
CFE_FT_Global.RegisteredTblName = "CFE_TEST_APP.TestTable";
Expand All @@ -52,7 +55,7 @@ void CFE_TestMain(void)
* Note this also waits for the appropriate overall system
* state and gets ownership of the UtAssert subsystem
*/
CFE_Assert_RegisterTest("CFE API");
CFE_Assert_RegisterTest(TestName);
CFE_Assert_OpenLogFile(CFE_ASSERT_LOG_FILE_NAME);

/*
Expand Down
2 changes: 1 addition & 1 deletion modules/cfe_testcase/src/cfe_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ extern CFE_FT_Global_t CFE_FT_Global;
*/
#define CFE_ASSERT_LOG_FILE_NAME "/cf/cfe_test.log"

bool TimeInRange(CFE_TIME_SysTime_t Time, CFE_TIME_SysTime_t Target, OS_time_t difference);
void TimeInRange(CFE_TIME_SysTime_t Start, CFE_TIME_SysTime_t Time, CFE_TIME_SysTime_t Range, const char *Str);

void CFE_TestMain(void);
void ESApplicationControlTestSetup(void);
Expand Down
2 changes: 1 addition & 1 deletion modules/cfe_testcase/src/es_cds_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void TestCDSName(void)
UtAssert_INT32_EQ(CFE_ES_GetCDSBlockName(CDSNameBuf, CDSHandlePtr, sizeof(CDSNameBuf)), CFE_SUCCESS);
UtAssert_StrCmp(CDSNameBuf, CDSName, "CFE_ES_GetCDSBlockName() = %s", CDSNameBuf);
UtAssert_INT32_EQ(CFE_ES_GetCDSBlockIDByName(&IdByName, CDSNameBuf), CFE_SUCCESS);
CFE_UtAssert_RESOURCEID_EQ(CDSHandlePtr, IdByName);
CFE_Assert_RESOURCEID_EQ(CDSHandlePtr, IdByName);

UtAssert_INT32_EQ(CFE_ES_GetCDSBlockName(NULL, CDSHandlePtr, sizeof(CDSNameBuf)), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetCDSBlockName(CDSNameBuf, CFE_ES_CDS_BAD_HANDLE, sizeof(CDSNameBuf)),
Expand Down
2 changes: 1 addition & 1 deletion modules/cfe_testcase/src/es_counter_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void TestCounterCreateDelete(void)

/* Confirm conversion To/From Name */
UtAssert_INT32_EQ(CFE_ES_GetGenCounterIDByName(&CheckId, CounterName), CFE_SUCCESS);
CFE_UtAssert_RESOURCEID_EQ(CheckId, TestId);
CFE_Assert_RESOURCEID_EQ(CheckId, TestId);
UtAssert_INT32_EQ(CFE_ES_GetGenCounterName(CheckName, TestId, sizeof(CheckName)), CFE_SUCCESS);
UtAssert_STRINGBUF_EQ(CheckName, sizeof(CheckName), CounterName, sizeof(CounterName));

Expand Down
20 changes: 11 additions & 9 deletions modules/cfe_testcase/src/es_info_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void TestAppInfo(void)

UtAssert_INT32_EQ(CFE_ES_GetAppIDByName(&AppIdByName, TEST_EXPECTED_APP_NAME), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_GetAppID(&TestAppId), CFE_SUCCESS);
CFE_UtAssert_RESOURCEID_EQ(TestAppId, AppIdByName);
CFE_Assert_RESOURCEID_EQ(TestAppId, AppIdByName);
UtAssert_INT32_EQ(CFE_ES_GetAppName(AppNameBuf, TestAppId, sizeof(AppNameBuf)), CFE_SUCCESS);
UtAssert_StrCmp(AppNameBuf, TEST_EXPECTED_APP_NAME, "CFE_ES_GetAppName() = %s", AppNameBuf);

Expand Down Expand Up @@ -122,7 +122,7 @@ void TestAppInfo(void)
UtAssert_True(ESAppInfo.NumOfChildTasks > 0, "ES App Info -> Child Tasks = %d", (int)ESAppInfo.NumOfChildTasks);

UtAssert_INT32_EQ(CFE_ES_GetAppIDByName(&AppIdByName, INVALID_APP_NAME), CFE_ES_ERR_NAME_NOT_FOUND);
CFE_UtAssert_RESOURCEID_UNDEFINED(AppIdByName);
CFE_Assert_RESOURCEID_UNDEFINED(AppIdByName);
UtAssert_INT32_EQ(CFE_ES_GetAppID(NULL), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetAppIDByName(NULL, TEST_EXPECTED_APP_NAME), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetAppIDByName(&AppIdByName, NULL), CFE_ES_BAD_ARGUMENT);
Expand All @@ -147,15 +147,15 @@ void TestTaskInfo(void)

UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(&TaskInfo, AppInfo.MainTaskId), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_GetTaskID(&TaskId), CFE_SUCCESS);
CFE_UtAssert_RESOURCEID_EQ(TaskId, AppInfo.MainTaskId);
CFE_Assert_RESOURCEID_EQ(TaskId, AppInfo.MainTaskId);

UtAssert_StrCmp(TaskInfo.AppName, AppInfo.Name, "TaskInfo.AppName (%s) = AppInfo.name (%s)", TaskInfo.AppName,
AppInfo.Name);
UtAssert_StrCmp(TaskInfo.TaskName, AppInfo.MainTaskName, "TaskInfo.TaskName (%s) = AppInfo.MainTaskName (%s)",
TaskInfo.TaskName, AppInfo.MainTaskName);

CFE_UtAssert_RESOURCEID_EQ(TaskInfo.TaskId, AppInfo.MainTaskId);
CFE_UtAssert_RESOURCEID_EQ(TaskInfo.AppId, AppId);
CFE_Assert_RESOURCEID_EQ(TaskInfo.TaskId, AppInfo.MainTaskId);
CFE_Assert_RESOURCEID_EQ(TaskInfo.AppId, AppId);
UtAssert_INT32_EQ(TaskInfo.ExecutionCounter, AppInfo.ExecutionCounter);

UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(&TaskInfo, CFE_ES_TASKID_UNDEFINED), CFE_ES_ERR_RESOURCEID_NOT_VALID);
Expand All @@ -169,6 +169,7 @@ void TestLibInfo(void)
CFE_ES_LibId_t CheckId;
CFE_ES_AppInfo_t LibInfo;
const char * LibName = "ASSERT_LIB";
const char * FileName = "cfe_assert";
const char * InvalidName = "INVALID_NAME";
char LibNameBuf[OS_MAX_API_NAME + 4];

Expand All @@ -181,7 +182,8 @@ void TestLibInfo(void)
UtAssert_True(LibInfo.Type == CFE_ES_AppType_LIBRARY, "Lib Info -> Type = %d", (int)LibInfo.Type);
UtAssert_StrCmp(LibInfo.Name, LibName, "Lib Info -> Name = %s", LibInfo.Name);
UtAssert_StrCmp(LibInfo.EntryPoint, "CFE_Assert_LibInit", "Lib Info -> EntryPt = %s", LibInfo.EntryPoint);
UtAssert_StrCmp(LibInfo.FileName, "/cf/cfe_assert.so", "Lib Info -> FileName = %s", LibInfo.FileName);
UtAssert_True(strstr(LibInfo.FileName, FileName) != NULL, "Lib Info -> FileName = %s contains %s", LibInfo.FileName,
FileName);
UtAssert_True(LibInfo.StackSize == 0, "Lib Info -> StackSz = %d", (int)LibInfo.StackSize);

if (LibInfo.AddressesAreValid)
Expand All @@ -207,18 +209,18 @@ void TestLibInfo(void)

UtAssert_INT32_EQ(LibInfo.ExceptionAction, 0);
UtAssert_True(LibInfo.Priority == 0, "Lib Info -> Priority = %d", (int)LibInfo.Priority);
CFE_UtAssert_RESOURCEID_UNDEFINED(LibInfo.MainTaskId);
CFE_Assert_RESOURCEID_UNDEFINED(LibInfo.MainTaskId);
UtAssert_True(LibInfo.ExecutionCounter == 0, "Lib Info -> ExecutionCounter = %d", (int)LibInfo.ExecutionCounter);
UtAssert_True(strlen(LibInfo.MainTaskName) == 0, "Lib Info -> Task Name = %s", LibInfo.MainTaskName);
UtAssert_True(LibInfo.NumOfChildTasks == 0, "Lib Info -> Child Tasks = %d", (int)LibInfo.NumOfChildTasks);

UtAssert_INT32_EQ(CFE_ES_GetLibIDByName(&CheckId, InvalidName), CFE_ES_ERR_NAME_NOT_FOUND);
CFE_UtAssert_RESOURCEID_UNDEFINED(CheckId);
CFE_Assert_RESOURCEID_UNDEFINED(CheckId);
UtAssert_INT32_EQ(CFE_ES_GetLibInfo(&LibInfo, CFE_ES_LIBID_UNDEFINED), CFE_ES_ERR_RESOURCEID_NOT_VALID);
UtAssert_INT32_EQ(CFE_ES_GetLibInfo(NULL, LibId), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetLibIDByName(NULL, LibName), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetLibIDByName(&CheckId, NULL), CFE_ES_BAD_ARGUMENT);
CFE_UtAssert_RESOURCEID_UNDEFINED(CheckId);
CFE_Assert_RESOURCEID_UNDEFINED(CheckId);
UtAssert_INT32_EQ(CFE_ES_GetLibName(LibNameBuf, CFE_ES_LIBID_UNDEFINED, sizeof(LibNameBuf)),
CFE_ES_ERR_RESOURCEID_NOT_VALID);
UtAssert_INT32_EQ(CFE_ES_GetLibName(LibNameBuf, LibId, 0), CFE_ES_BAD_ARGUMENT);
Expand Down
29 changes: 17 additions & 12 deletions modules/cfe_testcase/src/es_misc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,29 @@

void TestCalculateCRC(void)
{
const char *Data = "Random Stuff";
uint8 Data2[12];
uint32 expectedCrc = 20824;
uint32 inputCrc = 345353;
uint32 expectedBlockCrc = 2688;
const char *Data = "Random Stuff";
uint32 inputCrc = 345353;
uint32 Result;

UtPrintf("Testing: CFE_ES_CalculateCRC");

UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_DEFAULT_CRC), expectedCrc);
/* CRC is implementation specific, functional just checks that a result is produced and reports */
UtAssert_VOIDCALL(Result = CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_DEFAULT_CRC));
UtAssert_MIR("Confirm mission default CRC of \"%s\" is %lu", Data, (unsigned long)Result);

memset(Data2, 1, sizeof(Data2));
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(&Data2, sizeof(Data2), inputCrc, CFE_MISSION_ES_CRC_16), expectedBlockCrc);
UtAssert_VOIDCALL(Result = CFE_ES_CalculateCRC(Data, sizeof(Data), inputCrc, CFE_MISSION_ES_CRC_16));
UtAssert_MIR("Confirm CRC16 of \"%s\" with input CRC of %lu is %lu", Data, (unsigned long)inputCrc,
(unsigned long)Result);

UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_CRC_8), 0);
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_CRC_32), 0);
UtAssert_VOIDCALL(Result = CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_CRC_8));
UtAssert_MIR("Confirm CRC8 of \"%s\" is %lu", Data, (unsigned long)Result);

UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(NULL, sizeof(Data), expectedCrc, CFE_MISSION_ES_CRC_16), expectedCrc);
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, 0, expectedBlockCrc, CFE_MISSION_ES_CRC_16), expectedBlockCrc);
UtAssert_VOIDCALL(Result = CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_CRC_32));
UtAssert_MIR("Confirm CRC32 of \"%s\" is %lu", Data, (unsigned long)Result);

/* NULL input or 0 size returns input crc */
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(NULL, sizeof(Data), inputCrc, CFE_MISSION_ES_CRC_16), inputCrc);
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, 0, inputCrc, CFE_MISSION_ES_CRC_16), inputCrc);
}

void TestWriteToSysLog(void)
Expand Down
12 changes: 6 additions & 6 deletions modules/cfe_testcase/src/es_task_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ void TestChildTaskName(void)
UtPrintf("Testing: CFE_ES_GetTaskIDByName, CFE_ES_GetTaskName");

CFE_ES_TaskId_t TaskId;
const char * TaskName = "CHILD_TASK_1";
const char INVALID_TASK_NAME[] = "INVALID_NAME";
const char TaskName[] = "CHILD_TASK_1";
CFE_ES_TaskId_t TaskIdByName;
char TaskNameBuf[OS_MAX_API_NAME + 4];
CFE_ES_StackPointer_t StackPointer = CFE_ES_TASK_STACK_ALLOCATE;
Expand All @@ -205,20 +204,21 @@ void TestChildTaskName(void)
CFE_SUCCESS);

UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskIdByName, TaskName), CFE_SUCCESS);
CFE_UtAssert_RESOURCEID_EQ(TaskIdByName, TaskId);
CFE_Assert_RESOURCEID_EQ(TaskIdByName, TaskId);

UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, TaskId, sizeof(TaskNameBuf)), CFE_SUCCESS);
UtAssert_StrCmp(TaskNameBuf, TaskName, "CFE_ES_GetTaskName() = %s", TaskNameBuf);

UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(NULL, TaskName), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskIdByName, NULL), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskIdByName, INVALID_TASK_NAME), CFE_ES_ERR_NAME_NOT_FOUND);
CFE_UtAssert_RESOURCEID_UNDEFINED(TaskIdByName);
UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskIdByName, "INVALID_NAME"), CFE_ES_ERR_NAME_NOT_FOUND);
CFE_Assert_RESOURCEID_UNDEFINED(TaskIdByName);

UtAssert_INT32_EQ(CFE_ES_GetTaskName(NULL, TaskId, sizeof(TaskNameBuf)), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, CFE_ES_TASKID_UNDEFINED, sizeof(TaskNameBuf)),
CFE_ES_ERR_RESOURCEID_NOT_VALID);
UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, TaskId, sizeof(TaskName) - 4), CFE_ES_ERR_RESOURCEID_NOT_VALID);
UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, TaskId, 0), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, TaskId, sizeof(TaskName) - 1), CFE_ES_ERR_RESOURCEID_NOT_VALID);

UtAssert_INT32_EQ(CFE_ES_DeleteChildTask(TaskId), CFE_SUCCESS);
}
Expand Down
10 changes: 4 additions & 6 deletions modules/cfe_testcase/src/fs_header_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@

#include "cfe_test.h"

#define OS_TEST_HEADER_FILENAME "/drive0/header_test.txt"
#define OS_TEST_HEADER_FILENAME "/ram/header_test.txt"
char *fsAddrPtr = NULL;

static osal_id_t setup_file(void)
{
osal_id_t id;
OS_mkfs(fsAddrPtr, "/ramdev1", "RAM", 512, 20);
OS_mount("/ramdev1", "/drive0");
UtAssert_INT32_EQ(OS_OpenCreate(&id, OS_TEST_HEADER_FILENAME, OS_FILE_FLAG_CREATE, OS_READ_WRITE), OS_SUCCESS);
return id;
}
Expand All @@ -59,7 +57,7 @@ void TestCreateHeader(void)
UtAssert_INT32_EQ(OS_lseek(fd, 0, OS_SEEK_CUR), sizeof(CFE_FS_Header_t));

UtAssert_INT32_EQ(CFE_FS_WriteHeader(fd, NULL), CFE_FS_BAD_ARGUMENT);
CFE_UtAssert_STATUS_ERROR(CFE_FS_WriteHeader(OS_OBJECT_ID_UNDEFINED, &Header));
CFE_Assert_STATUS_ERROR(CFE_FS_WriteHeader(OS_OBJECT_ID_UNDEFINED, &Header));

UtAssert_VOIDCALL(CFE_FS_InitHeader(NULL, TestDescription, CFE_FS_SubType_ES_ERLOG));
UtAssert_VOIDCALL(CFE_FS_InitHeader(&HeaderFail, NULL, CFE_FS_SubType_ES_ERLOG));
Expand Down Expand Up @@ -88,7 +86,7 @@ void TestReadHeader(void)
UtAssert_StrCmp(TestDescription, ReadHeader.Description, "ReadHeader.Description = %s", ReadHeader.Description);

UtAssert_INT32_EQ(CFE_FS_ReadHeader(NULL, fd), CFE_FS_BAD_ARGUMENT);
CFE_UtAssert_STATUS_ERROR(CFE_FS_ReadHeader(&ReadHeader, OS_OBJECT_ID_UNDEFINED));
CFE_Assert_STATUS_ERROR(CFE_FS_ReadHeader(&ReadHeader, OS_OBJECT_ID_UNDEFINED));

OS_close(fd);
OS_remove(OS_TEST_HEADER_FILENAME);
Expand All @@ -114,7 +112,7 @@ void TestTimeStamp(void)
UtAssert_UINT32_EQ(0xFFFFFFFF, ReadHeader.TimeSeconds);
UtAssert_UINT32_EQ(0xFFFFFFFF, ReadHeader.TimeSubSeconds);

CFE_UtAssert_STATUS_ERROR(CFE_FS_SetTimestamp(OS_OBJECT_ID_UNDEFINED, NewTimestamp));
CFE_Assert_STATUS_ERROR(CFE_FS_SetTimestamp(OS_OBJECT_ID_UNDEFINED, NewTimestamp));

OS_close(fd);
OS_remove(OS_TEST_HEADER_FILENAME);
Expand Down
Loading

0 comments on commit 98f78e8

Please sign in to comment.