How do I enable test logging?

Table of Contents

Test logging is off by default for performance. The conceptual description lives in CMake setup§"Test logging"; this recipe is the operational counterpart. To actually run the tests once logging is configured, see How do I run the tests?.

Question

How do I enable test logging — choose a level — and turn it back off when I'm done?

Answer

Test logging is controlled by three ORES_TEST_LOG_* variables in .env. The root CMakeLists.txt forwards every .env variable verbatim to test processes, and .env is a CMake configure dependency, so any change is picked up automatically on the next build or test run — no manual re-configure needed.

The compass test pillar provides the toggle:

  1. Enable — defaults to debug; pass a level (trace, debug, info, warn, error) to override:

    ./compass.sh test logging on
    ./compass.sh test logging on trace
    

    This appends a # Test logging block to .env setting ORES_TEST_LOG_ENABLED=true, ORES_TEST_LOG_LEVEL=<level> and ORES_TEST_LOG_CONSOLE=true.

  2. Disable — strips the block; absence means disabled:

    ./compass.sh test logging off
    
  3. Inspect — show the current settings:

    ./compass.sh test logging status
    
  4. One-off override — the same variables can be set in the process environment for a single run without touching .env (the runtime listener in ores.testing reads them directly):

    ORES_TEST_LOG_ENABLED=true \
    ORES_TEST_LOG_LEVEL=trace \
    ORES_TEST_LOG_CONSOLE=true \
        ctest --preset linux-clang-debug-ninja
    

compass env init --enable-logging [level] and --disable-logging remain as aliases for the same operation.

Script

compass test logging in projects/ores.compass/src/compass.py, delegating to _logging_only in env_init.py.

Tested by

Manual. The flags are consumed inside the per-component CMakeLists.txt test targets and read at runtime by the test harness; no dedicated CI check exercises them.

See also

Emacs 29.1 (Org mode 9.6.6)