CNA-BUG-185: Stub_Smoke links SDL3::SDL3 unconditionally, so STUB + tests cannot be configured with CNA_ENABLE_SDL=OFF
Evidence basis: source-verified at the pinned commit; tests exist (not executed for this page). Claims on this page were checked by reading the CNA source at commit 009d40f5; unless a sentence says otherwise, nothing here was built or executed. Nothing on this page was executed unless the Evidence section says so.
The STUB renderer's smoke-test macro links SDL3::SDL3 in both branches and its source includes the SDL3 header, while CNA_ENABLE_SDL=OFF is a supported configuration; with STUB selected and tests on, the SDL-free configuration has no SDL3 target to link.
- Identifier
CNA-BUG-185- Category
- Bug
- Subsystem
- Build & CI
- Status
- Open
- Verified against
- CNA
009d40f5(009d40f5dd085c4e674d3479675fac84b12b3e0a) - Severity
- Low (a triage suggestion, not a project priority)
- Evidence basis
- Source-verified: read at TARGET, not executed
- Tests touching this area
- Yes: see Current tests
- Affected contract
- CNA_GRAPHICS_RENDERER=STUB with CNA_BUILD_TESTS=ON and CNA_ENABLE_SDL=OFF
Expected behaviour
A test that needs SDL is registered only when SDL is configured, as the HEADLESS fixtures do with if(TARGET SDL3::SDL3), so that every supported combination of the SDL and renderer axes configures.
Actual behaviour at TARGET
The cna_stub_test macro links CNA SHARP_RUNTIME SDL3::SDL3 in both of its compiler branches and only SDL3::SDL3main is guarded. stub_smoke_test.cpp includes <SDL3/SDL.h> and checks SDL_WasInit. With CNA_ENABLE_SDL=OFF (a supported value, exercised in CI for X11 configurations) there is no SDL3::SDL3 target, so CMake's generate step rejects the link item and the source cannot compile.
Source locations
modules/renderers/stub/examples/CMakeLists.txt— macro cna_stub_test and the Stub_Smoke registrationmodules/renderers/stub/examples/stub_smoke_test.cpp— includes the SDL3 header and checks SDL_WasInitcmake/SdlAvailability.cmake— CNA_ENABLE_SDL OFF/AUTO/ON contractmodules/renderers/headless/examples/CMakeLists.txt— cna_headless_test: if(TARGET SDL3::SDL3) guardmodules/renderers/software/examples/CMakeLists.txt— early return when SDL3::SDL3 is absentmodules/renderers/stub/CMakeLists.txt— the renderer itself needs no SDL
Evidence
Checked by reading CMakeLists.txt, stub_smoke_test.cpp and SdlAvailability.cmake at 009d40f5. No configure was run; the failure mode (a namespaced link item that is not a target is a generate-time error under CMake's default policies) is inferred, not observed. No CI lane selects STUB with SDL disabled and tests on.
Independently reported as CNA-BUG-188 (folded into this entry by the adversarial audit): stub_smoke_test.cpp includes the SDL3 header unconditionally and the cna_stub_test macro links SDL3::SDL3 with no if(TARGET) guard, unlike the HEADLESS and SOFTWARE example files, so STUB with CNA_ENABLE_SDL=OFF and tests on fails at generate time.
Focused reproduction
Illustrative: cmake -S . -B build -DCNA_GRAPHICS_RENDERER=STUB -DCNA_ENABLE_SDL=OFF -DCNA_BUILD_TESTS=ON (with a native platform) is expected to fail at generate time on cna_test_stub_smoke.
Current tests
Stub_Smoke itself; it runs only in SDL-enabled configurations.
Regression test
Guard the registration (and the SDL-specific assertion) with if(TARGET SDL3::SDL3), and add the STUB + SDL-off + tests combination to a configure-only CI cell.
Blast radius
Only the STUB renderer with tests enabled and SDL disabled; every other renderer and every SDL-enabled STUB configuration is unaffected.
Workaround
Configure STUB with SDL enabled (the AUTO default when SDL is available), or with tests off.
Related pages
The same subject is explained at several altitudes. These are the neighbouring pages at each one.
- Architecture
- Build architecture: the SDL axis
- Internals
- STUB renderer internals: tests
- Reference
- Test target index
- Known issues
- Bug index