8194229: tools/jmod/JmodTest.jtr fails when no privilege to create sym link on windows

Reviewed-by: alanb
This commit is contained in:
Mandy Chung 2018-01-18 16:15:16 -08:00
parent d586b03911
commit dc5bb8b61b
2 changed files with 12 additions and 9 deletions

View File

@ -124,18 +124,21 @@ public class JImageExtractTest extends JImageCliTest {
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 {

View File

@ -104,7 +104,7 @@ public class JmodTest {
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;
}