< prev index next >

test/jdk/tools/jimage/JImageToolTest.java

Print this page
rev 51638 : [mq]: 8210112


   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 /*
  24  * @test
  25  * @library /lib/testlibrary
  26  * @build jdk.testlibrary.ProcessTools
  27  * @summary Test to check if jimage tool exists and is working
  28  * @run main/timeout=360 JImageToolTest
  29  */
  30 
  31 import java.nio.file.Files;
  32 import java.nio.file.Path;
  33 import java.nio.file.Paths;
  34 import java.util.ArrayList;
  35 import java.util.Arrays;
  36 
  37 import jdk.testlibrary.ProcessTools;
  38 
  39 /**
  40  * Basic test for jimage tool.
  41  */
  42 public class JImageToolTest {
  43     private static void jimage(String... jimageArgs) throws Exception {
  44         ArrayList<String> args = new ArrayList<>();
  45         args.add("-ms64m");
  46         args.add("jdk.tools.jimage.Main");
  47         args.addAll(Arrays.asList(jimageArgs));
  48 
  49         ProcessBuilder builder = ProcessTools.createJavaProcessBuilder(args.toArray(new String[args.size()]));
  50         int res = builder.inheritIO().start().waitFor();
  51 
  52         if (res != 0) {
  53             throw new RuntimeException("JImageToolTest FAILED");
  54         }
  55     }
  56 
  57     public static void main(String[] args) throws Exception {


   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 /*
  24  * @test
  25  * @library /test/lib
  26  * @build jdk.test.lib.process.ProcessTools
  27  * @summary Test to check if jimage tool exists and is working
  28  * @run main/timeout=360 JImageToolTest
  29  */
  30 
  31 import java.nio.file.Files;
  32 import java.nio.file.Path;
  33 import java.nio.file.Paths;
  34 import java.util.ArrayList;
  35 import java.util.Arrays;
  36 
  37 import jdk.test.lib.process.ProcessTools;
  38 
  39 /**
  40  * Basic test for jimage tool.
  41  */
  42 public class JImageToolTest {
  43     private static void jimage(String... jimageArgs) throws Exception {
  44         ArrayList<String> args = new ArrayList<>();
  45         args.add("-ms64m");
  46         args.add("jdk.tools.jimage.Main");
  47         args.addAll(Arrays.asList(jimageArgs));
  48 
  49         ProcessBuilder builder = ProcessTools.createJavaProcessBuilder(args.toArray(new String[args.size()]));
  50         int res = builder.inheritIO().start().waitFor();
  51 
  52         if (res != 0) {
  53             throw new RuntimeException("JImageToolTest FAILED");
  54         }
  55     }
  56 
  57     public static void main(String[] args) throws Exception {
< prev index next >