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

Sonia Zaldana Calles szaldana at openjdk.org
Fri Jul 19 20:17:46 UTC 2024


On Fri, 19 Jul 2024 19:21:05 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> Sonia Zaldana Calles has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Ensuring test case deletes file in case of exception
>
> 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.

Makes sense, I added the finally block.

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

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


More information about the serviceability-dev mailing list