Skip to content

Commit

Permalink
Update #116, cleanup unit tests
Browse files Browse the repository at this point in the history
A significant cleanup and overhaul of CF unit tests
to follow patterns that are more consistent with
other CFE/OSAL test modules.

Since the FSW change in this PR requires significant test updates
to go with it, this replaces all the "cfdp" tests with new
implementations where there is a 1:1 ratio between test
functions and implementation functions.

Ths also does some minor cleanup on the FSW side where needed
for testability.

Note that all stub files in this version are now directly generated
using the tool provided with UtAssert.  These generated stubs should
not be modified.
  • Loading branch information
jphickey committed Jan 6, 2022
1 parent 98801ae commit 3acc447
Show file tree
Hide file tree
Showing 55 changed files with 9,581 additions and 26,117 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@ add_definitions("-D_DEFAULT_SOURCE")
add_definitions(-D_DEFAULT_SOURCE=1)
add_definitions(-D_EL -DENDIAN=_EL -DSOFTWARE_BIG_BIT_ORDER)
if (ENABLE_UNIT_TESTS)
#PENDING: unit test still needs update in this version, does not build
#add_subdirectory(unit-test)
add_subdirectory(unit-test)
endif (ENABLE_UNIT_TESTS)
6 changes: 3 additions & 3 deletions fsw/platform_inc/cf_tbldefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ typedef struct CF_ConfigTable

CF_ChannelConfig_t chan[CF_NUM_CHANNELS];

uint32 ack_timer_s; /* in seconds */
uint32 nak_timer_s; /* in seconds */
uint32 inactivity_timer_s; /* in seconds */
uint32 ack_timer_s; /* in seconds */
uint32 nak_timer_s; /* in seconds */
uint32 inactivity_timer_s; /* in seconds */

uint8 ack_limit; /* number of times to retry ACK (for ex, send fin and wait for fin-ack) */
uint8 nak_limit; /* number of times to retry NAK before giving up (resets on a single response */
Expand Down
51 changes: 0 additions & 51 deletions fsw/src/cf_cfdp_helpers.c

This file was deleted.

208 changes: 0 additions & 208 deletions fsw/src/cf_cfdp_helpers.h

This file was deleted.

4 changes: 3 additions & 1 deletion fsw/src/cf_cfdp_sbintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ void CF_CFDP_ReceiveMessage(CF_Channel_t *c)
CF_EID_ERR_CFDP_RX_DROPPED, CFE_EVS_EventType_ERROR,
"CF: dropping packet from %lu transaction number 0x%08lx due max RX transactions reached",
(unsigned long)ph->pdu_header.source_eid, (unsigned long)ph->pdu_header.sequence_num);
++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.dropped;

/* NOTE: as there is no transaction (t) associated with this, there is no known channel,
and therefore no known counter to account it to (because dropped is per-chan) */
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/cf_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void CF_FreeTransaction(CF_Transaction_t *t)
** \endreturns
**
*************************************************************************/
static int CF_FindTransactionBySequenceNumber_(CF_CListNode_t *n, trans_seq_arg_t *context)
int CF_FindTransactionBySequenceNumber_(CF_CListNode_t *n, trans_seq_arg_t *context)
{
CF_Transaction_t *t = container_of(n, CF_Transaction_t, cl_node);
int ret = 0;
Expand Down
2 changes: 2 additions & 0 deletions fsw/src/cf_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ void CF_FreeTransaction(CF_Transaction_t *t);
CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *c, CF_TransactionSeq_t transaction_sequence_number,
CF_EntityId_t src_eid);

int CF_FindTransactionBySequenceNumber_(CF_CListNode_t *n, trans_seq_arg_t *context);

int32 CF_WriteQueueDataToFile(int32 fd, CF_Channel_t *c, CF_QueueIdx_t q);
int32 CF_WriteHistoryQueueDataToFile(int32 fd, CF_Channel_t *c, CF_Direction_t dir);

Expand Down
Loading

0 comments on commit 3acc447

Please sign in to comment.