Skip to content

Commit

Permalink
Fix nasa#1393, Move CFE_FS_RunBackgroundFileDump to internal API
Browse files Browse the repository at this point in the history
This function should only be called internally from ES and
therefore does not need to be in public API.
  • Loading branch information
jphickey committed Apr 30, 2021
1 parent b35bc34 commit 439a33d
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 55 deletions.
19 changes: 0 additions & 19 deletions modules/core_api/fsw/inc/cfe_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,25 +321,6 @@ int32 CFE_FS_BackgroundFileDumpRequest(CFE_FS_FileWriteMetaData_t *Meta);
******************************************************************************/
bool CFE_FS_BackgroundFileDumpIsPending(const CFE_FS_FileWriteMetaData_t *Meta);

/*****************************************************************************/
/**
** \brief Execute the background file write job(s)
**
** \par Description
** Runs the state machine associated with background file write requests
**
** \par Assumptions, External Events, and Notes:
** This should only be invoked as a background job from the ES background task,
** it should not be invoked directly.
**
** \param[in] ElapsedTime The amount of time passed since last invocation (ms)
** \param[in] Arg Not used/ignored
**
** \return true if jobs are pending, false if idle
**
******************************************************************************/
bool CFE_FS_RunBackgroundFileDump(uint32 ElapsedTime, void *Arg);

/**@}*/

#endif /* CFE_FS_H */
18 changes: 0 additions & 18 deletions modules/core_api/ut-stubs/src/cfe_fs_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,24 +141,6 @@ void UT_DefaultHandler_CFE_FS_ReadHeader(void *UserObj, UT_EntryKey_t FuncKey, c
}
}

/*------------------------------------------------------------
*
* Default handler for CFE_FS_RunBackgroundFileDump coverage stub function
*
*------------------------------------------------------------*/
void UT_DefaultHandler_CFE_FS_RunBackgroundFileDump(void *UserObj, UT_EntryKey_t FuncKey,
const UT_StubContext_t *Context)
{
int32 status;
bool return_value;

UT_Stub_GetInt32StatusCode(Context, &status);

return_value = status;

UT_Stub_SetReturnValue(FuncKey, return_value);
}

/*------------------------------------------------------------
*
* Default handler for CFE_FS_ParseInputFileNameEx coverage stub function
Expand Down
18 changes: 0 additions & 18 deletions modules/core_api/ut-stubs/src/cfe_fs_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ extern void UT_DefaultHandler_CFE_FS_GetDefaultMountPoint(void *, UT_EntryKey_t,
extern void UT_DefaultHandler_CFE_FS_ParseInputFileName(void *, UT_EntryKey_t, const UT_StubContext_t *);
extern void UT_DefaultHandler_CFE_FS_ParseInputFileNameEx(void *, UT_EntryKey_t, const UT_StubContext_t *);
extern void UT_DefaultHandler_CFE_FS_ReadHeader(void *, UT_EntryKey_t, const UT_StubContext_t *);
extern void UT_DefaultHandler_CFE_FS_RunBackgroundFileDump(void *, UT_EntryKey_t, const UT_StubContext_t *);
extern void UT_DefaultHandler_CFE_FS_WriteHeader(void *, UT_EntryKey_t, const UT_StubContext_t *);

/*
Expand Down Expand Up @@ -194,23 +193,6 @@ CFE_Status_t CFE_FS_ReadHeader(CFE_FS_Header_t *Hdr, osal_id_t FileDes)
return UT_GenStub_GetReturnValue(CFE_FS_ReadHeader, CFE_Status_t);
}

/*
* ----------------------------------------------------
* Generated stub function for CFE_FS_RunBackgroundFileDump()
* ----------------------------------------------------
*/
bool CFE_FS_RunBackgroundFileDump(uint32 ElapsedTime, void *Arg)
{
UT_GenStub_SetupReturnBuffer(CFE_FS_RunBackgroundFileDump, bool);

UT_GenStub_AddParam(CFE_FS_RunBackgroundFileDump, uint32, ElapsedTime);
UT_GenStub_AddParam(CFE_FS_RunBackgroundFileDump, void *, Arg);

UT_GenStub_Execute(CFE_FS_RunBackgroundFileDump, Basic, UT_DefaultHandler_CFE_FS_RunBackgroundFileDump);

return UT_GenStub_GetReturnValue(CFE_FS_RunBackgroundFileDump, bool);
}

/*
* ----------------------------------------------------
* Generated stub function for CFE_FS_SetTimestamp()
Expand Down
20 changes: 20 additions & 0 deletions modules/core_private/fsw/inc/cfe_fs_core_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,26 @@
******************************************************************************/
extern int32 CFE_FS_EarlyInit(void);

/*****************************************************************************/
/**
** \brief Execute the background file write job(s)
**
** \par Description
** Runs the state machine associated with background file write requests
**
** \par Assumptions, External Events, and Notes:
** This should only be invoked as a background job from the ES background task,
** it should not be invoked directly.
**
** \param[in] ElapsedTime The amount of time passed since last invocation (ms)
** \param[in] Arg Not used/ignored
**
** \return true if jobs are pending, false if idle
**
******************************************************************************/
bool CFE_FS_RunBackgroundFileDump(uint32 ElapsedTime, void *Arg);


/**@}*/

#endif /* CFE_FS_CORE_INTERNAL_H */
1 change: 1 addition & 0 deletions modules/core_private/ut-stubs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ add_library(ut_core_private_stubs STATIC
src/cfe_es_core_internal_hooks.c
src/cfe_es_core_internal_stubs.c
src/cfe_evs_core_internal_stubs.c
src/cfe_fs_core_internal_hooks.c
src/cfe_fs_core_internal_stubs.c
src/cfe_sb_core_internal_stubs.c
src/cfe_tbl_core_internal_stubs.c
Expand Down
62 changes: 62 additions & 0 deletions modules/core_private/ut-stubs/src/cfe_fs_core_internal_hooks.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
** GSC-18128-1, "Core Flight Executive Version 6.7"
**
** Copyright (c) 2006-2019 United States Government as represented by
** the Administrator of the National Aeronautics and Space Administration.
** All Rights Reserved.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/

/*
** File: ut_es_stubs.c
**
** Purpose:
** Unit test stubs for Executive Service routines
**
** Notes:
** Minimal work is done, only what is required for unit testing
**
*/

/*
** Includes
*/
#include <string.h>
#include "cfe_fs_core_internal.h"

#include "utstubs.h"
#include "utassert.h"


/*
** Functions
*/

/*------------------------------------------------------------
*
* Default handler for CFE_FS_RunBackgroundFileDump coverage stub function
*
*------------------------------------------------------------*/
void UT_DefaultHandler_CFE_FS_RunBackgroundFileDump(void *UserObj, UT_EntryKey_t FuncKey,
const UT_StubContext_t *Context)
{
int32 status;
bool return_value;

UT_Stub_GetInt32StatusCode(Context, &status);

return_value = status;

UT_Stub_SetReturnValue(FuncKey, return_value);
}
19 changes: 19 additions & 0 deletions modules/core_private/ut-stubs/src/cfe_fs_core_internal_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "cfe_fs_core_internal.h"
#include "utgenstub.h"

extern void UT_DefaultHandler_CFE_FS_RunBackgroundFileDump(void *, UT_EntryKey_t, const UT_StubContext_t *);

/*
* ----------------------------------------------------
* Generated stub function for CFE_FS_EarlyInit()
Expand All @@ -40,3 +42,20 @@ int32 CFE_FS_EarlyInit(void)

return UT_GenStub_GetReturnValue(CFE_FS_EarlyInit, int32);
}

/*
* ----------------------------------------------------
* Generated stub function for CFE_FS_RunBackgroundFileDump()
* ----------------------------------------------------
*/
bool CFE_FS_RunBackgroundFileDump(uint32 ElapsedTime, void *Arg)
{
UT_GenStub_SetupReturnBuffer(CFE_FS_RunBackgroundFileDump, bool);

UT_GenStub_AddParam(CFE_FS_RunBackgroundFileDump, uint32, ElapsedTime);
UT_GenStub_AddParam(CFE_FS_RunBackgroundFileDump, void *, Arg);

UT_GenStub_Execute(CFE_FS_RunBackgroundFileDump, Basic, UT_DefaultHandler_CFE_FS_RunBackgroundFileDump);

return UT_GenStub_GetReturnValue(CFE_FS_RunBackgroundFileDump, bool);
}
1 change: 1 addition & 0 deletions modules/es/fsw/src/cfe_es_backgroundtask.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <string.h>

#include "cfe_es_module_all.h"
#include "cfe_fs_core_internal.h"

#define CFE_ES_BACKGROUND_SEM_NAME "ES_BG_SEM"
#define CFE_ES_BACKGROUND_CHILD_NAME "ES_BG_TASK"
Expand Down

0 comments on commit 439a33d

Please sign in to comment.