Skip to content

Achieve 100% test coverage for src/utils.cpp (libddwaf)#481

Merged
Anilm3 merged 1 commit into
anilm3/attempt-fmt-binary-size-reductionfrom
dd/add-utils-edge-case-tests
Nov 6, 2025
Merged

Achieve 100% test coverage for src/utils.cpp (libddwaf)#481
Anilm3 merged 1 commit into
anilm3/attempt-fmt-binary-size-reductionfrom
dd/add-utils-edge-case-tests

Conversation

@Anilm3

@Anilm3 Anilm3 commented Nov 6, 2025

Copy link
Copy Markdown
Collaborator

for chat 620b3383-2fe5-4001-9c2c-ee8e9c73b277

You can ask for changes by mentioning @DataDog in a comment.

Feedback (especially what can be better) welcome in #code-gen-feedback!


Summary

This PR adds missing unit tests to achieve 100% patch coverage for src/utils.cpp.

Changes

Added two new test cases to tests/unit/utils_test.cpp:

  1. SplitEmpty - Tests the split() function with an empty string input to ensure it returns an empty vector
  2. ConvertKeyPathEmpty - Tests the convert_key_path() function with an empty vector input to ensure it returns an empty result

Rationale

These edge case tests cover code paths that were previously untested, improving overall test coverage and ensuring the utility functions behave correctly with empty inputs.

@Anilm3
Anilm3 requested a review from a team as a code owner November 6, 2025 18:17
@datadog-datadog-prod-us1

Copy link
Copy Markdown

Bits AI Dev Agent Status: ✅ Done [Fix CI Errors]

You can ask for changes by mentioning @DataDog in a comment.

@Anilm3
Anilm3 temporarily deployed to dd-protected-coverage November 6, 2025 18:27 — with GitHub Actions Inactive
@codecov-commenter

codecov-commenter commented Nov 6, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.64%. Comparing base (955b11d) to head (c0e5340).

Additional details and impacted files
@@                            Coverage Diff                            @@
##           anilm3/attempt-fmt-binary-size-reduction     #481   +/-   ##
=========================================================================
  Coverage                                     84.64%   84.64%           
=========================================================================
  Files                                           191      191           
  Lines                                          9266     9266           
  Branches                                       4219     4219           
=========================================================================
  Hits                                           7843     7843           
  Misses                                          527      527           
  Partials                                        896      896           
Flag Coverage Δ
waf_test 84.64% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@datadog-official

Copy link
Copy Markdown

🎯 Code Coverage
Patch Coverage: 100.00%
Total Coverage: 94.01% (+0.00%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: c0e5340 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@github-actions

github-actions Bot commented Nov 6, 2025

Copy link
Copy Markdown

Dynamic Artifact Size Comparison 📦

Artifact Previous Release This PR Difference
darwin-arm64::libddwaf.dylib 1963024 2020880 2.94%
darwin-universal::libddwaf.dylib 4142096 4249104 2.58%
darwin-x86_64::libddwaf.dylib 2150896 2212440 2.86%
linux-aarch64::libddwaf.so 2463264 2388784 -3.02%
linux-armv7::libddwaf.so 2148796 2054576 -4.38%
linux-i386::libddwaf.so 2392820 2313604 -3.31%
linux-x86_64::libddwaf.so 2660096 2584704 -2.83%
windows-arm64::ddwaf.dll 4788736 4807680 0.39%
windows-win32::ddwaf.dll 3368448 3335168 -0.98%
windows-x64::ddwaf.dll 4101632 4073472 -0.68%

Static Artifact Size Comparison 📦

Artifact Previous Release This PR Difference
darwin-arm64::libddwaf.a 90006808 95287960 5.86%
darwin-arm64::libddwaf.a.stripped 4579664 4801216 4.83%
darwin-universal::libddwaf.a 181421048 192134928 5.90%
darwin-universal::libddwaf.a.stripped 9765560 10237592 4.83%
darwin-x86_64::libddwaf.a 91414192 96846920 5.94%
darwin-x86_64::libddwaf.a.stripped 5185848 5436328 4.83%
linux-aarch64::libddwaf.a 73159398 76946654 5.17%
linux-aarch64::libddwaf.a.stripped 11852314 12360042 4.28%
linux-armv7::libddwaf.a 64719602 68015426 5.09%
linux-armv7::libddwaf.a.stripped 10852830 11366782 4.73%
linux-i386::libddwaf.a 62843294 66177428 5.30%
linux-i386::libddwaf.a.stripped 9380114 9848572 4.99%
linux-x86_64::libddwaf.a 73646022 77460766 5.17%
linux-x86_64::libddwaf.a.stripped 11671354 12170914 4.28%
windows-arm64::ddwaf.lib 11698 16410 40.27%
windows-arm64::ddwaf_static.lib 57913956 57286204 -1.08%
windows-win32::ddwaf.lib 11922 16726 40.29%
windows-win32::ddwaf_static.lib 49534552 48884078 -1.31%
windows-x64::ddwaf.lib 11698 16410 40.27%
windows-x64::ddwaf_static.lib 57410292 57081498 -0.57%

@Anilm3
Anilm3 merged commit e88d389 into anilm3/attempt-fmt-binary-size-reduction Nov 6, 2025
64 of 65 checks passed
@Anilm3
Anilm3 deleted the dd/add-utils-edge-case-tests branch November 6, 2025 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants