Skip to content

Commit

Permalink
Merge pull request #76 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
Integration Candidate: 2020-06-10
  • Loading branch information
astrogeco authored Jun 17, 2020
2 parents 4a4b8e2 + 2a6b755 commit 71d2c32
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 33 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include_directories(${sample_lib_MISSION_DIR}/fsw/public_inc)
add_cfe_app(sample_app fsw/src/sample_app.c)

# Add table
add_cfe_tables(sampleTable fsw/src/sample_table.c)
add_cfe_tables(sampleAppTable fsw/tables/sample_app_tbl.c)

# If UT is enabled, then add the tests from the subdirectory
# Note that this is an app, and therefore does not provide
Expand All @@ -21,4 +21,3 @@ add_cfe_tables(sampleTable fsw/src/sample_table.c)
if (ENABLE_UNIT_TESTS)
add_subdirectory(unit-test)
endif (ENABLE_UNIT_TESTS)

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ sample_app is an example for how to build and link an application in cFS. See al

## Version History

### Development Build: 1.1.11

- Move the table to fsw/tables and renames "sample_table" to "sample_app_table
- See <https://github.com/nasa/sample_app/pull/76>

### Development Build: 1.1.10

- Test cases now compare an expected event string with a string derived from the spec string and arguments that were output by the unit under test.
- Replace references to `ccsds.h` types with the `cfe_sb.h`-provided type.
- See <https://github.com/nasa/sample_app/pull/71>
Expand Down
12 changes: 6 additions & 6 deletions fsw/src/sample_table.h → fsw/platform_inc/sample_app_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
** See the License for the specific language governing permissions and
** limitations under the License.
**
** File: sample_table.h
** File: sample_app_table.h
**
** Purpose:
** Define sample table
** Define sample app table
**
** Notes:
**
**
*******************************************************************************/
#ifndef _sample_table_h_
#define _sample_table_h_
#ifndef _sample_app_table_h_
#define _sample_app_table_h_

/*
** Table structure
Expand All @@ -38,9 +38,9 @@ typedef struct
uint16 Int1;
uint16 Int2;

} SAMPLE_Table_t;
} SAMPLE_APP_Table_t;

#endif /* _sample_table_h_ */
#endif /* _sample_app_table_h_ */

/************************/
/* End of File Comment */
Expand Down
23 changes: 11 additions & 12 deletions fsw/src/sample_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "sample_app_events.h"
#include "sample_app_version.h"
#include "sample_app.h"
#include "sample_table.h"
#include "sample_app_table.h"

/* The sample_lib module provides the SAMPLE_Function() prototype */
#include <string.h>
Expand Down Expand Up @@ -220,22 +220,21 @@ int32 SAMPLE_AppInit( void )
** Register Table(s)
*/
status = CFE_TBL_Register(&SAMPLE_AppData.TblHandles[0],
"SampleTable",
sizeof(SAMPLE_Table_t),
"SampleAppTable",
sizeof(SAMPLE_APP_Table_t),
CFE_TBL_OPT_DEFAULT,
SAMPLE_TblValidationFunc);
if ( status != CFE_SUCCESS )
{
CFE_ES_WriteToSysLog("Sample App: Error Registering \
Table, RC = 0x%08lX\n", (unsigned long)status);
CFE_ES_WriteToSysLog("Sample App: Error Registering Table, RC = 0x%08lX\n", (unsigned long)status);

return ( status );
}
else
{
status = CFE_TBL_Load(SAMPLE_AppData.TblHandles[0],
CFE_TBL_SRC_FILE,
SAMPLE_TABLE_FILE);
SAMPLE_APP_TABLE_FILE);
}

CFE_EVS_SendEvent (SAMPLE_STARTUP_INF_EID,
Expand Down Expand Up @@ -430,8 +429,8 @@ int32 SAMPLE_ResetCounters( const SAMPLE_ResetCounters_t *Msg )
int32 SAMPLE_Process( const SAMPLE_Process_t *Msg )
{
int32 status;
SAMPLE_Table_t *TblPtr;
const char *TableName = "SAMPLE_APP.SampleTable";
SAMPLE_APP_Table_t *TblPtr;
const char *TableName = "SAMPLE_APP.SampleAppTable";

/* Sample Use of Table */

Expand Down Expand Up @@ -511,20 +510,20 @@ bool SAMPLE_VerifyCmdLength( CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength )
int32 SAMPLE_TblValidationFunc( void *TblData )
{
int32 ReturnCode = CFE_SUCCESS;
SAMPLE_Table_t *TblDataPtr = (SAMPLE_Table_t *)TblData;
SAMPLE_APP_Table_t *TblDataPtr = (SAMPLE_APP_Table_t *)TblData;

/*
** Sample Table Validation
*/
if (TblDataPtr->Int1 > SAMPLE_TBL_ELEMENT_1_MAX)
if (TblDataPtr->Int1 > SAMPLE_APP_TBL_ELEMENT_1_MAX)
{
/* First element is out of range, return an appropriate error code */
ReturnCode = SAMPLE_TABLE_OUT_OF_RANGE_ERR_CODE;
ReturnCode = SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE;
}

return ReturnCode;

} /* End of Sample_TblValidationFunc*/
} /* End of SAMPLE_TBLValidationFunc() */

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down
6 changes: 3 additions & 3 deletions fsw/src/sample_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
#define SAMPLE_NUMBER_OF_TABLES 1 /* Number of Table(s) */

/* Define filenames of default data images for tables */
#define SAMPLE_TABLE_FILE "/cf/sample_table.tbl"
#define SAMPLE_APP_TABLE_FILE "/cf/sample_app_tbl.tbl"

#define SAMPLE_TABLE_OUT_OF_RANGE_ERR_CODE -1
#define SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE -1

#define SAMPLE_TBL_ELEMENT_1_MAX 10
#define SAMPLE_APP_TBL_ELEMENT_1_MAX 10
/************************************************************************
** Type Definitions
*************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/sample_app_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#define SAMPLE_APP_MAJOR_VERSION 1
#define SAMPLE_APP_MINOR_VERSION 1
#define SAMPLE_APP_REVISION 10
#define SAMPLE_APP_REVISION 11
#define SAMPLE_APP_MISSION_REV 0


Expand Down
7 changes: 4 additions & 3 deletions fsw/src/sample_table.c → fsw/tables/sample_app_tbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
*/

#include "cfe_tbl_filedef.h" /* Required to obtain the CFE_TBL_FILEDEF macro definition */
#include "sample_table.h"
#include "sample_app_table.h"

/*
** The following is an example of the declaration statement that defines the desired
** contents of the table image.
*/
SAMPLE_Table_t sampleTable = { 1, 2};
SAMPLE_APP_Table_t SampleAppTable = {1, 2};

/*
** The macro below identifies:
Expand All @@ -36,4 +36,5 @@ SAMPLE_Table_t sampleTable = { 1, 2};
** 3) a brief description of the contents of the file image
** 4) the desired name of the table image binary file that is cFE compatible
*/
CFE_TBL_FILEDEF(sampleTable, SAMPLE_APP.SampleTable, Table Utility Test Table, sample_table.tbl )
CFE_TBL_FILEDEF( SampleAppTable, SAMPLE_APP.SampleAppTable, Table Utility Test Table, sample_app_tbl.tbl )

10 changes: 5 additions & 5 deletions unit-test/coveragetest/coveragetest_sample_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ void Test_SAMPLE_ProcessCC(void)
* void SAMPLE_ProcessCC( const SAMPLE_Process_t *Msg )
*/
SAMPLE_Process_t TestMsg;
SAMPLE_Table_t TestTblData;
SAMPLE_APP_Table_t TestTblData;
void *TblPtr = &TestTblData;

memset(&TestTblData, 0, sizeof(TestTblData));
Expand Down Expand Up @@ -578,17 +578,17 @@ void Test_SAMPLE_TblValidationFunc(void)
* Test Case For:
* int32 SAMPLE_TblValidationFunc( void *TblData )
*/
SAMPLE_Table_t TestTblData;
SAMPLE_APP_Table_t TestTblData;

memset(&TestTblData, 0, sizeof(TestTblData));

/* nominal case (0) should succeed */
UT_TEST_FUNCTION_RC(SAMPLE_TblValidationFunc(&TestTblData), CFE_SUCCESS);

/* error case should return SAMPLE_TABLE_OUT_OF_RANGE_ERR_CODE */
TestTblData.Int1 = 1 + SAMPLE_TBL_ELEMENT_1_MAX;
/* error case should return SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE */
TestTblData.Int1 = 1 + SAMPLE_APP_TBL_ELEMENT_1_MAX;
UT_TEST_FUNCTION_RC(SAMPLE_TblValidationFunc(&TestTblData),
SAMPLE_TABLE_OUT_OF_RANGE_ERR_CODE);
SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE);
}


Expand Down
2 changes: 1 addition & 1 deletion unit-test/coveragetest/sample_app_coveragetest_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <cfe.h>
#include <sample_app_events.h>
#include <sample_app.h>
#include <sample_table.h>
#include <sample_app_table.h>

/*
* Macro to call a function and check its int32 return code
Expand Down

0 comments on commit 71d2c32

Please sign in to comment.