Today, there is no testing of JFR API from a Java agent. There is a test caledl EvilInstrument.java, but It doesn't start JFR programmatically It only instruments JDK code that JFR also tries to instrument.
The new test:
- Should start a recording
- Commit 1 000 000 events from 5 different threads. This will fill some global buffers and provoke a chunk rotation. The events should contain:
- stack trace
- a class field
- a thread field (assigned with a started thread)
- a string field (assigned with a string of more than 20 characters)
The above will provoke constant pools early.
- Stop the recording
- Dump the file
- Verify the file is correct (in process)
- Transfer recording over JMX to another process and verify that it is correct.
All operations should happen before the main method is started.
Using a Java agent is a common scenario for tools vendors and should explicitly be tested.