Skip to content

Fix minimal_test: wire up str_replace from util.h instead of stdlib#22

Draft
Copilot wants to merge 4 commits intomasterfrom
copilot/install-lcov-cobertura-2-0-2
Draft

Fix minimal_test: wire up str_replace from util.h instead of stdlib#22
Copilot wants to merge 4 commits intomasterfrom
copilot/install-lcov-cobertura-2-0-2

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 19, 2026

minimal_test was calling stdlib std::string::replace instead of the project's str_replace(), so it never needed :util — producing a 0-byte coverage.dat and breaking irongut/CodeCoverageSummary ("No package data found"). The BUILD comment # This test intentionally links nothing except gtest described this wrong state.

minimal_test.cpp

  • Replace stdlib haystack.replace(…) with str_replace() from util.h
  • Add #include "util.h" and the WinMain shim (already present in util_test.cpp for the same reason: :util → SDL → SUBSYSTEM:WINDOWS on Windows)

BUILD

  • Add :util dep and the same linkopts block as util_test
  • Remove misleading # This test intentionally links nothing except gtest comment

ci-bazel-testreports.yml

  • Update three comments that cited minimal_test as the example of a no-project-sources target (now phrased hypothetically, since minimal_test now instruments util.cpp)

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

- Add `-not -empty` to `find` in the lcov→Cobertura conversion step so
  that zero-byte coverage.dat files (produced by targets like minimal_test
  that have no project source files) are not converted; lcov_cobertura
  would otherwise emit `<packages/>` (empty), causing
  irongut/CodeCoverageSummary to fail with "No package data found".

- Add a "Check for Cobertura XML files" step (id: check_cobertura) that
  sets `found=true/false` output so downstream steps can skip cleanly
  instead of failing when no XML was produced.

- Gate "Code Coverage Report", "Post coverage report as comment", and
  "Add coverage report to job summary" on `steps.check_cobertura.outputs.found == 'true'`
  so they are skipped (not failed) when there is nothing to summarise.

Co-authored-by: ivucica <477596+ivucica@users.noreply.github.com>
Copilot AI changed the title [WIP] Install lcov_cobertura version 2.0.2 ci: skip empty LCOV files to prevent CodeCoverageSummary parse failure Mar 19, 2026
Copilot AI requested a review from ivucica March 19, 2026 01:16
When all coverage.dat files are empty (e.g. minimal_test has no project
sources and produces a 0-byte coverage.dat), the -not -empty filter
means no coverage.dat.xml files are produced. The upload step would
otherwise implicitly rely on the default if-no-files-found behaviour;
make the intent explicit with if-no-files-found: warn.

Co-authored-by: ivucica <477596+ivucica@users.noreply.github.com>
Copilot AI changed the title ci: skip empty LCOV files to prevent CodeCoverageSummary parse failure ci: fix CodeCoverageSummary failure for tests with no instrumented sources Mar 19, 2026
minimal_test.cpp was using stdlib haystack.replace() instead of the
project's str_replace() from util.h. As a result it never needed :util
as a dep; the BUILD comment "This test intentionally links nothing
except gtest" described this incorrect state.

Consequences:
- The test never exercised any project code
- bazel coverage produced an empty coverage.dat (no workspace sources
  were instrumented), causing irongut/CodeCoverageSummary to fail with
  "No package data found"

Changes:
- minimal_test.cpp: add #include "util.h", WinMain shim (same as
  util_test.cpp), and update StrReplaceTest to call str_replace()
- BUILD: add :util dep and same linkopts as util_test; remove the
  misleading "intentionally links nothing" comment
- ci-bazel-testreports.yml: update comments that cited minimal_test as
  an example of a target with no project sources (now hypothetical)

Co-authored-by: ivucica <477596+ivucica@users.noreply.github.com>
Copilot AI changed the title ci: fix CodeCoverageSummary failure for tests with no instrumented sources Fix minimal_test: wire up str_replace from util.h instead of stdlib Mar 19, 2026
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.

2 participants