Skip to content

Commit be26972

Browse files
author
Andy Herrick
committed
8253379: [windows] Several jpackage tests failed with error code 1638
Reviewed-by: asemenyuk, almatvee, kizune
1 parent 52e45a3 commit be26972

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,18 @@ public static void assertPathExists(Path path, boolean exists) {
698698
}
699699
}
700700

701-
public static void assertDirectoryExists(Path path) {
701+
public static void assertPathNotEmptyDirectory(Path path) {
702+
if (Files.isDirectory(path)) {
703+
ThrowingRunnable.toRunnable(() -> {
704+
try (var files = Files.list(path)) {
705+
TKit.assertFalse(files.findFirst().isEmpty(), String.format
706+
("Check [%s] is not an empty directory", path));
707+
}
708+
}).run();
709+
}
710+
}
711+
712+
public static void assertDirectoryExists(Path path) {
702713
assertPathExists(path, true);
703714
assertTrue(path.toFile().isDirectory(), String.format(
704715
"Check [%s] is a directory", path));

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,12 @@ static PackageHandlers createMsiPackageHandlers() {
110110

111111
static PackageHandlers createExePackageHandlers() {
112112
PackageHandlers exe = new PackageHandlers();
113-
exe.installHandler = cmd -> {
114-
cmd.verifyIsOfType(PackageType.WIN_EXE);
115-
new Executor().setExecutable(cmd.outputBundle()).execute();
116-
};
113+
// can't have install handler without also having uninstall handler
114+
// so following is commented out for now
115+
// exe.installHandler = cmd -> {
116+
// cmd.verifyIsOfType(PackageType.WIN_EXE);
117+
// new Executor().setExecutable(cmd.outputBundle()).execute();
118+
// };
117119

118120
return exe;
119121
}
@@ -208,7 +210,7 @@ private void verifyStartMenuShortcut(Path shortcutsRoot, boolean exists) {
208210
Path shortcutPath = shortcutsRoot.resolve(startMenuShortcutPath());
209211
verifyShortcut(shortcutPath, exists);
210212
if (!exists) {
211-
TKit.assertPathExists(shortcutPath.getParent(), false);
213+
TKit.assertPathNotEmptyDirectory(shortcutPath.getParent());
212214
}
213215
}
214216

0 commit comments

Comments
 (0)