changeset 48515:f4e628259d1b

8194229: tools/jmod/JmodTest.jtr fails when no privilege to create sym link on windows Reviewed-by: alanb
author mchung
date Thu, 18 Jan 2018 16:15:16 -0800
parents 7fc3d62481ba
children 953eca1167b6
files test/jdk/tools/jimage/JImageExtractTest.java test/jdk/tools/jmod/JmodTest.java
diffstat 2 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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;
         }