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 #1880, Improve FS coverage #1884

Merged
merged 1 commit into from
Aug 30, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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