Skip to content

Commit

Permalink
Merge pull request #1808 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
cFE Integration candidate 2021-08-17
  • Loading branch information
astrogeco authored Aug 17, 2021
2 parents eb9c523 + aef08fc commit a0c2de6
Show file tree
Hide file tree
Showing 36 changed files with 1,130 additions and 268 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,14 @@ jobs:
- name: List cpu1
run: ls build/exe/cpu1/

# Run cFS, send commands to set perf trigger and start perf data, and run functional tests
- name: Run cFS
run: |
./core-cpu1 &
sleep 10
../host/cmdUtil --pktid=0x1806 --cmdcode=4 --endian=LE --string="20:CFE_TEST_APP" --string="20:CFE_TestMain" --string="64:cfe_testcase" --uint32=16384 --uint8=0 --uint8=0 --uint16=100 &
../host/cmdUtil --pktid=0x1806 --cmdcode=17 --endian=LE --uint32=3 --uint32=0x40000000
../host/cmdUtil --pktid=0x1806 --cmdcode=14 --endian=LE --uint32=2
../host/cmdUtil --pktid=0x1806 --cmdcode=4 --endian=LE --string="20:CFE_TEST_APP" --string="20:CFE_TestMain" --string="64:cfe_testcase" --uint32=16384 --uint8=0 --uint8=0 --uint16=100
sleep 30
counter=0
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob

## Version History

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

- Add CFE assert macros to functional test
- Adds invalid id syslog to for CFE_ES_DeleteApp and CFE_ES_ReloadApp and verifies required reporting
- Stop memory leak & add cds size test.
- Mark read only inputs as const
- Check resource ID idx is less than max
- Update CFE_ES_RunLoop documentation
- Add Message Api Functional Test
- Partial #1724, update in/out status and nonnull/nonzero tags
- Add External Time Source Functional Tests
- Add Perf API functional tests
See <https://github.com/nasa/cFE/pull/1808> and <https://github.com/nasa/cFS/pull/337>

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

- Move global count into test global struct
Expand All @@ -25,6 +39,7 @@ The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob
- Replace cFE_FTAssert_VOIDCALL with new UtAssert_VOIDCALL
- Remove multiple instantiations of CFE_FT_Global
- Add functional tests for cFE Table APIs
- See <https://github.com/nasa/cFE/pull/1759> and <https://github.com/nasa/cFS/pull/328>

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

Expand Down
131 changes: 131 additions & 0 deletions modules/cfe_assert/inc/cfe_assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,118 @@
*************************************************************************/
#include "common_types.h"
#include "cfe_es_api_typedefs.h"
#include "utassert.h"
#include "cfe_error.h"

/************************************************************************
** Type Definitions
*************************************************************************/

typedef void (*CFE_Assert_StatusCallback_t)(uint8 MessageType, const char *Prefix, const char *OutputMessage);

/*************************************************************************
** CFE-specific assertion macros
** (similar to macros in the CFE coverage test)
*************************************************************************/

/*****************************************************************************/
/**
** \brief Asserts the nominal execution of the function being tested.
**
** \par Description
** The core of each unit test is the execution of the function being tested.
** This function and macro should be used to test the nominal execution of the
** function; the expectation is that it will return CFE_SUCCESS or an
** unspecified positive value.
**
** \par Assumptions, External Events, and Notes:
** None
**
******************************************************************************/
#define CFE_UtAssert_STATUS_OK(FN) \
CFE_UtAssert_StatusCheck(FN, true, UTASSERT_CASETYPE_FAILURE, __FILE__, __LINE__, #FN)

/*****************************************************************************/
/**
** \brief Asserts the off-nominal execution of the function being tested.
**
** \par Description
** The core of each unit test is the execution of the function being tested.
** This function and macro should be used to test the generic off-nominal execution
** of the function; the expectation is that it will return an unspecified negative
** value.
**
** \par Assumptions, External Events, and Notes:
** This should be used in cases where a specific error for a particular condition
** is not known/documented. Whenever a specific error is indicated by the documentation,
** 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)

/*****************************************************************************/
/**
** \brief Macro to check CFE resource ID for equality
**
** \par Description
** A macro that checks two resource ID values for equality.
**
** \par Assumptions, External Events, and Notes:
** The generic #UtAssert_UINT32_EQ check should not be used, as ID values
** and integers may not be interchangable with strict type checking.
**
******************************************************************************/
#define CFE_UtAssert_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)

/*****************************************************************************/
/**
** \brief Check if a Resource ID is Undefined
**
** \par Description
** A macro that checks if resource ID value is undefined.
**
** \par Assumptions, External Events, and Notes:
** This utilizes the "TEST_DEFINED" macro provided by the resourceid module, as the
** set of undefined IDs is more than the single value of CFE_RESOURCEID_UNDEFINED.
**
******************************************************************************/
#define CFE_UtAssert_RESOURCEID_UNDEFINED(id) \
UtAssert_True(!CFE_RESOURCEID_TEST_DEFINED(id), "%s (0x%lx) not defined", #id, CFE_RESOURCEID_TO_ULONG(id))

/*****************************************************************************/
/**
** \brief Macro to check CFE memory size/offset for equality
**
** \par Description
** A macro that checks two memory offset/size values for equality.
**
** \par Assumptions, External Events, and Notes:
** This is a simple unsigned comparison which logs the values as hexadecimal
**
******************************************************************************/
#define CFE_UtAssert_MEMOFFSET_EQ(off1, off2) \
UtAssert_GenericUnsignedCompare(off1, UtAssert_Compare_EQ, off2, UtAssert_Radix_HEX, __FILE__, __LINE__, \
"Offset Check: ", #off1, #off2)

/*****************************************************************************/
/**
** \brief Macro to check CFE message ID for equality
**
** \par Description
** A macro that checks two message ID values for equality.
**
** \par Assumptions, External Events, and Notes:
** The generic #UtAssert_UINT32_EQ check should not be used, as CFE_SB_MsgId_t values
** and integers may not be interchangable with strict type checking.
**
******************************************************************************/
#define CFE_UtAssert_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)

/*************************************************************************
** Exported Functions
*************************************************************************/
Expand Down Expand Up @@ -145,4 +250,30 @@ int32 CFE_Assert_OpenLogFile(const char *Filename);
*/
void CFE_Assert_CloseLogFile(void);

/*****************************************************************************/
/**
** \brief Helper function for nominal CFE calls
**
** \par Description
** This helper function wraps the normal UtAssert function, intended for verifying
** CFE API calls that are expected to return successfully.
**
** Note that this checks for a logical "success", which includes the specific #CFE_SUCCESS
** status code, as well as all other status codes that represent a successful completion
** of the function objectives (i.e. such as a nonzero size, from functions that return a
** size).
**
** This can also be used to report with an alternative pass/fail marker by passing the CaseType
** parameter appropriately.
**
** \par Assumptions, External Events, and Notes:
** Note this will accept any non-negative value as logical "success", so it
** also works with functions that return a size or other non-error status.
**
** \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);

#endif /* CFE_ASSERT_H */
20 changes: 20 additions & 0 deletions modules/cfe_assert/src/cfe_assert_runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,26 @@ 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 Result = (Status >= CFE_SUCCESS);
const char *MatchText;

if (ExpectSuccess)
{
MatchText = "OK";
}
else
{
/* expecting non-success; result should be inverted */
Result = !Result;
MatchText = "ERROR";
}

return UtAssertEx(Result, CaseType, File, Line, "%s (0x%lx) is %s", Text, (unsigned long)Status, MatchText);
}

void CFE_Assert_StatusReport(uint8 MessageType, const char *Prefix, const char *OutputMessage)
{
uint16 EventType;
Expand Down
4 changes: 4 additions & 0 deletions modules/cfe_testcase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,21 @@ add_cfe_app(cfe_testcase
src/cfe_test.c
src/cfe_test_table.c
src/es_application_control_test.c
src/es_behavior_test.c
src/es_info_test.c
src/es_task_test.c
src/es_cds_test.c
src/es_counter_test.c
src/es_misc_test.c
src/es_mempool_test.c
src/es_perf_test.c
src/es_resource_id_test.c
src/evs_filters_test.c
src/evs_send_test.c
src/fs_header_test.c
src/fs_util_test.c
src/message_id_test.c
src/msg_api_test.c
src/sb_pipe_mang_test.c
src/tbl_content_access_test.c
src/tbl_content_mang_test.c
Expand All @@ -26,6 +29,7 @@ add_cfe_app(cfe_testcase
src/time_arithmetic_test.c
src/time_current_test.c
src/time_conversion_test.c
src/time_external_test.c
src/time_misc_test.c
)

Expand Down
6 changes: 5 additions & 1 deletion modules/cfe_testcase/src/cfe_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,30 @@ void CFE_TestMain(void)
* Register test cases in UtAssert
*/
ESApplicationControlTestSetup();
ESBehaviorestSetup();
ESCDSTestSetup();
ESCounterTestSetup();
ESInfoTestSetup();
ESMemPoolTestSetup();
ESMiscTestSetup();
ESPerfTestSetup();
ESResourceIDTestSetup();
ESTaskTestSetup();
EVSFiltersTestSetup();
EVSSendTestSetup();
FSHeaderTestSetup();
FSUtilTestSetup();
MessageIdTestSetup();
MsgApiTestSetup();
SBPipeMangSetup();
TBLContentAccessTestSetup();
TBLContentMangTestSetup();
TBLInformationTestSetup();
TBLRegistrationTestSetup();
TimeArithmeticTestSetup();
TimeCurrentTestSetup();
TimeConversionTestSetup();
TimeCurrentTestSetup();
TimeExternalTestSetup();
TimeMiscTestSetup();

/*
Expand Down
10 changes: 9 additions & 1 deletion modules/cfe_testcase/src/cfe_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

#include "uttest.h"
#include "utassert.h"
#include "cfe_assert.h"

typedef struct
{
Expand Down Expand Up @@ -86,30 +87,37 @@ extern CFE_FT_Global_t CFE_FT_Global;
UtAssert_True(rcact < CFE_SUCCESS, "%s == (%ld) ", #actual, (long)rcact); \
} while (0)

/* Assert if status is CFE_SUCCESS */
#define cFE_FTAssert_SUCCESS(status) UtAssert_INT32_EQ(status, CFE_SUCCESS)

bool TimeInRange(CFE_TIME_SysTime_t Time, CFE_TIME_SysTime_t Target, OS_time_t difference);

void CFE_TestMain(void);
void ESApplicationControlTestSetup(void);
void ESBehaviorestSetup(void);
void ESCDSTestSetup(void);
void ESCounterTestSetup(void);
void ESInfoTestSetup(void);
void ESMemPoolTestSetup(void);
void ESMiscTestSetup(void);
void ESPerfTestSetup(void);
void ESResourceIDTestSetup(void);
void ESTaskTestSetup(void);
void EVSFiltersTestSetup(void);
void EVSSendTestSetup(void);
void FSHeaderTestSetup(void);
void FSUtilTestSetup(void);
void MessageIdTestSetup(void);
void MsgApiTestSetup(void);
void SBPipeMangSetup(void);
void TBLContentAccessTestSetup(void);
void TBLContentMangTestSetup(void);
void TBLInformationTestSetup(void);
void TBLRegistrationTestSetup(void);
void TimeArithmeticTestSetup(void);
void TimeCurrentTestSetup(void);
void TimeConversionTestSetup(void);
void TimeCurrentTestSetup(void);
void TimeExternalTestSetup(void);
void TimeMiscTestSetup(void);

#endif /* CFE_TEST_H */
Loading

0 comments on commit a0c2de6

Please sign in to comment.