RFR: 8368846: java/io/File/createTempFile/TargetDirectory fails when run by root user

Roger Riggs rriggs at openjdk.org
Thu Oct 9 14:31:34 UTC 2025


On Mon, 29 Sep 2025 08:28:38 GMT, Francesco Andreuzzi <fandreuzzi at openjdk.org> wrote:

> The test checks whether writing to a read-only directory throws a `IOException`. This test is not applicable when the user running the test is root. Thus, I propose to skip it.
> 
> I converted the class to several JUnit tests, so we can use `@DisabledIf`.

test/jdk/java/io/File/createTempFile/TargetDirectory.java line 66:

> 64: 
> 65:     @Test
> 66:     @DisabledIf("jdk.test.lib.Platform#isRoot")

This will silently skip the test.
Jtreg has a feature for keeping track of Skipped tests and reporting they were skipped.
Throwing SkippedException would enable that reporting.
Take a look at a similar test: `test/jdk/java/io/File/SetAccess.java`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27542#discussion_r2417007605


More information about the core-libs-dev mailing list