8194229: tools/jmod/JmodTest.jtr fails when no privilege to create sym link on windows
Reviewed-by: alanb
--- a/test/jdk/tools/jimage/JImageExtractTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/tools/jimage/JImageExtractTest.java Thu Jan 18 16:15:16 2018 -0800
@@ -124,18 +124,21 @@
public void testExtractToDirBySymlink() throws IOException {
Path tmp = Files.createTempDirectory(Paths.get("."), getClass().getName());
+ Path symlink;
try {
- Path symlink = Files.createSymbolicLink(Paths.get(".", "symlink"), tmp);
- jimage("extract", "--dir", symlink.toString(), getImagePath())
- .assertSuccess()
- .resultChecker(r -> {
- assertTrue(r.output.isEmpty(), "Output is not expected");
- });
- verifyExplodedImage(tmp);
- } catch (UnsupportedOperationException e) {
+ symlink = Files.createSymbolicLink(Paths.get(".", "symlink"), tmp);
+ } catch (IOException|UnsupportedOperationException e) {
// symlinks are not supported
// nothing to test
+ return;
}
+
+ jimage("extract", "--dir", symlink.toString(), getImagePath())
+ .assertSuccess()
+ .resultChecker(r -> {
+ assertTrue(r.output.isEmpty(), "Output is not expected");
+ });
+ verifyExplodedImage(tmp);
}
public void testExtractToReadOnlyDir() throws IOException {
--- a/test/jdk/tools/jmod/JmodTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/tools/jmod/JmodTest.java Thu Jan 18 16:15:16 2018 -0800
@@ -104,7 +104,7 @@
Path link = Files.createSymbolicLink(
libDir.resolve("baz"), libDir.resolve("foo").toAbsolutePath());
assertTrue(Files.exists(link));
- } catch (UnsupportedOperationException uoe) {
+ } catch (IOException|UnsupportedOperationException uoe) {
// OS does not support symlinks. Nothing to test!
return;
}