Skip to content

Commit

Permalink
Merge pull request #1884 from skliper/fix1880-fs_coverage
Browse files Browse the repository at this point in the history
Fix #1880, Improve FS coverage
  • Loading branch information
astrogeco authored Aug 30, 2021
2 parents 9072b00 + 6e6b751 commit 6493ddc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions modules/fs/ut-coverage/fs_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/*
** File:
** fss_UT.c
** fs_UT.c
**
** Purpose:
** File Services unit test
Expand Down Expand Up @@ -119,12 +119,15 @@ void Test_CFE_FS_ReadHeader(void)
UT_SetDefaultReturnValue(UT_KEY(OS_lseek), OS_ERROR);
UtAssert_INT32_EQ(CFE_FS_ReadHeader(&Hdr, FileDes), CFE_STATUS_EXTERNAL_RESOURCE_FAIL);

/* Test successfully reading the header */
/* Test reading header with OS_read failure */
UT_InitData();
UT_SetDeferredRetcode(UT_KEY(OS_lseek), 1, OS_SUCCESS);
UT_SetDefaultReturnValue(UT_KEY(OS_read), OS_ERROR);
UtAssert_INT32_EQ(CFE_FS_ReadHeader(&Hdr, FileDes), CFE_STATUS_EXTERNAL_RESOURCE_FAIL);

/* Test successfully reading the header */
UT_InitData();
UtAssert_INT32_EQ(CFE_FS_ReadHeader(&Hdr, FileDes), sizeof(Hdr));

/* Test calling with NULL pointer argument */
UtAssert_INT32_EQ(CFE_FS_ReadHeader(NULL, FileDes), CFE_FS_BAD_ARGUMENT);
}
Expand Down

0 comments on commit 6493ddc

Please sign in to comment.