RFR(XS): [TEST] add test to verify EnableTrace works
Liu Xin
navy.xliu at gmail.com
Wed Sep 5 06:04:34 UTC 2018
Hi, David,
Thanks to investigate the closed implementation.
Indeed, OracleJDK shows “JAVA(TM)” instead of OpenJDK.
$java -XX:+EnableTracing -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
I will add a guard for the Test. Furthermore, I think I need to check if it exits with 0 for OracleJDK.
The right behavior of OracleJDK8 is to accept this flag yet suppress all events.
Thanks,
—lx
> On Sep 4, 2018, at 9:51 PM, David Holmes <david.holmes at oracle.com> wrote:
>
> Hi Liu Xin,
>
> On 4/09/2018 7:45 PM, David Holmes wrote:
>> On 4/09/2018 10:12 AM, Liu, Xin wrote:
>>> Hi, David,
>>> Thank you for reviewing it.
>>>
>>> If you are using OracleJDK, it won't have any output. OracleJDK doesn't suffer from crash. I guess It suppress events unconditionally.
>>> For JDK8u, "-XX:+EnableTracing -version" will dump some events. It won't crash if it has this patch http://hg.openjdk.java.net/jdk8u/jdk8u-dev/hotspot/rev/80ee2541504e
>>> The attachment is the output.
>> If the Oracle JDK doesn't produce any output then this test will fail on the Oracle JDK so can't be accepted in current form.
>> There's something going on with EnableTracing that I'm not understanding. I'll try to take a closer look tomorrow ( was on a day off today).
>
> Okay ... the Oracle JDK replaces the OpenJDK tracing facility with JFR which completely ignores the EnableTracing flag.
>
> If the test is simply verifying that -XX:+EnableTracing doesn't crash then it can reduce to just:
>
> /*
> * @test
> * @summary Ensure -XX:+EnableTracing doesn't crash
> * @run main/othervm -XX:+EnableTracing TestEnableTracing
> */
> public class TestEnableTracing {
> public static void main(String[] args) {
> }
> }
>
> If you want to actually verify some of the trace output then you will need to guard the shouldMatch/Contain statements with something like:
>
> if (output.getOutput().contains("OpenJDK")) {
> ...
> }
>
> I don't think there is a direct way to ensure the test is only executed on an OpenJDK binary.
>
> Thanks,
> David
>
>> Thanks,
>> David
>>>
>>> Output of jtreg
>>> ###
>>> # Running suite single for openJDK
>>> # Results are available in build/brazil-open-single-tests
>>> ###
>>> Directory "build/JTwork" not found: creating
>>> Passed: runtime/EnableTracing/TestEnableTracing.java
>>> Test results: passed: 1
>>> Report written to /local/home/xxinliu/ws-openjdk8/build/OpenJDK8CompatibilityTests/OpenJDK8CompatibilityTests-1.0/RHEL5_64/DEV.STD.PTHREAD/build/brazil-open-single-tests/html/report.html
>>> Results written to /local/home/xxinliu/ws-openjdk8/build/OpenJDK8CompatibilityTests/OpenJDK8CompatibilityTests-1.0/RHEL5_64/DEV.STD.PTHREAD/build/JTwork
>>>
>>> Thanks,
>>> --lx
>>>
>>>
>>> On 9/2/18, 10:01 PM, "David Holmes" <david.holmes at oracle.com> wrote:
>>>
>>> Hi,
>>> On 25/08/2018 2:35 AM, Liu, Xin wrote:
>>> > Hi, hotspot-Runtime Developers,
>>> >
>>> > Could you review this small tests?
>>> > It adds a new test to verify +EnableTracing works for jdk8u.
>>> I don't see any output produced with just "-XX:+EnableTracing -version". ??
>>> >
>>> /java/re/jdk/8u172/promoted/latest/binaries/linux-amd64/fastdebug/bin/java
>>> -XX:+EnableTracing -version
>>> java version "1.8.0_172-fastdebug"
>>> Java(TM) SE Runtime Environment (build 1.8.0_172-fastdebug-b35)
>>> Java HotSpot(TM) 64-Bit Server VM (build 25.172-b35-fastdebug, mixed mode)
>>> Thanks,
>>> David
>>> > BUG: https://bugs.openjdk.java.net/browse/JDK-8209863
>>> > WEBREV: http://cr.openjdk.java.net/~phh/8209863/webrev.00/
>>> >
>>> > Thanks,
>>> > -lx
>>> >
>>>
More information about the hotspot-runtime-dev
mailing list