Skip to content

Commit c618617

Browse files
mmm-choishipilev
authored andcommitted
8303959: tools/jpackage/share/RuntimePackageTest.java fails with java.lang.AssertionError missing files
Backport-of: 5a6aa569aa279141193038dc2e61e18a8b24bc11
1 parent 23ee787 commit c618617

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

test/jdk/tools/jpackage/share/RuntimePackageTest.java

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import java.nio.file.Files;
2626
import java.nio.file.Path;
2727
import java.util.HashSet;
28-
import java.util.Optional;
2928
import java.util.Set;
3029
import java.util.function.Predicate;
3130
import java.util.stream.Collectors;
@@ -34,6 +33,8 @@
3433
import jdk.jpackage.test.JPackageCommand;
3534
import jdk.jpackage.test.TKit;
3635
import jdk.jpackage.test.Annotations.Test;
36+
import jdk.jpackage.test.Executor;
37+
import jdk.jpackage.test.JavaTool;
3738
import jdk.jpackage.test.LinuxHelper;
3839
import static jdk.jpackage.test.TKit.assertTrue;
3940
import static jdk.jpackage.test.TKit.assertFalse;
@@ -99,9 +100,25 @@ private static PackageTest init(Set<PackageType> types) {
99100
return new PackageTest()
100101
.forTypes(types)
101102
.addInitializer(cmd -> {
102-
cmd.addArguments("--runtime-image", Optional.ofNullable(
103-
JPackageCommand.DEFAULT_RUNTIME_IMAGE).orElse(Path.of(
104-
System.getProperty("java.home"))));
103+
final Path runtimeImageDir;
104+
if (JPackageCommand.DEFAULT_RUNTIME_IMAGE != null) {
105+
runtimeImageDir = JPackageCommand.DEFAULT_RUNTIME_IMAGE;
106+
} else {
107+
runtimeImageDir = TKit.createTempDirectory("runtime").resolve("data");
108+
109+
new Executor()
110+
.setToolProvider(JavaTool.JLINK)
111+
.dumpOutput()
112+
.addArguments(
113+
"--output", runtimeImageDir.toString(),
114+
"--compress=0",
115+
"--add-modules", "ALL-MODULE-PATH",
116+
"--strip-debug",
117+
"--no-header-files",
118+
"--no-man-pages")
119+
.execute();
120+
}
121+
cmd.addArguments("--runtime-image", runtimeImageDir);
105122
// Remove --input parameter from jpackage command line as we don't
106123
// create input directory in the test and jpackage fails
107124
// if --input references non existant directory.

0 commit comments

Comments
 (0)