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

[nasa/nos3#176] Unit Tests #2

Merged
merged 18 commits into from
Aug 6, 2024
Merged

[nasa/nos3#176] Unit Tests #2

merged 18 commits into from
Aug 6, 2024

Conversation

jlucas9
Copy link
Member

@jlucas9 jlucas9 commented Jul 31, 2024

No description provided.

havencarlson and others added 18 commits September 20, 2023 11:06
Fix nasa#116, Removed command header from payload struct
Fix nasa#111: Use correct length filename for too large test
Fix nasa#119, remove dependency on MID_BASE defines
Fix nasa#121, correct casting on printf format strings
Fix nasa#115, Adds distinct identifiers from command name
Fix nasa#125, Adds utassert macro for logging function calls
Fix nasa#95, Replaces conditionally compiled code with runtime conditional logic
… snprintf

This commit addresses issues flagged during static analysis by:
- Adding JSC 2.1 disposition comments.
- Replacing strncpy with snprintf to enhance safety and compliance.
- Changes DS_TABLE_VERIFY_ERR from 0xFFFFFFFF to -1
Fix nasa#127, Adds static analysis comments and replace strncpy with snprintf
@jlucas9 jlucas9 self-assigned this Jul 31, 2024
@@ -1145,7 +1145,7 @@
CFE_EVS_SendEvent(DS_ADD_MID_CMD_ERR_EID, CFE_EVS_EventType_ERROR,
"Invalid ADD MID command: filter table is not loaded");
}
else if ((FilterTableIndex = DS_TableFindMsgID(DS_AddMidCmd->MessageID)) != DS_INDEX_NONE)
else if ((FilterTableIndex = DS_TableFindMsgID(PayloadPtr->MessageID)) != DS_INDEX_NONE)

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning

This Boolean expression is not side-effect free.
@@ -53,15 +53,15 @@
/* Apply common filter algorithm to Software Bus packet */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool DS_IsPacketFiltered(CFE_MSG_Message_t *MessagePtr, uint16 FilterType, uint16 Algorithm_N, uint16 Algorithm_X,
int32 DS_IsPacketFiltered(CFE_MSG_Message_t *MessagePtr, uint16 FilterType, uint16 Algorithm_N, uint16 Algorithm_X,

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
@@ -77,7 +77,7 @@

#include <stdio.h>

bool DS_VerifyLength(const CFE_SB_Buffer_t *BufPtr, size_t ExpectedLength, uint16 FailEventID, const char *CommandName)
int32 DS_VerifyLength(const CFE_SB_Buffer_t *BufPtr, size_t ExpectedLength, uint16 FailEventID, const char *CommandName)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
@@ -681,9 +682,9 @@
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

bool DS_TableVerifyParms(uint16 Algorithm_N, uint16 Algorithm_X, uint16 Algorithm_O)
int32 DS_TableVerifyParms(uint16 Algorithm_N, uint16 Algorithm_X, uint16 Algorithm_O)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
@@ -639,10 +640,10 @@
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

bool DS_TableEntryUnused(const void *TableEntry, int32 BufferSize)
int32 DS_TableEntryUnused(const void *TableEntry, int32 BufferSize)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
@@ -562,11 +563,11 @@
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

bool DS_TableVerifyFilterEntry(DS_PacketEntry_t *PacketEntry, int32 TableIndex, int32 ErrorCount)
int32 DS_TableVerifyFilterEntry(DS_PacketEntry_t *PacketEntry, int32 TableIndex, int32 ErrorCount)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
@@ -440,10 +441,10 @@
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

bool DS_TableVerifyDestFileEntry(DS_DestFileEntry_t *DestFileEntry, uint8 TableIndex, int32 ErrorCount)
int32 DS_TableVerifyDestFileEntry(DS_DestFileEntry_t *DestFileEntry, uint8 TableIndex, int32 ErrorCount)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
@@ -53,15 +53,15 @@
/* Apply common filter algorithm to Software Bus packet */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool DS_IsPacketFiltered(CFE_MSG_Message_t *MessagePtr, uint16 FilterType, uint16 Algorithm_N, uint16 Algorithm_X,
int32 DS_IsPacketFiltered(CFE_MSG_Message_t *MessagePtr, uint16 FilterType, uint16 Algorithm_N, uint16 Algorithm_X,

Check notice

Code scanning / CodeQL

Function too long Note

DS_IsPacketFiltered has too many lines (124, while 60 are allowed).
@@ -562,11 +563,11 @@
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

bool DS_TableVerifyFilterEntry(DS_PacketEntry_t *PacketEntry, int32 TableIndex, int32 ErrorCount)
int32 DS_TableVerifyFilterEntry(DS_PacketEntry_t *PacketEntry, int32 TableIndex, int32 ErrorCount)

Check notice

Code scanning / CodeQL

Function too long Note

DS_TableVerifyFilterEntry has too many lines (70, while 60 are allowed).
@@ -440,10 +441,10 @@
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

bool DS_TableVerifyDestFileEntry(DS_DestFileEntry_t *DestFileEntry, uint8 TableIndex, int32 ErrorCount)
int32 DS_TableVerifyDestFileEntry(DS_DestFileEntry_t *DestFileEntry, uint8 TableIndex, int32 ErrorCount)

Check notice

Code scanning / CodeQL

Function too long Note

DS_TableVerifyDestFileEntry has too many lines (63, while 60 are allowed).
@jlucas9 jlucas9 merged commit d17e750 into nos3-dev Aug 6, 2024
29 of 30 checks passed
@jlucas9 jlucas9 deleted the nos3#176-unit-tests branch August 6, 2024 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants