Skip to content

Commit 2d09284

Browse files
author
Alexander Matveev
committed
8373105: Test tools/jpackage/share/AsyncTest.java failed: problem running hdiutil
Reviewed-by: asemenyuk
1 parent 0a70da4 commit 2d09284

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacHelper.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,18 @@ public static void withExplodedDmg(JPackageCommand cmd,
8181
ThrowingConsumer<Path, ? extends Exception> consumer) {
8282
cmd.verifyIsOfType(PackageType.MAC_DMG);
8383

84+
// Mount DMG under random temporary folder to avoid collisions when
85+
// mounting DMG with same name asynchroniusly multiple times.
86+
// See JDK-8373105. "hdiutil" does not handle such cases very good.
87+
final var mountRoot = TKit.createTempDirectory("mountRoot");
88+
8489
// Explode DMG assuming this can require interaction, thus use `yes`.
8590
String attachCMD[] = {
8691
"sh", "-c",
8792
String.join(" ", "yes", "|", "/usr/bin/hdiutil", "attach",
88-
JPackageCommand.escapeAndJoin(
89-
cmd.outputBundle().toString()), "-plist")};
93+
JPackageCommand.escapeAndJoin(cmd.outputBundle().toString()),
94+
"-mountroot", PathUtils.normalizedAbsolutePathString(mountRoot),
95+
"-nobrowse", "-plist")};
9096
RetryExecutor attachExecutor = new RetryExecutor();
9197
try {
9298
// 10 times with 6 second delays.

0 commit comments

Comments
 (0)