PerfMapTest.java issues the Compiler.perfmap jcmd with a filename argument to write the perfmap to. It does this in 3 different modes. 2 of the modes result in a perfmap file being left in the tmp directory that is not removed after the test executes (and should be removed). The 3rd mode creates the perfmap file in the directory specified by the test.dir property, and is ok to leave the file there. I've added code to delete the /tmp files that are created.
I did a bit of extra testing by hand. I created /tmp/perf-<pid>.map as root. As expected the Files.deleteIfExists() call threw an exception due to the lack of permissions to delete the file. However, I then realized the file had a size of 0, which means the test was not even doing a proper job of testing that the perfrmap jcmd was working. In other words, the test should have failed long before getting to the Files.deleteIfExists(), so I added a size check to make sure it fails when the file is not written to. ------------- Commit messages: - Delete tmp files Changes: https://git.openjdk.org/jdk/pull/17992/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17992&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8325532 Stats: 11 lines in 1 file changed: 8 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/17992.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17992/head:pull/17992 PR: https://git.openjdk.org/jdk/pull/17992