Skip to content

TS-47712 Record the coverage of the JVMs our tests spawn - #966

Merged
stahlbauer merged 1 commit into
masterfrom
ts/47712_spawned_jvm_coverage
Sep 3, 2026
Merged

TS-47712 Record the coverage of the JVMs our tests spawn#966
stahlbauer merged 1 commit into
masterfrom
ts/47712_spawned_jvm_coverage

Conversation

@DreierF

@DreierF DreierF commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Addresses issue TS-47712

  • Changes are tested adequately
  • Teamscale documentation updated in case of user-visible changes
  • CHANGELOG.md updated
  • Present new features in N&N
  • TGA Tutorial updated
  • TIA Tutorial updated

Please respect the vote of the Teamscale bot or flag irrelevant findings as tolerated or false positives. If you feel that the Teamscale config needs adjustment, please state so in a comment and discuss this with your reviewer.

@DreierF
DreierF force-pushed the ts/47712_spawned_jvm_coverage branch from 1374bb1 to cba6b68 Compare September 3, 2026 06:04
Most of what this repository ships is executed during the build, but not in
a JVM that anyone instruments, so Teamscale reports it as untested. The
Mojos of the Maven plugin, the report generator they call into and the whole
Gradle plugin run in the Maven and Gradle builds that the system tests and
the TestKit tests start as child processes. The JaCoCo agent that
com.teamscale.coverage attaches reaches only the test JVM itself, which does
little more than run a mock Teamscale server: the jacocoTestReport.xml of
every system test was an empty stub, because a system test has no production
code of its own to fill the report's class directories with either.

The new com.teamscale.spawned-jvm-coverage convention plugin attaches a
plain JaCoCo agent to those child processes and folds what it records into
the project's jacocoTestReport, which is the report CI uploads. It also
lets the consuming build script name the projects whose classes run in
there, so that the report can be mapped onto their sources; they are
resolved through a configuration rather than read from the projects, which
is what keeps this compatible with project isolation.

The agent reaches Maven through MAVEN_OPTS, whose JVM is the one the Mojos
run in, and Gradle through org.gradle.jvmargs, since its build logic runs in
the daemon rather than in the launcher that GRADLE_OPTS would reach.
JAVA_TOOL_OPTIONS would have covered both plus the forked test JVMs, but it
announces itself on the stderr of every JVM, which sut-uses-logback-test
asserts is empty, and it would put a second agent into the JVMs that the
profiler already instruments.

The include pattern deliberately does not match the shadow.com.teamscale.*
classes of the profiler, which AgentOptions.DEFAULT_EXCLUDES keeps the
profiler itself from instrumenting, so the two agents record a disjoint set
of classes and cannot interfere with each other.

Coverage of the classes involved, as Teamscale sees it across all uploaded
reports: the Gradle plugin's own report goes from 2 of 284 methods to 188,
the Maven plugin from 6 of 102 to 81, the report generator from 182 of 284
to 235 and the client from 54 of 198 to 96.

Branch and pull request builds now upload their coverage as well. They ran
every test but uploaded nothing, so until a change reached master all of its
methods looked untested. On a pull request the checkout is the synthetic
merge commit, which does not exist in the repository, so the head commit is
named explicitly rather than left to the commit auto detection. Builds of
pull requests from forks are still skipped, since they get no secrets.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@DreierF
DreierF force-pushed the ts/47712_spawned_jvm_coverage branch from cba6b68 to aa61182 Compare September 3, 2026 06:21
@stahlbauer
stahlbauer merged commit 170f3aa into master Sep 3, 2026
4 checks passed
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