Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cFE Integration candidate: 2021-08-31 #1885

Merged
merged 46 commits into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
c24daf4
Fix #1812, Add SB API test cases
jphickey Aug 13, 2021
0f569ff
Fix #1866, Add ES API test cases
jphickey Aug 17, 2021
19e5f2f
Fix #1867, Add FS API test cases
jphickey Aug 13, 2021
fb7cd23
Fix #1868, Add TBL API test cases
jphickey Aug 19, 2021
308beb2
Merge pull request #1870 from jphickey/fix-1812-sb-testcases
astrogeco Aug 24, 2021
21074a1
Merge pull request #1869 from jphickey/fix-1866-es-testcases
astrogeco Aug 24, 2021
c0e3e1c
Merge pull request #1872 from jphickey/fix-1868-tbl-testcases
astrogeco Aug 24, 2021
ea38fd2
Merge pull request #1871 from jphickey/fix-1867-fs-testcases
astrogeco Aug 24, 2021
914d9b3
Fix #1843, Add Time Clock Test
zanzaben Aug 24, 2021
922e665
Fix #1819, Test EVS Filter Failures
zanzaben Aug 20, 2021
8e7bb8f
Fix #1820, Add LogOverflowCounter test.
zanzaben Aug 20, 2021
5c388e3
Fix #1829, confirm CFE_SB_PEND_FOREVER flag
jphickey Aug 24, 2021
7170dff
Fix #1826, Add testcases for message broadcasting
jphickey Aug 24, 2021
b108e7e
Fix #1825, test unsubscribe from single pipe
jphickey Aug 24, 2021
7e7f5a5
Fix #1830, add sequence number validation to zero copy test
jphickey Aug 24, 2021
9b96246
Fix #1834 CFE_TBL_Modified: Test CRC, updated flag
pepepr08 Aug 23, 2021
ff90d70
Fix #1769, add call to CFE_ES_ExitChildTask
jphickey Aug 24, 2021
6e6b751
Fix #1880, Improve FS coverage
skliper Aug 25, 2021
6a8da99
Fix #1843, Remove ClockFlagCheck helper method.
zanzaben Aug 25, 2021
88e1d11
Fix #1888, Improve MSG branch coverage
skliper Aug 25, 2021
18ffb99
Fix #1890, Improve resource ID branch coverage
skliper Aug 25, 2021
9197270
Merge pull request #1860 from zanzaben/fix1843_Time_Clock_Func_Test
astrogeco Aug 25, 2021
2ca46e6
Merge pull request #1862 from zanzaben/Fix1819_EVS_coverage_test
astrogeco Aug 25, 2021
4c93929
Fix #1893, Improve SBR branch coverage
skliper Aug 26, 2021
ba1ed4b
Fix #1879, Improve EVS code coverage
skliper Aug 25, 2021
6d04b95
Fix #1897 #1899, Improve TBL code coverage
skliper Aug 27, 2021
af64eb4
Merge pull request #1881 from skliper/fix1879-evs_coverage
astrogeco Aug 27, 2021
90cedf2
Merge pull request #1865 from pepepr08/fix1834-table-mod
astrogeco Aug 27, 2021
98d723e
Merge pull request #1876 from jphickey/fix-1825-1826-1829-1830-sb-tests
astrogeco Aug 27, 2021
97f39b6
Merge pull request #1877 from jphickey/fix-1769-exitchildtask
astrogeco Aug 27, 2021
2fdd1b5
Fix #1616, Incorrect OSAL Format in Users Guide Reference
arielswalker Aug 27, 2021
7b83bed
Fix #1912, Update time tests to use bitmask check macros
jphickey Aug 30, 2021
9072b00
Merge pull request #1902 from ArielSAdamsNASA/fix-1616-incorrect-osal…
astrogeco Aug 30, 2021
6493ddc
Merge pull request #1884 from skliper/fix1880-fs_coverage
astrogeco Aug 30, 2021
bb16216
Merge pull request #1889 from skliper/fix1888-msg_coverage
astrogeco Aug 30, 2021
d145434
Merge pull request #1891 from skliper/fix1890-rid_coverage
astrogeco Aug 30, 2021
4941284
Fix #1895, Improve TIME branch coverage
skliper Aug 26, 2021
6fb3b3c
Merge pull request #1894 from skliper/fix1893-sbr_coverage
astrogeco Aug 31, 2021
ae56eb4
Merge pull request #1896 from skliper/fix1895-time_coverage
astrogeco Aug 31, 2021
5fa8e74
Fix #1918, remove extra word in comment
jphickey Aug 31, 2021
2922987
Merge pull request #1904 from skliper/fix1897-tbl_coverage
astrogeco Aug 31, 2021
811d1fd
Fix #1921, Support custom PSP directory (#1864)
jbohren-hbr Aug 23, 2021
6aa555a
Merge pull request #1913 from jphickey/fix-1912-bitmask-checks
astrogeco Sep 1, 2021
74320c3
Merge pull request #1923 from jphickey/fix-1918-correct-comment
astrogeco Sep 1, 2021
c67fb7d
HOTFIX 20210831, use memset to clear structs
jphickey Sep 1, 2021
a8634eb
IC:2021-08-31, Bump to v6.8.0-rc1+dev980
astrogeco Sep 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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