Skip to content

Enable UBSan for telemetry/web_server QEMU tests#99

Merged
ltowarek merged 4 commits into
mainfrom
cpp_linters_ubsan
Jun 21, 2026
Merged

Enable UBSan for telemetry/web_server QEMU tests#99
ltowarek merged 4 commits into
mainfrom
cpp_linters_ubsan

Conversation

@ltowarek

Copy link
Copy Markdown
Owner

Summary

  • Enables UndefinedBehaviorSanitizer (-fsanitize=undefined -fno-sanitize=shift-base) scoped to the telemetry and web_server components in their respective QEMU test apps, via idf_component_get_property/target_compile_options in each test app's project CMakeLists.txt — the pattern ESP-IDF's docs recommend for keeping UBSan's code/data size growth out of the production firmware.
  • No new CI job needed: the existing QEMU matrix entries in cpp-car.yml (test-telemetry, test-web_server) already build and run these test apps, so UBSan traps surface as test failures automatically going forward.

Part of #87.

Test plan

  • idf.py build succeeds for both QEMU test apps with UBSan enabled
  • pytest pytest_telemetry_qemu.py --embedded-services idf,qemu -v passes
  • pytest pytest_web_server_qemu.py --embedded-services idf,qemu -v passes

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

https://claude.ai/code/session_01QwTBvENKGMczMo9x7nAMrg

@ltowarek
ltowarek force-pushed the cpp_linters_ubsan branch from 5f2af0e to fa896bf Compare June 21, 2026 21:17
@ltowarek
ltowarek changed the base branch from main to cpp_linters_cppcheck June 21, 2026 21:17
@ltowarek
ltowarek force-pushed the cpp_linters_cppcheck branch from a6c2da6 to bab0dd0 Compare June 21, 2026 21:22
@ltowarek
ltowarek force-pushed the cpp_linters_ubsan branch from fa896bf to 4dd8180 Compare June 21, 2026 21:24
@ltowarek
ltowarek force-pushed the cpp_linters_cppcheck branch from bab0dd0 to 58312aa Compare June 21, 2026 21:34
@ltowarek
ltowarek force-pushed the cpp_linters_ubsan branch 2 times, most recently from 678aa90 to b557e41 Compare June 21, 2026 21:52
@ltowarek
ltowarek changed the base branch from cpp_linters_cppcheck to cpp_linters_clang_tidy June 21, 2026 21:52
Base automatically changed from cpp_linters_clang_tidy to main June 21, 2026 22:26
ltowarek and others added 4 commits June 22, 2026 00:28
Scopes UndefinedBehaviorSanitizer to the component under test in the
telemetry and web_server QEMU test apps, per ESP-IDF's documented
pattern (project-wide UBSan grows code/data size too much to fit
on-target). No new CI job needed - the existing QEMU matrix entries
already build and run these test apps. Part of #87.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QwTBvENKGMczMo9x7nAMrg
UBSan was previously baked into both test apps' CMakeLists.txt
unconditionally, so every default QEMU functional test run also paid
the sanitizer's instrumentation cost and conflated "does the feature
work" with "is there UB". Gate it behind a CONFIG_<COMPONENT>_TEST_UBSAN
Kconfig boolean (default n), set via a new sdkconfig.defaults.ubsan
overlay, following the existing CONFIG_<COMPONENT>_TEST_QEMU_MODE
pattern. The default test-telemetry/test-web_server CI jobs build
without it; new test-telemetry-ubsan/test-web_server-ubsan jobs combine
the new overlay with sdkconfig.defaults.qemu to run the same QEMU tests
with UBSan enabled, as a separate, dedicated step.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QwTBvENKGMczMo9x7nAMrg
Adding -ubsan variants to the build job's existing matrix mixed a
sanitizer run in among feature builds and hardware test builds that
have nothing to do with it. Give UBSan its own job, mirroring
clang-format/clang-tidy: a dedicated job with a matrix scoped only to
the opted-in test apps, building each with sdkconfig.defaults.qemu;
sdkconfig.defaults.ubsan and running its QEMU tests. Move the
CONTRIBUTING.md description into the quality-checks section alongside
clang-format/clang-tidy, generalized to "a QEMU test app can opt in"
rather than naming the two current adopters, and focused on how to
wire a new one up.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QwTBvENKGMczMo9x7nAMrg
@ltowarek
ltowarek force-pushed the cpp_linters_ubsan branch from a005a72 to 0d924e0 Compare June 21, 2026 22:28
@ltowarek
ltowarek enabled auto-merge (squash) June 21, 2026 22:29
@ltowarek
ltowarek merged commit c93171b into main Jun 21, 2026
23 checks passed
@ltowarek
ltowarek deleted the cpp_linters_ubsan branch June 21, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant