8194229: tools/jmod/JmodTest.jtr fails when no privilege to create sym link on windows
Reviewed-by: alanb
This commit is contained in:
parent
d586b03911
commit
dc5bb8b61b
@ -124,18 +124,21 @@ public class JImageExtractTest extends JImageCliTest {
|
|||||||
|
|
||||||
public void testExtractToDirBySymlink() throws IOException {
|
public void testExtractToDirBySymlink() throws IOException {
|
||||||
Path tmp = Files.createTempDirectory(Paths.get("."), getClass().getName());
|
Path tmp = Files.createTempDirectory(Paths.get("."), getClass().getName());
|
||||||
|
Path symlink;
|
||||||
try {
|
try {
|
||||||
Path symlink = Files.createSymbolicLink(Paths.get(".", "symlink"), tmp);
|
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())
|
jimage("extract", "--dir", symlink.toString(), getImagePath())
|
||||||
.assertSuccess()
|
.assertSuccess()
|
||||||
.resultChecker(r -> {
|
.resultChecker(r -> {
|
||||||
assertTrue(r.output.isEmpty(), "Output is not expected");
|
assertTrue(r.output.isEmpty(), "Output is not expected");
|
||||||
});
|
});
|
||||||
verifyExplodedImage(tmp);
|
verifyExplodedImage(tmp);
|
||||||
} catch (UnsupportedOperationException e) {
|
|
||||||
// symlinks are not supported
|
|
||||||
// nothing to test
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExtractToReadOnlyDir() throws IOException {
|
public void testExtractToReadOnlyDir() throws IOException {
|
||||||
|
@ -104,7 +104,7 @@ public class JmodTest {
|
|||||||
Path link = Files.createSymbolicLink(
|
Path link = Files.createSymbolicLink(
|
||||||
libDir.resolve("baz"), libDir.resolve("foo").toAbsolutePath());
|
libDir.resolve("baz"), libDir.resolve("foo").toAbsolutePath());
|
||||||
assertTrue(Files.exists(link));
|
assertTrue(Files.exists(link));
|
||||||
} catch (UnsupportedOperationException uoe) {
|
} catch (IOException|UnsupportedOperationException uoe) {
|
||||||
// OS does not support symlinks. Nothing to test!
|
// OS does not support symlinks. Nothing to test!
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user