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

SB missing branch coverage in CFE_SB_SendStatsCmd, alternate config #1920

Open
skliper opened this issue Aug 31, 2021 · 1 comment
Open

SB missing branch coverage in CFE_SB_SendStatsCmd, alternate config #1920

skliper opened this issue Aug 31, 2021 · 1 comment

Comments

@skliper
Copy link
Contributor

skliper commented Aug 31, 2021

Is your feature request related to a problem? Please describe.
Branch coverage would require a config with CFE_MISSION_SB_MAX_PIPES < CFE_PLATFORM_SB_MAX_PIPES to hit the stats limit first:

     731 [ +  + ][ +  - ]:         65 :     while (PipeDscCount > 0 && PipeStatCount > 0)
     732                 :            :     {
     733         [ +  + ]:         64 :         if (CFE_SB_PipeDescIsUsed(PipeDscPtr))
     734                 :            :         {
     735                 :          3 :             PipeStatPtr->PipeId = PipeDscPtr->PipeId;
     736                 :            : 
     737                 :            :             /* Copy depth info */
     738                 :          3 :             PipeStatPtr->CurrentQueueDepth = PipeDscPtr->CurrentQueueDepth;
     739                 :          3 :             PipeStatPtr->PeakQueueDepth    = PipeDscPtr->PeakQueueDepth;
     740                 :          3 :             PipeStatPtr->MaxQueueDepth     = PipeDscPtr->MaxQueueDepth;
     741                 :            : 
     742                 :          3 :             ++PipeStatPtr;
     743                 :          3 :             --PipeStatCount;
     744                 :            :         }
     745                 :            : 
     746                 :         64 :         --PipeDscCount;
     747                 :         64 :         ++PipeDscPtr;
     748                 :            :     }

here:

/* Collect data on pipes */
PipeDscCount = CFE_PLATFORM_SB_MAX_PIPES;
PipeStatCount = CFE_MISSION_SB_MAX_PIPES;
PipeDscPtr = CFE_SB_Global.PipeTbl;
PipeStatPtr = CFE_SB_Global.StatTlmMsg.Payload.PipeDepthStats;
while (PipeDscCount > 0 && PipeStatCount > 0)
{
if (CFE_SB_PipeDescIsUsed(PipeDscPtr))
{
PipeStatPtr->PipeId = PipeDscPtr->PipeId;
/* Copy depth info */
PipeStatPtr->CurrentQueueDepth = PipeDscPtr->CurrentQueueDepth;
PipeStatPtr->PeakQueueDepth = PipeDscPtr->PeakQueueDepth;
PipeStatPtr->MaxQueueDepth = PipeDscPtr->MaxQueueDepth;
++PipeStatPtr;
--PipeStatCount;
}
--PipeDscCount;
++PipeDscPtr;
}

Describe the solution you'd like
Test with alternate config to get full coverage.

Describe alternatives you've considered
None

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

@avan989
Copy link
Contributor

avan989 commented Jun 9, 2023

Code Coverage is not possible with the current configuration.
Currently:

  1. PipeDscCount == CFE_PLATFORM_SB_MAX_PIPES == 64
  2. PipeStatCount == CFE_MISSION_SB_MAX_PIPES == 64

The target condition:

  1. PipeDscCount > 0 and
  2. PipeStatCount < 0

PipeDscCount will always decrement either at the same rate or faster than PipStatCount. To make PipeStatCount < 0 while PipeDscCount > 0:

  1. CFE_MISSION_SB_MAX_PIPES needs to be less than CFE_PLATFORM_SB_MAX_PIPES (as noted on the ticket in the description)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants