Enable JFR for the SingleFeatureTest 64/95464/3
authorOleksii Mozghovyi <oleksii.mozghovyi@pantheon.tech>
Thu, 11 Mar 2021 00:29:19 +0000 (02:29 +0200)
committerRobert Varga <nite@hq.sk>
Fri, 19 Mar 2021 10:02:21 +0000 (10:02 +0000)
- Fix JFR configuration parameters used by pax-exam
- Add jdk.jfr.* packages to the parent class loader by adding them
via boot delegation

Change-Id: I822a157f8d6bee52726aea4af1b7598ec388c0f3
Signed-off-by: Oleksii Mozghovyi <oleksii.mozghovyi@pantheon.tech>
features-test/src/main/java/org/opendaylight/odlparent/featuretest/SingleFeatureTest.java

index 4421eb4ba924e5ed9a51976588cb2587a2f792ad..cb2b3aaf1826330b03af0ccb430e9ec22177f825 100644 (file)
@@ -14,6 +14,7 @@ import static org.junit.Assert.fail;
 import static org.opendaylight.odlparent.featuretest.Constants.ORG_OPENDAYLIGHT_FEATURETEST_FEATURENAME_PROP;
 import static org.opendaylight.odlparent.featuretest.Constants.ORG_OPENDAYLIGHT_FEATURETEST_FEATUREVERSION_PROP;
 import static org.opendaylight.odlparent.featuretest.Constants.ORG_OPENDAYLIGHT_FEATURETEST_URI_PROP;
+import static org.ops4j.pax.exam.CoreOptions.bootDelegationPackages;
 import static org.ops4j.pax.exam.CoreOptions.maven;
 import static org.ops4j.pax.exam.CoreOptions.propagateSystemProperty;
 import static org.ops4j.pax.exam.CoreOptions.systemPackages;
@@ -169,11 +170,8 @@ public class SingleFeatureTest {
                 new VMOption("-Djava.security.egd=file:/dev/./urandom")
             ),
             when(Boolean.getBoolean(PROFILE_PROP)).useOptions(
-                new VMOption("-XX:+UnlockCommercialFeatures"),
-                new VMOption("-XX:+FlightRecorder"),
-                new VMOption("-XX:FlightRecorderOptions=defaultrecording=true,dumponexit=true,dumponexitpath="
-                               + getNewJFRFile())
-            ),
+                new VMOption("-XX:StartFlightRecording=disk=true,settings=profile,dumponexit=true,filename="
+                               + getNewJFRFile())),
             getKarafDistroOption(),
             when(Boolean.getBoolean(KEEP_UNPACK_DIRECTORY_PROP)).useOptions(keepRuntimeFolder()),
             configureConsole().ignoreLocalConsole().ignoreRemoteShell(),
@@ -221,6 +219,9 @@ public class SingleFeatureTest {
             propagateSystemProperty(BUNDLES_DIAG_TIMEOUT_PROP),
             // Needed for Agrona/aeron.io
             systemPackages("com.sun.media.sound", "sun.net", "sun.nio.ch"),
+            // Needed to run akka with a java flight recorder enabled
+            bootDelegationPackages("jdk.jfr", "jdk.jfr.consumer", "jdk.jfr.event", "jdk.jfr.event.handlers",
+                "jdk.jfr.internal.*"),
 
             // Install SCR
             features(maven().groupId("org.apache.karaf.features").artifactId("standard").type("xml")