Skip to content

Commit 3af7c78

Browse files
committed
[SYSTEMDS-3886] Federated Worker JVM Codecoverage
1 parent c6f6137 commit 3af7c78

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

.github/workflows/javaTests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ jobs:
103103
ARTIFACT_NAME=${ARTIFACT_NAME//\*/x} # replace * with x
104104
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV
105105
106+
- name: Merge Jacoco SingleTest Artifacts
107+
run: mvn jacoco:merge
108+
109+
106110
- name: Save Java Test Coverage as Artifact
107111
uses: actions/upload-artifact@v4
108112
with:

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@
459459
<fileSet>
460460
<directory>${project.build.directory}</directory>
461461
<includes>
462-
<include>*/jacoco.exec</include>
462+
<include>*.exec</include>
463463
</includes>
464464
</fileSet>
465465
</fileSets>

src/test/java/org/apache/sysds/test/AutomatedTestBase.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import java.io.File;
2929
import java.io.IOException;
3030
import java.io.PrintStream;
31+
import java.lang.management.ManagementFactory;
32+
import java.lang.management.RuntimeMXBean;
3133
import java.net.InetSocketAddress;
3234
import java.net.ServerSocket;
3335
import java.nio.charset.Charset;
@@ -1663,9 +1665,22 @@ protected static Process startLocalFedWorker(int port, String[] addArgs, int sle
16631665
"--add-opens=java.base/java.lang=ALL-UNNAMED" ,
16641666
"--add-opens=java.base/java.lang.ref=ALL-UNNAMED" ,
16651667
"--add-opens=java.base/java.util.concurrent=ALL-UNNAMED" ,
1666-
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
1668+
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",};
1669+
1670+
RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
1671+
List<String> jvmArgs = runtimeMxBean.getInputArguments();
1672+
1673+
for(String arg : jvmArgs) {
1674+
// add code coverage report
1675+
System.out.println(arg);
1676+
if(arg.contains("org.jacoco.agent"))
1677+
args = ArrayUtils.addAll(args,
1678+
new String[] {arg.replace("target/jacoco.exec", String.format("target/jacoco-%d.exec", port))});
1679+
}
1680+
1681+
args = ArrayUtils.addAll(args, new String[]{
16671682
"-cp", classpath,
1668-
DMLScript.class.getName(), "-w", Integer.toString(port), "-stats"};
1683+
DMLScript.class.getName(), "-w", Integer.toString(port), "-stats"});
16691684
if(addArgs != null)
16701685
args = ArrayUtils.addAll(args, addArgs);
16711686

0 commit comments

Comments
 (0)