[jdk8u-dev] RFR: JDK-8292998: Clean Secmod temporary NSS DB directory before test execution

Andrew John Hughes andrew at openjdk.org
Wed Aug 31 02:49:25 UTC 2022


On Fri, 26 Aug 2022 22:26:06 GMT, Martin Balao <mbalao at openjdk.org> wrote:

> Hello,
> 
> I'd like to propose this fix as described in https://bugs.openjdk.org/browse/JDK-8292998
> 
> The temporary directory used by Secmod tests to copy NSS DB files is deleted (which includes all its files and, potentially, subdirectories) and created empty again before running the test. I decided to implement the recursive delete function here for 3 reasons: 1) it's a short and simple function,  2) convenience (we don't have to link every current Secmod test to a test library) and 3) increase chances of backporting future Secmod tests cleanly. Contrary to the approach of setting a minimum jtreg version required, the scope of this change are Secmod tests only and the risk should be minimal.
> 
> Thanks,
> Martin.-

Changes requested by andrew (Reviewer).

jdk/test/sun/security/pkcs11/SecmodTest.java line 99:

> 97:     }
> 98: 
> 99:     private static void deleteDir(final Path directory) throws IOException {

Can we not use `FileUtils.deleteFileTreeWithRetry(Path)` here? That seems to be the same thing, but with better error handling.

See `jdk/test/lib/jdk/test/lib/util/FileUtils.java`

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

PR: https://git.openjdk.org/jdk8u-dev/pull/115


More information about the jdk8u-dev mailing list