Path: blob/master/test/jdk/tools/jpackage/share/RuntimeImageTest.java
41149 views
/*1* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223import java.io.IOException;24import java.nio.file.Files;25import java.nio.file.Path;26import java.util.HashSet;27import java.util.Optional;28import java.util.Set;29import java.util.stream.Collectors;30import jdk.jpackage.test.TKit;31import jdk.jpackage.test.PackageTest;32import jdk.jpackage.test.PackageType;33import jdk.jpackage.test.Functional;34import jdk.jpackage.test.Annotations.Test;35import jdk.jpackage.test.Annotations.Parameter;36import jdk.jpackage.test.PackageTest;37import jdk.jpackage.test.JPackageCommand;38import jdk.jpackage.test.JavaTool;39import jdk.jpackage.test.Executor;4041/*42* @test43* @summary jpackage with --runtime-image44* @library ../helpers45* @key jpackagePlatformPackage46* @build jdk.jpackage.test.*47* @modules jdk.incubator.jpackage/jdk.incubator.jpackage.internal48* @compile RuntimeImageTest.java49* @run main/othervm/timeout=1400 -Xmx512m jdk.jpackage.test.Main50* --jpt-run=RuntimeImageTest51*/5253public class RuntimeImageTest {5455@Test56@Parameter("0")57@Parameter("1")58@Parameter("2")59public static void test(String compression) throws Exception {60final Path workDir = TKit.createTempDirectory("runtime").resolve("data");61final Path jlinkOutputDir = workDir.resolve("temp.runtime");62Files.createDirectories(jlinkOutputDir.getParent());6364new Executor()65.setToolProvider(JavaTool.JLINK)66.dumpOutput()67.addArguments(68"--output", jlinkOutputDir.toString(),69"--compress=" + compression,70"--add-modules", "ALL-MODULE-PATH",71"--strip-debug",72"--no-header-files",73"--no-man-pages",74"--strip-native-commands")75.execute();7677JPackageCommand cmd = JPackageCommand.helloAppImage()78.setArgumentValue("--runtime-image", jlinkOutputDir.toString());7980cmd.executeAndAssertHelloAppImageCreated();81}8283}848586