jdk/test/tools/pack200/CommandLineTests.java
author alanb
Mon, 21 Jan 2013 23:23:12 -0500
changeset 15684 e5b41bd22ec9
parent 14342 8435a30053c1
child 18594 b6a3c9f71ac8
permissions -rw-r--r--
8004931: add/removePropertyChangeListener should not exist in subset Profiles of Java SE Reviewed-by: dholmes, mchung, ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6314
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
     1
/*
14342
8435a30053c1 7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents: 9734
diff changeset
     2
 * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
6314
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
     4
 *
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
     8
 *
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    13
 * accompanied this code).
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    14
 *
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    18
 *
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    21
 * questions.
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    22
 */
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    23
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    24
/*
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    25
 * @test CommandLineTests.sh
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    26
 * @bug  6521334 6965836 6965836
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    27
 * @compile -XDignore.symbol.file CommandLineTests.java Pack200Test.java
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    28
 * @run main/timeout=1200 CommandLineTests
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    29
 * @summary An ad hoc test to verify the behavior of pack200/unpack200 CLIs,
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    30
 *           and a simulation of pack/unpacking in the install repo.
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    31
 * @author ksrini
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    32
 */
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    33
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    34
import java.io.File;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    35
import java.io.FileOutputStream;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    36
import java.io.IOException;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    37
import java.io.PrintStream;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    38
import java.util.ArrayList;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    39
import java.util.List;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    40
/*
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    41
 * We try a potpouri of things ie. we have pack.conf to setup some
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    42
 * options as well as a couple of command line options. We also test
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    43
 * the packing and unpacking mechanism using the Java APIs. This also
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    44
 * simulates pack200 the install workspace, noting that this is a simulation
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    45
 * and can only test jars that are guaranteed to be available, also the
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    46
 * configuration may not be in sync with the installer workspace.
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    47
 */
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    48
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    49
public class CommandLineTests {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    50
    private static final File CWD = new File(".");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    51
    private static final File EXP_SDK = new File(CWD, "exp-sdk-image");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    52
    private static final File EXP_SDK_LIB_DIR = new File(EXP_SDK, "lib");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    53
    private static final File EXP_SDK_BIN_DIR = new File(EXP_SDK, "bin");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    54
    private static final File EXP_JRE_DIR = new File(EXP_SDK, "jre");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    55
    private static final File EXP_JRE_LIB_DIR = new File(EXP_JRE_DIR, "lib");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    56
    private static final File RtJar = new File(EXP_JRE_LIB_DIR, "rt.jar");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    57
    private static final File CharsetsJar = new File(EXP_JRE_LIB_DIR, "charsets.jar");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    58
    private static final File JsseJar = new File(EXP_JRE_LIB_DIR, "jsse.jar");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    59
    private static final File ToolsJar = new File(EXP_SDK_LIB_DIR, "tools.jar");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    60
    private static final File javaCmd;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    61
    private static final File javacCmd;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    62
    private static final File ConfigFile = new File("pack.conf");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    63
    private static final List<File> jarList;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    64
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    65
    static {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    66
        javaCmd = Utils.IsWindows
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    67
                    ? new File(EXP_SDK_BIN_DIR, "java.exe")
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    68
                    : new File(EXP_SDK_BIN_DIR, "java");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    69
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    70
        javacCmd = Utils.IsWindows
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    71
                    ? new File(EXP_SDK_BIN_DIR, "javac.exe")
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    72
                    : new File(EXP_SDK_BIN_DIR, "javac");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    73
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    74
        jarList = new ArrayList<File>();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    75
        jarList.add(RtJar);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    76
        jarList.add(CharsetsJar);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    77
        jarList.add(JsseJar);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    78
        jarList.add(ToolsJar);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    79
    }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    80
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    81
    // init test area with a copy of the sdk
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    82
    static void init() throws IOException {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    83
            Utils.recursiveCopy(Utils.JavaSDK, EXP_SDK);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    84
            creatConfigFile();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    85
    }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    86
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    87
    // Hopefully, this should be kept in sync with what the installer does.
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    88
    static void creatConfigFile() throws IOException {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    89
        FileOutputStream fos = null;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    90
        PrintStream ps = null;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    91
        try {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    92
            fos = new FileOutputStream(ConfigFile);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    93
            ps = new PrintStream(fos);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    94
            ps.println("com.sun.java.util.jar.pack.debug.verbose=0");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    95
            ps.println("pack.modification.time=keep");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    96
            ps.println("pack.keep.class.order=true");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    97
            ps.println("pack.deflate.hint=false");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    98
            // Fail the build, if new or unknown attributes are introduced.
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    99
            ps.println("pack.unknown.attribute=error");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   100
            ps.println("pack.segment.limit=-1");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   101
            // BugId: 6328502,  These files will be passed-through as-is.
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   102
            ps.println("pack.pass.file.0=java/lang/Error.class");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   103
            ps.println("pack.pass.file.1=java/lang/LinkageError.class");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   104
            ps.println("pack.pass.file.2=java/lang/Object.class");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   105
            ps.println("pack.pass.file.3=java/lang/Throwable.class");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   106
            ps.println("pack.pass.file.4=java/lang/VerifyError.class");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   107
            ps.println("pack.pass.file.5=com/sun/demo/jvmti/hprof/Tracker.class");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   108
        } finally {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   109
            Utils.close(ps);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   110
            Utils.close(fos);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   111
        }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   112
    }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   113
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   114
    static void runPack200(boolean jre) throws IOException {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   115
        List<String> cmdsList = new ArrayList<String>();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   116
        for (File f : jarList) {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   117
            if (jre && f.getName().equals("tools.jar")) {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   118
                continue;  // need not worry about tools.jar for JRE
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   119
            }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   120
            // make a backup copy for re-use
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   121
            File bakFile = new File(f.getName() + ".bak");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   122
            if (!bakFile.exists()) {  // backup
9009
e7036c254324 7031166: (pack200) tools/pack200/CommandLineTests.java fail with testsdk on RO filesystem
ksrini
parents: 6314
diff changeset
   123
                Utils.copyFile(f, bakFile);
6314
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   124
            } else {  // restore
9009
e7036c254324 7031166: (pack200) tools/pack200/CommandLineTests.java fail with testsdk on RO filesystem
ksrini
parents: 6314
diff changeset
   125
                Utils.copyFile(bakFile, f);
6314
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   126
            }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   127
            cmdsList.clear();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   128
            cmdsList.add(Utils.getPack200Cmd());
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   129
            cmdsList.add("-J-esa");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   130
            cmdsList.add("-J-ea");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   131
            cmdsList.add(Utils.Is64Bit ? "-J-Xmx1g" : "-J-Xmx512m");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   132
            cmdsList.add("--repack");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   133
            cmdsList.add("--config-file=" + ConfigFile.getAbsolutePath());
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   134
            if (jre) {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   135
                cmdsList.add("--strip-debug");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   136
            }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   137
            // NOTE: commented until 6965836 is fixed
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   138
            // cmdsList.add("--code-attribute=StackMapTable=strip");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   139
            cmdsList.add(f.getAbsolutePath());
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   140
            Utils.runExec(cmdsList);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   141
        }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   142
    }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   143
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   144
    static void testJRE() throws IOException {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   145
        runPack200(true);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   146
        // the speciment JRE
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   147
        List<String> cmdsList = new ArrayList<String>();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   148
        cmdsList.add(javaCmd.getAbsolutePath());
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   149
        cmdsList.add("-verify");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   150
        cmdsList.add("-version");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   151
        Utils.runExec(cmdsList);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   152
    }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   153
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   154
    static void testJDK() throws IOException {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   155
        runPack200(false);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   156
        // test the specimen JDK
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   157
        List<String> cmdsList = new ArrayList<String>();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   158
        cmdsList.add(javaCmd.getAbsolutePath());
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   159
        cmdsList.add("-verify");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   160
        cmdsList.add("-version");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   161
        Utils.runExec(cmdsList);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   162
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   163
        // invoke javac to test the tools.jar
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   164
        cmdsList.clear();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   165
        cmdsList.add(javacCmd.getAbsolutePath());
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   166
        cmdsList.add("-J-verify");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   167
        cmdsList.add("-help");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   168
        Utils.runExec(cmdsList);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   169
    }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   170
    public static void main(String... args) {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   171
        try {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   172
            init();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   173
            testJRE();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   174
            testJDK();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   175
        } catch (IOException ioe) {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   176
            throw new RuntimeException(ioe);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   177
        }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   178
    }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   179
}