RFR: 8327054: DiagnosticCommand Compiler.perfmap does not log on output()

Chris Plummer cjplummer at openjdk.org
Fri Jul 19 19:23:31 UTC 2024


On Fri, 19 Jul 2024 15:07:39 GMT, Sonia Zaldana Calles <szaldana at openjdk.org> wrote:

> Hi all, 
> 
> This is a small patch to address [8327054](https://bugs.openjdk.org/browse/JDK-8327054) making `CodeCache::write_perf_map` aware of which output stream errors and warning message should be going to.
> 
> Testing: 
> - [x] Added test case passes. 
> 
> Thanks, 
> Sonia

test/hotspot/jtreg/serviceability/dcmd/compiler/PerfMapTest.java line 124:

> 122:         output.shouldContain("Failed to create nonexistent/%s for perf map".formatted(test_dir));
> 123:         output.shouldNotHaveExitValue(0);
> 124:         Files.deleteIfExists(path);

If the file exists, that means the expected error message will not be found, which means an exception will be thrown before you get to the `Files.deleteIfExits(path)` call. If the file doesn't exist, then there is nothing to delete. So as things stand now this call will never delete anything. Maybe put it in a finally block so if the file does exist it will get deleted.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20257#discussion_r1684890829


More information about the serviceability-dev mailing list