From 6e6b75102c22485d64353ac3c05adf9064ef5f66 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Wed, 25 Aug 2021 14:50:38 +0000 Subject: [PATCH] Fix #1880, Improve FS coverage --- modules/fs/ut-coverage/fs_UT.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/fs/ut-coverage/fs_UT.c b/modules/fs/ut-coverage/fs_UT.c index b670d1bcc..a0508955f 100644 --- a/modules/fs/ut-coverage/fs_UT.c +++ b/modules/fs/ut-coverage/fs_UT.c @@ -20,7 +20,7 @@ /* ** File: -** fss_UT.c +** fs_UT.c ** ** Purpose: ** File Services unit test @@ -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); }