Path: blob/master/test/hotspot/jtreg/testlibrary_tests/ctw/JarsTest.java
40942 views
/*1* Copyright (c) 2013, 2021, 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*/2223/*24* @test25* @bug 801244726* @library /test/lib /testlibrary/ctw/src27* @modules java.base/jdk.internal.access28* java.base/jdk.internal.jimage29* java.base/jdk.internal.misc30* java.base/jdk.internal.reflect31* java.compiler32* java.management33* jdk.internal.jvmstat/sun.jvmstat.monitor34* @build sun.hotspot.WhiteBox Foo Bar35* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox Foo Bar36* @run driver JarsTest prepare37* @run driver JarsTest compile foo.jar bar.jar38* @run driver JarsTest check39* @summary testing of CompileTheWorld :: jars40* @author [email protected]41*/4243import jdk.test.lib.process.OutputAnalyzer;4445public class JarsTest extends CtwTest {46private static final String[] SHOULD_CONTAIN47= {"# jar: foo.jar", "# jar: bar.jar",48"Done (4 classes, 12 methods, "};4950private JarsTest() {51super(SHOULD_CONTAIN);52}5354public static void main(String[] args) throws Exception {55new JarsTest().run(args);56}5758protected void prepare() throws Exception {59ProcessBuilder pb = createJarProcessBuilder("cf", "foo.jar",60"Foo.class", "Bar.class");61OutputAnalyzer output = new OutputAnalyzer(pb.start());62dump(output, "ctw-foo.jar");63output.shouldHaveExitValue(0);6465pb = createJarProcessBuilder("cf", "bar.jar", "Foo.class", "Bar.class");66output = new OutputAnalyzer(pb.start());67dump(output, "ctw-bar.jar");68output.shouldHaveExitValue(0);69}7071}727374