You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe. CFE_TBL_Register function contains two hard to reach lines (370-371) that remain untested, preventing us from reaching 100% line coverage.
12: 360: if (Status == CFE_ES_CDS_ALREADY_EXISTS)
: 361: {
4: 362: Status = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, true);
: 363:
4: 364: if (Status != CFE_SUCCESS)
: 365: {
: 366: /* Unable to get a working buffer - this error is not really */
: 367: /* possible at this point during table registration. But we */
: 368: /* do need to handle the error case because if the function */
: 369: /* call did fail, WorkingBufferPtr would be a NULL pointer. */
## 0: 370: CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName));
## 0: 371: CFE_ES_WriteToSysLog("%s: Failed to get work buffer for '%s.%s' (ErrCode=0x%08X)\n",
: 372: __func__, AppName, Name, (unsigned int)Status);
: 373: }
: 374: else
: 375: {
: 376: /* CDS exists for this table - try to restore the data */
4: 377: Status = CFE_ES_RestoreFromCDS(WorkingBufferPtr->BufferPtr, RegRecPtr->CDSHandle);
: 378:
4: 379: if (Status != CFE_SUCCESS)
: 380: {
1: 381: CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName));
1: 382: CFE_ES_WriteToSysLog("%s: Failed to recover '%s.%s' from CDS (ErrCode=0x%08X)\n",
: 383: __func__, AppName, Name, (unsigned int)Status);
: 384: }
: 385: }
Describe the solution you'd like
These lines should be safe to leave uncovered because they do not contain any potential to access a NULL pointer or anything else similarly dangerous.
Additional context
Lines 370 and 371 are currently impossible to cover as noted in the code comment because line 362 calls GetWorkingBuffer with true for the third argument which skips over anything that could return a non CFE_SUCCESS code.
Requester Info
Niall Mullane - GSFC 582 Intern
The text was updated successfully, but these errors were encountered:
nmullane
changed the title
Missing coverage in cfe_tbl_api.c
Missing coverage in cfe_tbl_api.c function CFE_TBL_Register
Aug 18, 2021
skliper
changed the title
Missing coverage in cfe_tbl_api.c function CFE_TBL_Register
TBL missing coverage in cfe_tbl_api.c function CFE_TBL_Register
Aug 26, 2021
Code coverage is not possible without changing the implementation. Getting to this branch would require GetWorkingBuffer return != CFE_SUCCESS which would require either RegRecPtr->TableLoadedOnce = true or CalledByApp = false (Parameter for GetWorkingBuffer). Since CalledByApp is hard-coded to be true, you can only set RegRecPtr.
The only way to set RegRecPtr->TableLoadedOnce to true if this was a dump-only table (CFE_TBL_OPT_DUMP_ONLY) but in order to get to this branch, it would have to be a critical table (CFE_TBL_OPT_CRITICAL). A dump-only table and a critical table (CFE_TBL_OPT_DUMP_ONLY | CFE_TBL_OPT_CRITICAL) is not considered a valid option.
Is your feature request related to a problem? Please describe.
CFE_TBL_Register
function contains two hard to reach lines (370-371) that remain untested, preventing us from reaching 100% line coverage.Describe the solution you'd like
These lines should be safe to leave uncovered because they do not contain any potential to access a NULL pointer or anything else similarly dangerous.
Additional context
Lines 370 and 371 are currently impossible to cover as noted in the code comment because line 362 calls
GetWorkingBuffer
with true for the third argument which skips over anything that could return a non CFE_SUCCESS code.Requester Info
Niall Mullane - GSFC 582 Intern
The text was updated successfully, but these errors were encountered: