Skip to content

Commit

Permalink
Merge pull request #1885 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
cFE Integration candidate: 2021-08-31
  • Loading branch information
astrogeco committed Sep 1, 2021
2 parents 5e41330 + a8634eb commit e5d4ed9
Show file tree
Hide file tree
Showing 32 changed files with 1,792 additions and 247 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,33 @@ The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob

## Version History

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

- Add SB API test cases
- Add ES API test cases
- Add TBL API test cases
- Add FS API test cases
- Add Time Clock Test
- Add EVS coverage test for MessageSendCounter not incrementing when sending a filtered event.
- SB test improvements:
- unsubscribe of single pipe ID, confirms other subscriptions not changed
- Confirms that MsgLimit and PipeDepth are both honored and that delivery to other (open) pipes is not affected when some pipes have reached delivery limits
- Adds use of CFE_SB_PEND_FOREVER in some cases
- Adds a sequence number validation to the Zero copy test.
- Verify that CFE_TBL_Modified calculates and sets the table CRC and the Updated flag
- Add call to CFE_ES_ExitChildTask in es_task_test
- Incorrect OSAL Format in Users Guide Reference
- Improve EVS code coverage
- Improve FS coverage
- Improve MSG branch coverage
- Improve resource ID branch coverage
- Improve SBR branch coverage
- Improve TIME branch coverage
- Improve TBL code coverage
- Support custom PSP directory in build system
- Update time tests to use bitmask check macros
- See <https://github.com/nasa/cFE/pull/1885> and <https://github.com/nasa/cFS/pull/348>

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

- Add software bus tests
Expand Down
2 changes: 1 addition & 1 deletion cmake/arch_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ function(process_arch SYSVAR)
set(CFE_PSP_EXPECTED_OSAL_BSPTYPE ${CFE_SYSTEM_PSPNAME})

# Include any specific compiler flags or config from the selected PSP
include(${MISSION_SOURCE_DIR}/psp/fsw/${CFE_SYSTEM_PSPNAME}/make/build_options.cmake)
include(${psp_MISSION_DIR}/fsw/${CFE_SYSTEM_PSPNAME}/make/build_options.cmake)

if (NOT DEFINED OSAL_SYSTEM_BSPTYPE)
# Implicitly use the OSAL BSP that corresponds with the CFE PSP
Expand Down
2 changes: 1 addition & 1 deletion cmake/sample_defs/targets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ SET(SPACECRAFT_ID 0x42)
#list(APPEND MISSION_CORE_MODULES mymodule)

# The "MISSION_GLOBAL_APPLIST" is a set of apps/libs that will be built
# for every defined and target. These are built as dynamic modules
# for every defined target. These are built as dynamic modules
# and must be loaded explicitly via startup script or command.
# This list is effectively appended to every TGTx_APPLIST in targets.cmake.
# Example:
Expand Down
7 changes: 3 additions & 4 deletions docs/cFE Application Developers Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,9 @@ software interface.

## 1.3 Applicable Documents

| **Location** | **Documents** | **Description** |
|:---------------------------------------------|:----------------------|:-------------------|
| https://github.com/nasa/osal/tree/master/doc | OSAL Library API.doc | Describes OSAL API |
| TBD | PSP API (TBD) | Describes PSP API |
Autogenerated documentation can be found at the cFS gh-pages branch, https://github.com/nasa/cFS/tree/gh-pages.

Other documentation can be found in the associated repository's docs directory.


## 1.4 Acronyms
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 @@ -50,7 +50,7 @@ typedef struct
CFE_FS_FileWriteMetaData_t FuncTestState;

/* Generic utility counter */
int Count;
int32 Count;

/* Table information used by all table tests */
CFE_TBL_Handle_t TblHandle;
Expand Down
22 changes: 13 additions & 9 deletions modules/cfe_testcase/src/es_counter_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

void TestCounterCreateDelete(void)
{
CFE_ES_CounterId_t Ids[CFE_PLATFORM_ES_MAX_GEN_COUNTERS];
CFE_ES_CounterId_t Ids[CFE_PLATFORM_ES_MAX_GEN_COUNTERS + 1];
CFE_ES_CounterId_t TestId;
CFE_ES_CounterId_t CheckId;
char CounterName[CFE_MISSION_MAX_API_LEN];
Expand All @@ -48,22 +48,26 @@ void TestCounterCreateDelete(void)
UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(NULL, CounterName), CFE_ES_BAD_ARGUMENT);

/* Create up to CFE_PLATFORM_ES_MAX_GEN_COUNTERS and confirm success */
for (NumCounters = 0; NumCounters < CFE_PLATFORM_ES_MAX_GEN_COUNTERS; ++NumCounters)
/* Note that this loop may execute fewer than CFE_PLATFORM_ES_MAX_GEN_COUNTERS times,
* if another unrelated app has already registered a counter. Because this test
* cannot control for those pre-conditions, anything within range is acceptable */
for (NumCounters = 0; NumCounters <= CFE_PLATFORM_ES_MAX_GEN_COUNTERS; ++NumCounters)
{
snprintf(CounterName, sizeof(CounterName), "C%u", (unsigned int)NumCounters);
Status = CFE_ES_RegisterGenCounter(&Ids[NumCounters], CounterName);
if (Status != CFE_SUCCESS)
CFE_Assert_STATUS_STORE(CFE_ES_RegisterGenCounter(&Ids[NumCounters], CounterName));

/* When the max limit is reached, should return CFE_ES_NO_RESOURCE_IDS_AVAILABLE */
if (CFE_Assert_STATUS_MAY_BE(CFE_ES_NO_RESOURCE_IDS_AVAILABLE))
{
break;
}

/* If max limit not reached, should return CFE_SUCCESS, anything else is a test fail */
CFE_Assert_STATUS_MAY_BE(CFE_SUCCESS);
}

/* Confirm that the expected number of counters were created */
UtAssert_UINT32_EQ(NumCounters, CFE_PLATFORM_ES_MAX_GEN_COUNTERS);

/* Attempt to create one too many */
snprintf(CounterName, sizeof(CounterName), "extra");
UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(&TestId, CounterName), CFE_ES_NO_RESOURCE_IDS_AVAILABLE);
UtAssert_UINT32_LTEQ(NumCounters, CFE_PLATFORM_ES_MAX_GEN_COUNTERS);

/* pick a single counter ID from the middle of the set for more detail testing of support APIs */
TestId = Ids[NumCounters / 2];
Expand Down
26 changes: 16 additions & 10 deletions modules/cfe_testcase/src/es_info_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,12 @@ void TestAppInfo(void)
CFE_UtAssert_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);
UtAssert_INT32_EQ(CFE_ES_GetAppName(AppNameBuf, CFE_ES_APPID_UNDEFINED, sizeof(AppNameBuf)),
CFE_ES_ERR_RESOURCEID_NOT_VALID);
UtAssert_INT32_EQ(CFE_ES_GetAppName(NULL, TestAppId, sizeof(AppNameBuf)), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetAppInfo(&TestAppInfo, CFE_ES_APPID_UNDEFINED), CFE_ES_ERR_RESOURCEID_NOT_VALID);
UtAssert_INT32_EQ(CFE_ES_GetAppInfo(NULL, CFE_ES_APPID_UNDEFINED), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetAppInfo(NULL, TestAppId), CFE_ES_BAD_ARGUMENT);
}

void TestTaskInfo(void)
Expand Down Expand Up @@ -158,23 +159,24 @@ void TestTaskInfo(void)
UtAssert_INT32_EQ(TaskInfo.ExecutionCounter, AppInfo.ExecutionCounter);

UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(&TaskInfo, CFE_ES_TASKID_UNDEFINED), CFE_ES_ERR_RESOURCEID_NOT_VALID);
UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(NULL, CFE_ES_TASKID_UNDEFINED), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(NULL, TaskId), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetTaskID(NULL), CFE_ES_BAD_ARGUMENT);
}

void TestLibInfo(void)
{
CFE_ES_LibId_t LibIdByName;
CFE_ES_LibId_t LibId;
CFE_ES_LibId_t CheckId;
CFE_ES_AppInfo_t LibInfo;
const char * LibName = "ASSERT_LIB";
const char * InvalidName = "INVALID_NAME";
char LibNameBuf[OS_MAX_API_NAME + 4];

UtPrintf("Testing: CFE_ES_GetLibIDByName, CFE_ES_GetLibName, CFE_ES_GetLibInfo");

UtAssert_INT32_EQ(CFE_ES_GetLibIDByName(&LibIdByName, LibName), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_GetLibInfo(&LibInfo, LibIdByName), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_GetLibName(LibNameBuf, LibIdByName, sizeof(LibNameBuf)), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_GetLibIDByName(&LibId, LibName), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_GetLibInfo(&LibInfo, LibId), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_GetLibName(LibNameBuf, LibId, sizeof(LibNameBuf)), CFE_SUCCESS);
UtAssert_StrCmp(LibNameBuf, LibName, "CFE_ES_GetLibName() = %s", LibNameBuf);
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);
Expand Down Expand Up @@ -210,13 +212,17 @@ void TestLibInfo(void)
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(&LibIdByName, InvalidName), CFE_ES_ERR_NAME_NOT_FOUND);
UtAssert_INT32_EQ(CFE_ES_GetLibInfo(&LibInfo, LibIdByName), CFE_ES_ERR_RESOURCEID_NOT_VALID);
UtAssert_INT32_EQ(CFE_ES_GetLibIDByName(&CheckId, InvalidName), CFE_ES_ERR_NAME_NOT_FOUND);
CFE_UtAssert_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_GetLibInfo(NULL, LibIdByName), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetLibIDByName(&CheckId, NULL), CFE_ES_BAD_ARGUMENT);
CFE_UtAssert_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(NULL, LibIdByName, sizeof(LibNameBuf)), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetLibName(LibNameBuf, LibId, 0), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetLibName(NULL, LibId, sizeof(LibNameBuf)), CFE_ES_BAD_ARGUMENT);
}

void TestResetType(void)
Expand Down
95 changes: 74 additions & 21 deletions modules/cfe_testcase/src/es_mempool_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,52 +33,96 @@

#include "cfe_test.h"

typedef struct
{
uint32 Mem[128];
} CFE_FT_PoolMemBlock_t;

static CFE_FT_PoolMemBlock_t CFE_FT_PoolMemBlock[CFE_PLATFORM_ES_MAX_MEMORY_POOLS + 1];

void TestMemPoolCreate(void)
{
CFE_ES_MemHandle_t PoolID;
int8 Pool[1024];

UtPrintf("Testing: CFE_ES_PoolCreateNoSem, CFE_ES_PoolCreate, CFE_ES_PoolCreateEx");

UtAssert_INT32_EQ(CFE_ES_PoolCreateNoSem(&PoolID, Pool, sizeof(Pool)), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_PoolCreateNoSem(NULL, Pool, sizeof(Pool)), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_PoolCreateNoSem(&PoolID, NULL, sizeof(Pool)), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_PoolCreateNoSem(&PoolID, Pool, 0), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_PoolCreateNoSem(&PoolID, CFE_FT_PoolMemBlock, sizeof(CFE_FT_PoolMemBlock)), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_PoolCreateNoSem(NULL, CFE_FT_PoolMemBlock, sizeof(CFE_FT_PoolMemBlock)),
CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_PoolCreateNoSem(&PoolID, NULL, sizeof(CFE_FT_PoolMemBlock)), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_PoolCreateNoSem(&PoolID, CFE_FT_PoolMemBlock, 0), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_PoolDelete(PoolID), CFE_SUCCESS);

UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID, Pool, sizeof(Pool)), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_PoolCreate(NULL, Pool, sizeof(Pool)), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID, NULL, sizeof(Pool)), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID, Pool, 0), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID, CFE_FT_PoolMemBlock, sizeof(CFE_FT_PoolMemBlock)), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_PoolCreate(NULL, CFE_FT_PoolMemBlock, sizeof(CFE_FT_PoolMemBlock)), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID, NULL, sizeof(CFE_FT_PoolMemBlock)), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID, CFE_FT_PoolMemBlock, 0), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_PoolDelete(PoolID), CFE_SUCCESS);

UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID, Pool, sizeof(Pool), 0, NULL, CFE_ES_NO_MUTEX), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(NULL, Pool, sizeof(Pool), 0, NULL, CFE_ES_NO_MUTEX), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID, NULL, sizeof(Pool), 0, NULL, CFE_ES_NO_MUTEX), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID, Pool, 0, 0, NULL, CFE_ES_NO_MUTEX), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(
CFE_ES_PoolCreateEx(&PoolID, CFE_FT_PoolMemBlock, sizeof(CFE_FT_PoolMemBlock), 0, NULL, CFE_ES_NO_MUTEX),
CFE_SUCCESS);
UtAssert_INT32_EQ(
CFE_ES_PoolCreateEx(NULL, CFE_FT_PoolMemBlock, sizeof(CFE_FT_PoolMemBlock), 0, NULL, CFE_ES_NO_MUTEX),
CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID, NULL, sizeof(CFE_FT_PoolMemBlock), 0, NULL, CFE_ES_NO_MUTEX),
CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID, CFE_FT_PoolMemBlock, 0, 0, NULL, CFE_ES_NO_MUTEX),
CFE_ES_BAD_ARGUMENT);

UtAssert_INT32_EQ(CFE_ES_PoolDelete(PoolID), CFE_SUCCESS);
}

void TestMemPoolCreateMax(void)
{
CFE_ES_MemHandle_t PoolID[CFE_PLATFORM_ES_MAX_MEMORY_POOLS + 1];
uint32 NumPools;

UtPrintf("Testing: CFE_ES_PoolCreate Max Limit");

NumPools = 0;
while (NumPools <= CFE_PLATFORM_ES_MAX_MEMORY_POOLS)
{
CFE_Assert_STATUS_STORE(CFE_ES_PoolCreateEx(&PoolID[NumPools], &CFE_FT_PoolMemBlock[NumPools],
sizeof(CFE_FT_PoolMemBlock_t), 0, NULL, CFE_ES_NO_MUTEX));
if (CFE_Assert_STATUS_MAY_BE(CFE_ES_NO_RESOURCE_IDS_AVAILABLE))
{
/* limit reached */
break;
}
CFE_Assert_STATUS_MUST_BE(CFE_SUCCESS);
++NumPools;
}

UtAssert_UINT32_LTEQ(NumPools, CFE_PLATFORM_ES_MAX_MEMORY_POOLS);

/* Clean up */
while (NumPools > 0)
{
--NumPools;
UtAssert_INT32_EQ(CFE_ES_PoolDelete(PoolID[NumPools]), CFE_SUCCESS);
}
}

void TestMemPoolGetBuf(void)
{
CFE_ES_MemHandle_t PoolID;
int8 Pool[1024];
size_t Buffer = 512;
size_t BufferBig = 2048;
CFE_ES_MemPoolBuf_t addressp = CFE_ES_MEMPOOLBUF_C(0);
size_t BufferSize = 512;
size_t BufferBig = 2048;
CFE_ES_MemPoolBuf_t addressp = CFE_ES_MEMPOOLBUF_C(0);

UtPrintf("Testing: TestMemPoolGetBuf");

UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID, Pool, sizeof(Pool)), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp, PoolID, Buffer), Buffer);
UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp, PoolID, BufferSize), BufferSize);

UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(NULL, PoolID, Buffer), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp, CFE_ES_MEMHANDLE_UNDEFINED, Buffer),
UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(NULL, PoolID, BufferSize), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp, CFE_ES_MEMHANDLE_UNDEFINED, BufferSize),
CFE_ES_ERR_RESOURCEID_NOT_VALID);

UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp, PoolID, Buffer), CFE_ES_ERR_MEM_BLOCK_SIZE);
UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID, addressp), Buffer);
UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp, PoolID, BufferSize), CFE_ES_ERR_MEM_BLOCK_SIZE);
UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID, addressp), BufferSize);

UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp, PoolID, BufferBig), CFE_ES_ERR_MEM_BLOCK_SIZE);

Expand All @@ -104,6 +148,9 @@ void TestMemPoolBufInfo(void)
UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(CFE_ES_MEMHANDLE_UNDEFINED, addressp), CFE_ES_ERR_RESOURCEID_NOT_VALID);
UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID, NULL), CFE_ES_BAD_ARGUMENT);

/* Pass an address from some other memory which is not part of the pool */
UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID, &Buffer), CFE_ES_BUFFER_NOT_IN_POOL);

UtAssert_INT32_EQ(CFE_ES_PoolDelete(PoolID), CFE_SUCCESS);
}

Expand Down Expand Up @@ -145,13 +192,19 @@ void TestMemPoolDelete(void)
UtAssert_UINT32_EQ(Stats.CheckErrCtr, 0);
UtAssert_UINT32_EQ(Stats.NumFreeBytes, sizeof(Buffer));

UtAssert_INT32_EQ(CFE_ES_GetMemPoolStats(NULL, PoolID), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetMemPoolStats(&Stats, CFE_ES_MEMHANDLE_UNDEFINED), CFE_ES_ERR_RESOURCEID_NOT_VALID);

UtAssert_INT32_EQ(CFE_ES_PoolDelete(PoolID), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_GetMemPoolStats(&Stats, PoolID), CFE_ES_ERR_RESOURCEID_NOT_VALID);
UtAssert_INT32_EQ(CFE_ES_PoolDelete(PoolID), CFE_ES_ERR_RESOURCEID_NOT_VALID);
UtAssert_INT32_EQ(CFE_ES_PoolDelete(CFE_ES_MEMHANDLE_UNDEFINED), CFE_ES_ERR_RESOURCEID_NOT_VALID);
}

void ESMemPoolTestSetup(void)
{
UtTest_Add(TestMemPoolCreate, NULL, NULL, "Test Mem Pool Create");
UtTest_Add(TestMemPoolCreateMax, NULL, NULL, "Test Mem Pool Create Maximum");
UtTest_Add(TestMemPoolGetBuf, NULL, NULL, "Test Mem Pool Get Buf");
UtTest_Add(TestMemPoolBufInfo, NULL, NULL, "Test Mem Pool Buf Info");
UtTest_Add(TestMemPoolPutBuf, NULL, NULL, "Test Mem Pool Put Buf");
Expand Down
28 changes: 25 additions & 3 deletions modules/cfe_testcase/src/es_misc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,33 @@ void TestCalculateCRC(void)
void TestWriteToSysLog(void)
{
const char *TestString = "Test String for CFE_ES_WriteToSysLog Functional Test";
uint32 Iterations = CFE_PLATFORM_ES_SYSTEM_LOG_SIZE / 50;

UtPrintf("Testing: CFE_ES_WriteToSysLog");
CFE_ES_WriteToSysLog("MIR (Manual Inspection Required) for CFE_ES_WriteToSysLog");
CFE_ES_WriteToSysLog(NULL);
CFE_ES_WriteToSysLog("%s", TestString);

UtAssert_INT32_EQ(CFE_ES_WriteToSysLog(NULL), CFE_ES_BAD_ARGUMENT);

CFE_Assert_STATUS_STORE(CFE_ES_WriteToSysLog("MIR (Manual Inspection Required) for CFE_ES_WriteToSysLog"));
if (!CFE_Assert_STATUS_MAY_BE(CFE_ES_ERR_SYS_LOG_FULL))
{
CFE_Assert_STATUS_MUST_BE(CFE_SUCCESS);
}

/* The test string is a little over 50 chars in length, so writing it repeatedly should fill it up. */
/* This does depend on whether the system is set to OVERWRITE or DISCARD mode, though -
* in OVERWRITE mode, the system log will never fill, and therefore CFE_ES_ERR_SYS_LOG_FULL cannot be tested */
Iterations = 1 + (CFE_PLATFORM_ES_SYSTEM_LOG_SIZE / strlen(TestString));

while (Iterations > 0)
{
--Iterations;
CFE_Assert_STATUS_STORE(CFE_ES_WriteToSysLog("%s", TestString));
if (CFE_Assert_STATUS_MAY_BE(CFE_ES_ERR_SYS_LOG_FULL))
{
break;
}
CFE_Assert_STATUS_MUST_BE(CFE_SUCCESS);
}

UtAssert_MIR("MIR (Manual Inspection Required) for CFE_ES_WriteToSysLog");
}
Expand Down
Loading

0 comments on commit e5d4ed9

Please sign in to comment.