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

fm_cmd_utils.c has branches that can't be reached (7/7) #34

Closed
2 tasks done
havencarlson opened this issue Jun 8, 2022 · 0 comments · Fixed by #45
Closed
2 tasks done

fm_cmd_utils.c has branches that can't be reached (7/7) #34

havencarlson opened this issue Jun 8, 2022 · 0 comments · Fixed by #45

Comments

@havencarlson
Copy link
Contributor

havencarlson commented Jun 8, 2022

Checklist (Please check before submitting)

  • I reviewed the Contributing Guide.
  • I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.

Describe the bug
Looking at code coverage for #17, there are several functions in fm_cmd_utils.c that have else statements that can never be reached. These functions check the return value of FM_GetFilenameState.

Total uncovered here is 7 lines 7 branches.

To Reproduce
Functions with else statements that can never be reached:

  • FM_VerifyFileClosed

    FM/fsw/src/fm_cmd_utils.c

    Lines 315 to 320 in 51707f2

    else
    {
    CFE_EVS_SendEvent((EventID + FM_FNAME_UNKNOWN_EID_OFFSET), CFE_EVS_EventType_ERROR,
    "%s error: filename has unknown state: name = %s, state = %d", CmdText, Filename,
    FilenameState);
    }

  • FM_VerifyFileExists

    FM/fsw/src/fm_cmd_utils.c

    Lines 361 to 366 in 51707f2

    else
    {
    CFE_EVS_SendEvent((EventID + FM_FNAME_UNKNOWN_EID_OFFSET), CFE_EVS_EventType_ERROR,
    "%s error: filename has unknown state: name = %s, state = %d", CmdText, Filename,
    FilenameState);
    }

  • FM_VerifyFileNoExists

    FM/fsw/src/fm_cmd_utils.c

    Lines 407 to 412 in 51707f2

    else
    {
    CFE_EVS_SendEvent((EventID + FM_FNAME_UNKNOWN_EID_OFFSET), CFE_EVS_EventType_ERROR,
    "%s error: directory name has unknown state: name = %s, state = %d", CmdText, Filename,
    FilenameState);
    }

  • FM_VerifyFileNotOpen

    FM/fsw/src/fm_cmd_utils.c

    Lines 458 to 462 in 51707f2

    {
    CFE_EVS_SendEvent((EventID + FM_FNAME_UNKNOWN_EID_OFFSET), CFE_EVS_EventType_ERROR,
    "%s error: filename has unknown state: name = %s, state = %d", CmdText, Filename,
    FilenameState);
    }

  • FM_VerifyDirExists

    FM/fsw/src/fm_cmd_utils.c

    Lines 503 to 510 in 51707f2

    else
    {
    CFE_EVS_SendEvent((EventID + FM_FNAME_UNKNOWN_EID_OFFSET), CFE_EVS_EventType_ERROR,
    "%s error: directory name has unknown state: name = %s, state = %d", CmdText, Directory,
    FilenameState);
    }
    return (Result);

  • FM_VerifyDirNoExists

    FM/fsw/src/fm_cmd_utils.c

    Lines 549 to 556 in 51707f2

    else
    {
    CFE_EVS_SendEvent((EventID + FM_FNAME_UNKNOWN_EID_OFFSET), CFE_EVS_EventType_ERROR,
    "%s error: directory name has unknown state: name = %s, state = %d", CmdText, Name,
    FilenameState);
    }
    return (Result);

Function if an if statement that can't be reached

Expected behavior
100% coverage

Code snips
See above

System observed on:
CI

Additional context
None

Reporter Info
Haven Carlson, NASA

@skliper skliper changed the title fm_cmd_utils.c has branches that can't be reached fm_cmd_utils.c has branches that can't be reached (7/7) Jul 28, 2022
skliper added a commit to skliper/FM that referenced this issue Aug 1, 2022
skliper added a commit to skliper/FM that referenced this issue Aug 1, 2022
skliper added a commit to skliper/FM that referenced this issue Aug 1, 2022
dzbaker added a commit that referenced this issue Aug 3, 2022
Fix #34 #37 #43 #44, UT cleanup, remove unreachable code, initialize FileMode on OS_stat failure
@dmknutsen dmknutsen added this to the Draco milestone Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants