Skip to content

EVS "CFE_PLATFORM_EVS_LOG_ON" option unit test failure #609

@jphickey

Description

@jphickey

Describe the bug
The Event Services subsystem has a broken compile-time platform option called CFE_PLATFORM_EVS_LOG_ON. The description says: "The CFE_PLATFORM_EVS_LOG_ON configuration parameter must be defined to enable EVS event logging"

If UT is disabled, then CFE core itself actually seems to build and run OK. However, certain risky things are not clear in the code that:

  • The EVS_SharedDataMutexID will be left uninitialized
  • The EVS_LogPtr will be left as NULL

The code that accesses these seems to be mostly protected by checking the separate CFE_EVS_GlobalData.EVS_TlmPkt.Payload.LogEnabled member boolean in the outgoing telemetry packet. This seems like a weak design, in particular because the telemetry packet is supposed to be informational, not an active control structure.

To Reproduce
Disable the CFE_PLATFORM_EVS_LOG_ON option, and build with ENABLE_UNIT_TESTS=TRUE. CFE EVS unit test fails to build with a compiler error.

System observed on:
Ubuntu 18.04 LTS 64 bit.

Additional context
Unless there is a specific requirement for CFE_PLATFORM_EVS_LOG_ON as it stands today, my recommendation would be to deprecate this option and keep it always on, which reduces the testing matrix, and makes the FSW code more consistent. Platform config options that actually add/remove #ifdef code should be avoided, as this has proven to be a testing/support issue time and time again.

In this case, only the code that initializes the structures is compiled out. All the code that reads/writes to it is still compiled in, but skipped via a runtime test. So this isn't saving much in the way of code/text space.

If the goal of this option is to save data space memory, then mostly the same effect can be achieved by keeping the log very small, by setting CFE_PLATFORM_EVS_LOG_MAX to a very low number, such as 1. In this mode the log structure uses only 176 bytes of memory on an x86-64 machine, down from 3368 bytes with the default size of 20.

And the unit tests still build and pass with the max set to 1, and it reduces the amount of conditionally-compiled code and variances on the FSW side.

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions