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

Fix #2110, Add CFE_ES_StatusToString and CFE_STATUS_C #2113

Merged
merged 1 commit into from
Jun 22, 2022

Conversation

skliper
Copy link
Contributor

@skliper skliper commented Jun 6, 2022

Checklist (Please check before submitting)

Describe the contribution

Adds CFE_ES_StatusToString and CFE_STATUS_C

Testing performed
CI (coverage tests and app testcase functional)

Expected behavior changes
None, just adds useful APIs for future cleanup

System(s) tested on
CI

Additional context
None

Third party code
None

Contributor Info - All information REQUIRED for consideration of pull request
None

@skliper skliper force-pushed the fix2110-add_statustostring branch 2 times, most recently from f7785db to 87bde9e Compare June 6, 2022 21:23
@skliper skliper added the CCB:Ready Ready for discussion at the Configuration Control Board (CCB) label Jun 6, 2022
modules/es/fsw/src/cfe_es_api.c Fixed Show fixed Hide fixed
void TestStatusToString(void)
{
/* NULL test */
UtAssert_ADDRESS_EQ(CFE_ES_StatusToString(CFE_SUCCESS, NULL), NULL);

Check warning

Code scanning / CodeQL-coding-standard

Unchecked return value

The return value of non-void function [UtAssert_GenericUnsignedCompare](1) is not checked.
char expected[CFE_STATUS_STRING_LENGTH + 1];

/* Used oversized string to test for truncation */
snprintf(expected, sizeof(expected), "0x%08x", (unsigned int)status);

Check warning

Code scanning / CodeQL-coding-standard

Unchecked return value

The return value of non-void function [snprintf](1) is not checked.
modules/es/ut-coverage/es_UT.c Fixed Show fixed Hide fixed
snprintf(expected, sizeof(expected), "0x%08x", (unsigned int)status);
rtn_addr = CFE_ES_StatusToString(status, &status_string);
UtAssert_ADDRESS_EQ(rtn_addr, &status_string);
UtAssert_STRINGBUF_EQ(status_string, sizeof(status_string), expected, sizeof(expected));

Check warning

Code scanning / CodeQL-coding-standard

Unchecked return value

The return value of non-void function [UtAssert_StringBufCompare](1) is not checked.
void TestStatusToString(void)
{
/* NULL test */
UtAssert_ADDRESS_EQ(CFE_ES_StatusToString(CFE_SUCCESS, NULL), NULL);

Check warning

Code scanning / CodeQL-coding-standard

Unchecked return value

The return value of non-void function [UtAssert_GenericUnsignedCompare](1) is not checked.
char expected[CFE_STATUS_STRING_LENGTH + 1];

/* Used oversized string to test for truncation */
snprintf(expected, sizeof(expected), "0x%08x", (unsigned int)status);

Check warning

Code scanning / CodeQL-coding-standard

Unchecked return value

The return value of non-void function [snprintf](1) is not checked.
modules/cfe_testcase/src/es_error_test.c Fixed Show fixed Hide fixed
snprintf(expected, sizeof(expected), "0x%08x", (unsigned int)status);
rtn_addr = CFE_ES_StatusToString(status, &status_string);
UtAssert_ADDRESS_EQ(rtn_addr, &status_string);
UtAssert_STRINGBUF_EQ(status_string, sizeof(status_string), expected, sizeof(expected));

Check warning

Code scanning / CodeQL-coding-standard

Unchecked return value

The return value of non-void function [UtAssert_StringBufCompare](1) is not checked.
@skliper skliper force-pushed the fix2110-add_statustostring branch from 87bde9e to 6c8f494 Compare June 6, 2022 23:20
/* Used oversized string to test for truncation */
snprintf(expected, sizeof(expected), "0x%08x", (unsigned int)status);
rtn_addr = CFE_ES_StatusToString(status, &status_string);
UtAssert_ADDRESS_EQ(rtn_addr, status_string);

Check warning

Code scanning / CodeQL-coding-standard

Unchecked return value

The return value of non-void function [UtAssert_GenericUnsignedCompare](1) is not checked.

if (status_string != NULL)
{
snprintf(*status_string, sizeof(*status_string), "0x%08x", (unsigned int)status);

Check warning

Code scanning / CodeQL-coding-standard

Unchecked return value

The return value of non-void function [snprintf](1) is not checked.
@astrogeco
Copy link
Contributor

CCB:2022-06-08 APPROVED

@astrogeco astrogeco added CCB:Approved Indicates code review and approval by community CCB and removed CCB:Ready Ready for discussion at the Configuration Control Board (CCB) labels Jun 8, 2022
astrogeco added a commit to nasa/cFS that referenced this pull request Jun 10, 2022
nasa/cFE#2113, Add CFE_ES_StatusToString and CFE_STATUS_C

nasa/cFE#2115, Add macro for initializing command header
astrogeco added a commit to nasa/cFS that referenced this pull request Jun 20, 2022
nasa/cFE#2119, Endian macro mask before shift to avoid shift overflow warning
nasa/cFE#2115, Add macro for initializing command header
nasa/cFE#2113, Add CFE_ES_StatusToString and CFE_STATUS_C
astrogeco added a commit to nasa/cFS that referenced this pull request Jun 20, 2022
nasa/cFE#2119, Endian macro mask before shift to avoid shift overflow warning
nasa/cFE#2115, Add macro for initializing command header
nasa/cFE#2113, Add CFE_ES_StatusToString and CFE_STATUS_C
astrogeco added a commit to nasa/cFS that referenced this pull request Jun 21, 2022
nasa/cFE#2119, Endian macro mask before shift to avoid shift overflow warning
nasa/cFE#2115, Add macro for initializing command header
nasa/cFE#2113, Add CFE_ES_StatusToString and CFE_STATUS_C
astrogeco added a commit to nasa/cFS that referenced this pull request Jun 22, 2022
*Combines:*

cFE  v7.0.0-rc4+dev143
osal osal v6.0.0-rc4+dev87
psp v1.6.0-rc4+dev

ci_lab v2.5.0-rc4+dev22
to_lab v2.5.0-rc4+dev21
sample_app v1.3.0-rc4+dev21

**Includes:**

- nasa/cFE#2119, Endian macro mask before shift to avoid shift overflow warning
- nasa/cFE#2115, Add macro for initializing command header

*Add StatusToString API*
- nasa/osal#1259, Add OS_StatusToString API
- nasa/PSP#347, Add CFE_PSP_StatusToString and CFE_PSP_STATUS_C
- nasa/cFE#2113, Add CFE_ES_StatusToString and CFE_STATUS_C

*Remove registration of empty EVS filters*
- nasa/ci_lab#111, Remove registration of empty EVS filters
- nasa/to_lab#122, Remove registration of empty EVS filters
- nasa/sample_app#175, Remove registration of empty event filters
astrogeco added a commit to nasa/cFS that referenced this pull request Jun 22, 2022
*Combines:*

cFE  v7.0.0-rc4+dev143
osal osal v6.0.0-rc4+dev87
psp v1.6.0-rc4+dev

ci_lab v2.5.0-rc4+dev22
to_lab v2.5.0-rc4+dev21
sample_app v1.3.0-rc4+dev21

**Includes:**

- nasa/cFE#2119, Endian macro mask before shift to avoid shift overflow warning
- nasa/cFE#2115, Add macro for initializing command header

*Add StatusToString API*
- nasa/osal#1259, Add OS_StatusToString API
- nasa/PSP#347, Add CFE_PSP_StatusToString and CFE_PSP_STATUS_C
- nasa/cFE#2113, Add CFE_ES_StatusToString and CFE_STATUS_C

*Remove registration of empty EVS filters*
- nasa/ci_lab#111, Remove registration of empty EVS filters
- nasa/to_lab#122, Remove registration of empty EVS filters
- nasa/sample_app#175, Remove registration of empty event filters

Co-authored-by: Jacob Hageman <[email protected]>
@astrogeco astrogeco merged commit e48d7ed into nasa:main Jun 22, 2022
@skliper skliper added this to the Draco milestone Jul 19, 2022
@skliper skliper deleted the fix2110-add_statustostring branch September 1, 2023 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CCB:Approved Indicates code review and approval by community CCB draco-rc2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add CFE_Status_t conversion macros/functions
2 participants