Path: blob/master/test/jdk/sun/tools/jps/TestJps.java
41149 views
/*1* Copyright (c) 2014, 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*/2223/*24* @test25* @library /test/lib26* @modules jdk.jartool/sun.tools.jar27* @build jdk.test.lib.apps.LingeredApp28* @run main/othervm/timeout=360 TestJps29*/3031/*32* Notes:33* @modules tag is ignored in driver mode, so need main/othervm34*35* LingeredApp is pre-built separately to have jdk.test.lib classes ready36* before the test is compiled (see JDK-8242282).37*38* Launching the process with relative path to an app jar file is not tested39*40* This test resides in default package, so correct appearance41* of the full package name actually is not tested.42*/4344import jdk.test.lib.apps.LingeredApp;4546public class TestJps {4748public static void testJps(boolean useJar) throws Throwable {49LingeredAppForJps app = new LingeredAppForJps();50if (useJar) {51app.buildJar();52}53try {54LingeredApp.startApp(app, JpsHelper.getVmArgs());55JpsHelper.runJpsVariants(app.getPid(),56app.getProcessName(), app.getFullProcessName(), app.getLockFileName());57} finally {58LingeredApp.stopApp(app);59}60}6162public static void main(String[] args) throws Throwable {63testJps(false);64testJps(true);65}66}676869