From 9e5c7c5358bac3dc0890cf00848704dad47ad1ba Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Wed, 5 Dec 2018 14:37:59 +0100 Subject: [PATCH] Capture test coverage and add an aggregate test coverage report Configure Maven build to capture test coverage using jacoco. Add new org.eclipse.jgit.coverage Maven module to aggregate jacoco test coverage results and generate test coverage HTML report at org.eclipse.jgit.coverage/target/site/jacoco-aggregate/index.html See https://www.eclemma.org/jacoco/trunk/doc/maven.html Change-Id: Iaeec4033e448ebc16965c05ab54109c4155a307a Signed-off-by: Matthias Sohn --- org.eclipse.jgit.ant.test/pom.xml | 2 +- org.eclipse.jgit.coverage/.classpath | 14 ++ org.eclipse.jgit.coverage/.gitignore | 1 + org.eclipse.jgit.coverage/.project | 17 +++ .../org.eclipse.core.resources.prefs | 2 + .../.settings/org.eclipse.m2e.core.prefs | 4 + org.eclipse.jgit.coverage/pom.xml | 143 ++++++++++++++++++ org.eclipse.jgit.http.test/pom.xml | 2 +- org.eclipse.jgit.lfs.server.test/pom.xml | 2 +- org.eclipse.jgit.lfs.test/pom.xml | 2 +- org.eclipse.jgit.pgm.test/pom.xml | 2 +- org.eclipse.jgit.ssh.apache.test/pom.xml | 4 +- org.eclipse.jgit.test/pom.xml | 4 +- pom.xml | 56 ++++++- 14 files changed, 245 insertions(+), 10 deletions(-) create mode 100644 org.eclipse.jgit.coverage/.classpath create mode 100644 org.eclipse.jgit.coverage/.gitignore create mode 100644 org.eclipse.jgit.coverage/.project create mode 100644 org.eclipse.jgit.coverage/.settings/org.eclipse.core.resources.prefs create mode 100644 org.eclipse.jgit.coverage/.settings/org.eclipse.m2e.core.prefs create mode 100644 org.eclipse.jgit.coverage/pom.xml diff --git a/org.eclipse.jgit.ant.test/pom.xml b/org.eclipse.jgit.ant.test/pom.xml index 1f5eda64a..0a2085518 100644 --- a/org.eclipse.jgit.ant.test/pom.xml +++ b/org.eclipse.jgit.ant.test/pom.xml @@ -105,7 +105,7 @@ maven-surefire-plugin - -Xmx256m -Dfile.encoding=UTF-8 -Djava.io.tmpdir=${project.build.directory} + @{argLine} -Xmx256m -Dfile.encoding=UTF-8 -Djava.io.tmpdir=${project.build.directory} diff --git a/org.eclipse.jgit.coverage/.classpath b/org.eclipse.jgit.coverage/.classpath new file mode 100644 index 000000000..248406be3 --- /dev/null +++ b/org.eclipse.jgit.coverage/.classpath @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/org.eclipse.jgit.coverage/.gitignore b/org.eclipse.jgit.coverage/.gitignore new file mode 100644 index 000000000..b83d22266 --- /dev/null +++ b/org.eclipse.jgit.coverage/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/org.eclipse.jgit.coverage/.project b/org.eclipse.jgit.coverage/.project new file mode 100644 index 000000000..6306b5ce0 --- /dev/null +++ b/org.eclipse.jgit.coverage/.project @@ -0,0 +1,17 @@ + + + org.eclipse.jgit.coverage + + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + + diff --git a/org.eclipse.jgit.coverage/.settings/org.eclipse.core.resources.prefs b/org.eclipse.jgit.coverage/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 000000000..99f26c020 --- /dev/null +++ b/org.eclipse.jgit.coverage/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/org.eclipse.jgit.coverage/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.jgit.coverage/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 000000000..f897a7f1c --- /dev/null +++ b/org.eclipse.jgit.coverage/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/org.eclipse.jgit.coverage/pom.xml b/org.eclipse.jgit.coverage/pom.xml new file mode 100644 index 000000000..c908cfcb3 --- /dev/null +++ b/org.eclipse.jgit.coverage/pom.xml @@ -0,0 +1,143 @@ + + + + org.eclipse.jgit + org.eclipse.jgit-parent + 5.3.0-SNAPSHOT + + 4.0.0 + + org.eclipse.jgit.coverage + pom + + JGit - Test Coverage + + + + org.eclipse.jgit + org.eclipse.jgit + 5.3.0-SNAPSHOT + + + org.eclipse.jgit + org.eclipse.jgit.ant + 5.3.0-SNAPSHOT + + + org.eclipse.jgit + org.eclipse.jgit.archive + 5.3.0-SNAPSHOT + + + org.eclipse.jgit + org.eclipse.jgit.http.apache + 5.3.0-SNAPSHOT + + + org.eclipse.jgit + org.eclipse.jgit.http.server + 5.3.0-SNAPSHOT + + + org.eclipse.jgit + org.eclipse.jgit.lfs + 5.3.0-SNAPSHOT + + + org.eclipse.jgit + org.eclipse.jgit.lfs.server + 5.3.0-SNAPSHOT + + + org.eclipse.jgit + org.eclipse.jgit.pgm + 5.3.0-SNAPSHOT + + + org.eclipse.jgit + org.eclipse.jgit.ui + 5.3.0-SNAPSHOT + + + org.eclipse.jgit + org.eclipse.jgit.ssh.apache + 5.3.0-SNAPSHOT + + + + org.eclipse.jgit + org.eclipse.jgit.test + 5.3.0-SNAPSHOT + + + org.eclipse.jgit + org.eclipse.jgit.ant.test + 5.3.0-SNAPSHOT + + + org.eclipse.jgit + org.eclipse.jgit.http.test + 5.3.0-SNAPSHOT + + + org.eclipse.jgit + org.eclipse.jgit.pgm.test + 5.3.0-SNAPSHOT + + + org.eclipse.jgit + org.eclipse.jgit.lfs.test + 5.3.0-SNAPSHOT + + + org.eclipse.jgit + org.eclipse.jgit.lfs.server.test + 5.3.0-SNAPSHOT + + + org.eclipse.jgit + org.eclipse.jgit.ssh.apache.test + 5.3.0-SNAPSHOT + + + + + + + org.jacoco + jacoco-maven-plugin + + + aggregate-reports-all + verify + + report-aggregate + + + JGit Test Coverage + ${project.reporting.outputDirectory}/jacoco-aggregate + + + + + + + + + + org.jacoco + jacoco-maven-plugin + + + aggregate + + report-aggregate + + + + + + + diff --git a/org.eclipse.jgit.http.test/pom.xml b/org.eclipse.jgit.http.test/pom.xml index 244c8ae66..9eb8e7c83 100644 --- a/org.eclipse.jgit.http.test/pom.xml +++ b/org.eclipse.jgit.http.test/pom.xml @@ -139,7 +139,7 @@ maven-surefire-plugin - -Djava.io.tmpdir=${project.build.directory} -Xmx300m + @{argLine} -Djava.io.tmpdir=${project.build.directory} -Xmx300m **/*Test.java **/*Tests.java diff --git a/org.eclipse.jgit.lfs.server.test/pom.xml b/org.eclipse.jgit.lfs.server.test/pom.xml index 65f759485..f8a4695cc 100644 --- a/org.eclipse.jgit.lfs.server.test/pom.xml +++ b/org.eclipse.jgit.lfs.server.test/pom.xml @@ -137,7 +137,7 @@ maven-surefire-plugin - -Djava.io.tmpdir=${project.build.directory} -Xmx300m + @{argLine} -Djava.io.tmpdir=${project.build.directory} -Xmx300m diff --git a/org.eclipse.jgit.lfs.test/pom.xml b/org.eclipse.jgit.lfs.test/pom.xml index c0c8a5739..3c8508f21 100644 --- a/org.eclipse.jgit.lfs.test/pom.xml +++ b/org.eclipse.jgit.lfs.test/pom.xml @@ -111,7 +111,7 @@ maven-surefire-plugin - -Djava.io.tmpdir=${project.build.directory} -Xmx300m + @{argLine} -Djava.io.tmpdir=${project.build.directory} -Xmx300m diff --git a/org.eclipse.jgit.pgm.test/pom.xml b/org.eclipse.jgit.pgm.test/pom.xml index f33602b4d..ea18b01c9 100644 --- a/org.eclipse.jgit.pgm.test/pom.xml +++ b/org.eclipse.jgit.pgm.test/pom.xml @@ -109,7 +109,7 @@ maven-surefire-plugin - -Djava.io.tmpdir=${project.build.directory} + @{argLine} -Djava.io.tmpdir=${project.build.directory} diff --git a/org.eclipse.jgit.ssh.apache.test/pom.xml b/org.eclipse.jgit.ssh.apache.test/pom.xml index 8a735415d..9ca79378a 100644 --- a/org.eclipse.jgit.ssh.apache.test/pom.xml +++ b/org.eclipse.jgit.ssh.apache.test/pom.xml @@ -106,7 +106,7 @@ org.apache.maven.plugins maven-surefire-plugin - -Djgit.test.long=true + @{argLine} -Djgit.test.long=true @@ -133,7 +133,7 @@ maven-surefire-plugin - -Xmx1024m -Dfile.encoding=UTF-8 -Djava.io.tmpdir=${project.build.directory} + @{argLine} -Xmx1024m -Dfile.encoding=UTF-8 -Djava.io.tmpdir=${project.build.directory} **/*Test.java **/*Tests.java diff --git a/org.eclipse.jgit.test/pom.xml b/org.eclipse.jgit.test/pom.xml index c63b3fa72..10117d89d 100644 --- a/org.eclipse.jgit.test/pom.xml +++ b/org.eclipse.jgit.test/pom.xml @@ -134,7 +134,7 @@ org.apache.maven.plugins maven-surefire-plugin - -Djgit.test.long=true + @{argLine} -Djgit.test.long=true @@ -179,7 +179,7 @@ maven-surefire-plugin - -Xmx1024m -Dfile.encoding=UTF-8 -Djava.io.tmpdir=${project.build.directory} + @{argLine} -Xmx1024m -Dfile.encoding=UTF-8 -Djava.io.tmpdir=${project.build.directory} **/*Test.java **/*Tests.java diff --git a/pom.xml b/pom.xml index c3b92b7aa..cf875f146 100644 --- a/pom.xml +++ b/pom.xml @@ -211,7 +211,7 @@ jacoco reuseReports - ../target/jacoco.exec + ${project.build.directory}/jacoco.exec @@ -297,6 +297,7 @@ ${test-fork-count} true + @{argLine} @@ -498,6 +499,7 @@ jacoco-maven-plugin + default-prepare-agent prepare-agent @@ -512,6 +514,38 @@ true + + default-report + + report + + + + default-check + + check + + + false + + + BUNDLE + + + INSTRUCTION + COVEREDRATIO + 50% + + + CLASS + MISSEDCOUNT + 10 + + + + + + @@ -589,6 +623,24 @@ + + org.jacoco + jacoco-maven-plugin + + + + report + + + + aggregate + false + + report-aggregate + + + + @@ -938,6 +990,8 @@ org.eclipse.jgit.lfs.test org.eclipse.jgit.lfs.server.test org.eclipse.jgit.ssh.apache.test + + org.eclipse.jgit.coverage