Skip to content

Commit

Permalink
Merge pull request #1661 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
cFE Integration candidate: 2021-07-13
  • Loading branch information
astrogeco authored Jul 13, 2021
2 parents 063b4d8 + 06bc1b3 commit 2afdbc1
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob

## Version History

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

- Size unit test table load buffer based on config
- Add SB Pipe Management Functional Tests
- See <https://github.com/nasa/cFE/pull/1661> and <https://github.com/nasa/cFS/pull/297>

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

- Change index type to resolve infinite loop warning
Expand Down
1 change: 1 addition & 0 deletions modules/cfe_testcase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ add_cfe_app(cfe_testcase
src/es_misc_test.c
src/es_mempool_test.c
src/fs_header_test.c
src/sb_pipe_mang_test.c
src/time_current_test.c
)

Expand Down
1 change: 1 addition & 0 deletions modules/cfe_testcase/src/cfe_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ void CFE_TestMain(void)
ESMiscTestSetup();
ESMemPoolTestSetup();
FSHeaderTestSetup();
SBPipeMangSetup();
TimeCurrentTestSetup();

/*
Expand Down
1 change: 1 addition & 0 deletions modules/cfe_testcase/src/cfe_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ void ESCDSTestSetup(void);
void ESMiscTestSetup(void);
void ESMemPoolTestSetup(void);
void FSHeaderTestSetup(void);
void SBPipeMangSetup(void);
void TimeCurrentTestSetup(void);

#endif /* CFE_TEST_H */
133 changes: 133 additions & 0 deletions modules/cfe_testcase/src/sb_pipe_mang_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/*************************************************************************
**
** GSC-18128-1, "Core Flight Executive Version 6.7"
**
** Copyright (c) 2006-2019 United States Government as represented by
** the Administrator of the National Aeronautics and Space Administration.
** All Rights Reserved.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
**
** File: es_info_test.c
**
** Purpose:
** Functional test of Sb Pipe Managment APIs
**
** Demonstration of how to register and use the UT assert functions.
**
*************************************************************************/

/*
* Includes
*/

#include "cfe_test.h"

void TestPipeCreate(void)
{
CFE_SB_PipeId_t PipeId1;
uint16 PipeDepth = 10;
const char PipeName[] = "Test Pipe";

UtPrintf("Testing: CFE_SB_CreatePipe, CFE_SB_DeletePipe");

UtAssert_INT32_EQ(CFE_SB_CreatePipe(&PipeId1, PipeDepth, PipeName), CFE_SUCCESS);

UtAssert_INT32_EQ(CFE_SB_CreatePipe(NULL, PipeDepth, PipeName), CFE_SB_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_SB_CreatePipe(&PipeId1, OS_QUEUE_MAX_DEPTH + 5, PipeName), CFE_SB_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_SB_CreatePipe(&PipeId1, 0, PipeName), CFE_SB_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_SB_CreatePipe(&PipeId1, PipeDepth, NULL), CFE_SB_PIPE_CR_ERR);

UtAssert_INT32_EQ(CFE_SB_DeletePipe(PipeId1), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_SB_DeletePipe(PipeId1), CFE_SB_BAD_ARGUMENT);
}

void TestPipeIndex(void)
{
CFE_SB_PipeId_t PipeId;
uint16 PipeDepth = 10;
const char PipeName[] = "Test Pipe";
uint32 Idx;

UtPrintf("Testing: CFE_SB_PipeId_ToIndex");

UtAssert_INT32_EQ(CFE_SB_CreatePipe(&PipeId, PipeDepth, PipeName), CFE_SUCCESS);

UtAssert_INT32_EQ(CFE_SB_PipeId_ToIndex(PipeId, &Idx), CFE_SUCCESS);

UtAssert_INT32_EQ(CFE_SB_PipeId_ToIndex(CFE_SB_INVALID_PIPE, &Idx), CFE_ES_ERR_RESOURCEID_NOT_VALID);
UtAssert_INT32_EQ(CFE_SB_PipeId_ToIndex(PipeId, NULL), CFE_ES_BAD_ARGUMENT);

UtAssert_INT32_EQ(CFE_SB_DeletePipe(PipeId), CFE_SUCCESS);
}

void TestPipeOptions(void)
{
CFE_SB_PipeId_t PipeId;
uint16 PipeDepth = 10;
const char PipeName[] = "Test Pipe";
uint8 Opts = 2;
uint8 OptsBuff;

UtPrintf("Testing: CFE_SB_SetPipeOpts, CFE_SB_GetPipeOpts");

UtAssert_INT32_EQ(CFE_SB_CreatePipe(&PipeId, PipeDepth, PipeName), CFE_SUCCESS);

UtAssert_INT32_EQ(CFE_SB_SetPipeOpts(PipeId, Opts), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_SB_GetPipeOpts(PipeId, &OptsBuff), CFE_SUCCESS);
UtAssert_UINT32_EQ(Opts, OptsBuff);

UtAssert_INT32_EQ(CFE_SB_SetPipeOpts(CFE_SB_INVALID_PIPE, Opts), CFE_SB_BAD_ARGUMENT);

UtAssert_INT32_EQ(CFE_SB_GetPipeOpts(CFE_SB_INVALID_PIPE, &OptsBuff), CFE_SB_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_SB_GetPipeOpts(PipeId, NULL), CFE_SB_BAD_ARGUMENT);

UtAssert_INT32_EQ(CFE_SB_DeletePipe(PipeId), CFE_SUCCESS);
}

void TestPipeName(void)
{
CFE_SB_PipeId_t PipeId;
uint16 PipeDepth = 10;
const char PipeName[] = "Test Pipe";
char PipeNameBuf[OS_MAX_API_NAME];
CFE_SB_PipeId_t PipeIdBuff;
const char InvalidPipeName[] = "Invalid Pipe";

UtPrintf("Testing: CFE_SB_GetPipeName, CFE_SB_GetPipeIdByName");

UtAssert_INT32_EQ(CFE_SB_CreatePipe(&PipeId, PipeDepth, PipeName), CFE_SUCCESS);

UtAssert_INT32_EQ(CFE_SB_GetPipeName(PipeNameBuf, sizeof(PipeNameBuf), PipeId), CFE_SUCCESS);
UtAssert_StrCmp(PipeNameBuf, PipeName, "CFE_SB_GetPipeName() = %s", PipeNameBuf);

UtAssert_INT32_EQ(CFE_SB_GetPipeIdByName(&PipeIdBuff, PipeName), CFE_SUCCESS);
cFE_FTAssert_ResourceID_EQ(PipeId, PipeIdBuff);

UtAssert_INT32_EQ(CFE_SB_GetPipeName(NULL, sizeof(PipeNameBuf), PipeId), CFE_SB_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_SB_GetPipeName(PipeNameBuf, 0, PipeId), CFE_SB_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_SB_GetPipeName(PipeNameBuf, sizeof(PipeNameBuf), CFE_SB_INVALID_PIPE), CFE_SB_BAD_ARGUMENT);

UtAssert_INT32_EQ(CFE_SB_GetPipeIdByName(NULL, PipeName), CFE_SB_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_SB_GetPipeIdByName(&PipeIdBuff, InvalidPipeName), CFE_SB_BAD_ARGUMENT);

UtAssert_INT32_EQ(CFE_SB_DeletePipe(PipeId), CFE_SUCCESS);
}

void SBPipeMangSetup(void)
{
UtTest_Add(TestPipeCreate, NULL, NULL, "Test Pipe Create");
UtTest_Add(TestPipeIndex, NULL, NULL, "Test Pipe Index");
UtTest_Add(TestPipeOptions, NULL, NULL, "Test Pipe Options");
UtTest_Add(TestPipeName, NULL, NULL, "Test Pipe Name");
}
2 changes: 1 addition & 1 deletion modules/core_api/fsw/inc/cfe_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define CFE_VERSION_H

/* Development Build Macro Definitions */
#define CFE_BUILD_NUMBER 739 /**< @brief Development: Number of development commits since baseline */
#define CFE_BUILD_NUMBER 746 /**< @brief Development: Number of development commits since baseline */
#define CFE_BUILD_BASELINE "v6.8.0-rc1" /**< @brief Development: Reference git tag for build number */

/* Version Macro Definitions updated for official releases only */
Expand Down
25 changes: 25 additions & 0 deletions modules/tbl/ut-coverage/tbl_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ CFE_TBL_Handle_t ArrayOfHandles[2];
#define UT_TBL_APPID_3 CFE_ES_APPID_C(CFE_ResourceId_FromInteger(CFE_ES_APPID_BASE + 3))
#define UT_TBL_APPID_10 CFE_ES_APPID_C(CFE_ResourceId_FromInteger(CFE_ES_APPID_BASE + 10))

/* Set up buffer to provide to CFE_ES_GetPoolBuf handler */
#define UT_TBL_LOAD_BUFFER_SIZE \
(CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS * (CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE + sizeof(CFE_ES_PoolAlign_t)))
static union
{
CFE_ES_PoolAlign_t Align;
uint8 Bytes[UT_TBL_LOAD_BUFFER_SIZE];
} UT_TBL_LoadBuffer;

void * Tbl1Ptr = NULL;
void * Tbl2Ptr = NULL;
void **ArrayOfPtrsToTblPtrs[2];
Expand Down Expand Up @@ -1350,7 +1359,13 @@ void Test_CFE_TBL_HousekeepingCmd(void)
*/
void Test_CFE_TBL_ApiInit(void)
{

UT_ResetCDS();

/* Provide a big enough pool for the load buffers */
UT_ResetState(UT_KEY(CFE_ES_GetPoolBuf));
UT_SetDataBuffer(UT_KEY(CFE_ES_GetPoolBuf), &UT_TBL_LoadBuffer, sizeof(UT_TBL_LoadBuffer), false);

CFE_TBL_EarlyInit();
CFE_TBL_Global.TableTaskAppId = UT_TBL_APPID_10;
}
Expand Down Expand Up @@ -3163,12 +3178,16 @@ void Test_CFE_TBL_Internal(void)
UT_InitData();
UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterCDSEx), 1, CFE_ES_CDS_ALREADY_EXISTS);
UT_SetDeferredRetcode(UT_KEY(CFE_ES_RestoreFromCDS), 1, CFE_ES_CDS_BLOCK_CRC_ERR);
UT_ResetState(UT_KEY(CFE_ES_GetPoolBuf));
UT_SetDataBuffer(UT_KEY(CFE_ES_GetPoolBuf), &UT_TBL_LoadBuffer, sizeof(UT_TBL_LoadBuffer), false);
CFE_UtAssert_SUCCESS(CFE_TBL_EarlyInit());
CFE_UtAssert_EVENTCOUNT(0);

/* Test CFE_TBL_EarlyInit response when no CDS is available */
UT_InitData();
UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterCDSEx), 1, CFE_ES_NOT_IMPLEMENTED);
UT_ResetState(UT_KEY(CFE_ES_GetPoolBuf));
UT_SetDataBuffer(UT_KEY(CFE_ES_GetPoolBuf), &UT_TBL_LoadBuffer, sizeof(UT_TBL_LoadBuffer), false);
CFE_UtAssert_SUCCESS(CFE_TBL_EarlyInit());
CFE_UtAssert_EVENTCOUNT(0);

Expand All @@ -3177,13 +3196,17 @@ void Test_CFE_TBL_Internal(void)
*/
UT_InitData();
UT_SetDeferredRetcode(UT_KEY(CFE_ES_CopyToCDS), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID);
UT_ResetState(UT_KEY(CFE_ES_GetPoolBuf));
UT_SetDataBuffer(UT_KEY(CFE_ES_GetPoolBuf), &UT_TBL_LoadBuffer, sizeof(UT_TBL_LoadBuffer), false);
CFE_UtAssert_SUCCESS(CFE_TBL_EarlyInit());
CFE_UtAssert_EVENTCOUNT(0);

/* Reset, then register tables for subsequent tests */
/* a. Reset tables */
UT_InitData();
UT_SetAppID(UT_TBL_APPID_1);
UT_ResetState(UT_KEY(CFE_ES_GetPoolBuf));
UT_SetDataBuffer(UT_KEY(CFE_ES_GetPoolBuf), &UT_TBL_LoadBuffer, sizeof(UT_TBL_LoadBuffer), false);
CFE_UtAssert_SUCCESS(CFE_TBL_EarlyInit());

/* b. Register critical single buffered table */
Expand Down Expand Up @@ -3418,6 +3441,8 @@ void Test_CFE_TBL_Internal(void)
*/
UT_InitData();
UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterCDSEx), 1, CFE_ES_CDS_ALREADY_EXISTS);
UT_ResetState(UT_KEY(CFE_ES_GetPoolBuf));
UT_SetDataBuffer(UT_KEY(CFE_ES_GetPoolBuf), &UT_TBL_LoadBuffer, sizeof(UT_TBL_LoadBuffer), false);
CFE_UtAssert_SUCCESS(CFE_TBL_EarlyInit());
CFE_UtAssert_EVENTCOUNT(0);

Expand Down

0 comments on commit 2afdbc1

Please sign in to comment.