test/jdk/tools/pack200/CommandLineTests.java
author lancea
Tue, 29 Oct 2019 14:22:18 -0400
changeset 58845 e492513d3630
parent 47216 71c04702a3d5
permissions -rw-r--r--
8231766: Files.copy and Files.move do not honor requested compression method when copying or moving within the same zip file Reviewed-by: clanger, bpb, alanb
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
/*
27565
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 18594
diff changeset
     2
 * Copyright (c) 2007, 2014, 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
27565
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 18594
diff changeset
    27
 * @ignore 8059906
6314
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    28
 * @compile -XDignore.symbol.file CommandLineTests.java Pack200Test.java
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    29
 * @run main/timeout=1200 CommandLineTests
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    30
 * @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
    31
 *           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
    32
 * @author ksrini
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
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    35
import java.io.File;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    36
import java.io.FileOutputStream;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    37
import java.io.IOException;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    38
import java.io.PrintStream;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    39
import java.util.ArrayList;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    40
import java.util.List;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    41
/*
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    42
 * 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
    43
 * 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
    44
 * 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
    45
 * 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
    46
 * 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
    47
 * 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
    48
 */
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    49
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    50
public class CommandLineTests {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    51
    private static final File CWD = new File(".");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    52
    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
    53
    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
    54
    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
    55
    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
    56
    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
    57
    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
    58
    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
    59
    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
    60
    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
    61
    private static final File javaCmd;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    62
    private static final File javacCmd;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    63
    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
    64
    private static final List<File> jarList;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    65
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    66
    static {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    67
        javaCmd = Utils.IsWindows
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    68
                    ? new File(EXP_SDK_BIN_DIR, "java.exe")
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    69
                    : new File(EXP_SDK_BIN_DIR, "java");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    70
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    71
        javacCmd = Utils.IsWindows
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    72
                    ? new File(EXP_SDK_BIN_DIR, "javac.exe")
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    73
                    : new File(EXP_SDK_BIN_DIR, "javac");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    74
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    75
        jarList = new ArrayList<File>();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    76
        jarList.add(RtJar);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    77
        jarList.add(CharsetsJar);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    78
        jarList.add(JsseJar);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    79
        jarList.add(ToolsJar);
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
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    82
    // 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
    83
    static void init() throws IOException {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    84
            Utils.recursiveCopy(Utils.JavaSDK, EXP_SDK);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    85
            creatConfigFile();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    86
    }
18594
b6a3c9f71ac8 8017463: [TEST_BUG] 2 tests from tools/pack200/ remain about 1 GB of data in work directory after execution
ksrini
parents: 14342
diff changeset
    87
    // cleanup the test area
b6a3c9f71ac8 8017463: [TEST_BUG] 2 tests from tools/pack200/ remain about 1 GB of data in work directory after execution
ksrini
parents: 14342
diff changeset
    88
    static void cleanup() throws IOException {
b6a3c9f71ac8 8017463: [TEST_BUG] 2 tests from tools/pack200/ remain about 1 GB of data in work directory after execution
ksrini
parents: 14342
diff changeset
    89
        Utils.recursiveDelete(EXP_SDK);
b6a3c9f71ac8 8017463: [TEST_BUG] 2 tests from tools/pack200/ remain about 1 GB of data in work directory after execution
ksrini
parents: 14342
diff changeset
    90
        Utils.cleanup();
b6a3c9f71ac8 8017463: [TEST_BUG] 2 tests from tools/pack200/ remain about 1 GB of data in work directory after execution
ksrini
parents: 14342
diff changeset
    91
    }
6314
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    92
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    93
    // 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
    94
    static void creatConfigFile() throws IOException {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    95
        FileOutputStream fos = null;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    96
        PrintStream ps = null;
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    97
        try {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    98
            fos = new FileOutputStream(ConfigFile);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
    99
            ps = new PrintStream(fos);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   100
            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
   101
            ps.println("pack.modification.time=keep");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   102
            ps.println("pack.keep.class.order=true");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   103
            ps.println("pack.deflate.hint=false");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   104
            // 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
   105
            ps.println("pack.unknown.attribute=error");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   106
            ps.println("pack.segment.limit=-1");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   107
            // 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
   108
            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
   109
            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
   110
            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
   111
            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
   112
            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
   113
        } finally {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   114
            Utils.close(ps);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   115
            Utils.close(fos);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   116
        }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   117
    }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   118
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   119
    static void runPack200(boolean jre) throws IOException {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   120
        List<String> cmdsList = new ArrayList<String>();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   121
        for (File f : jarList) {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   122
            if (jre && f.getName().equals("tools.jar")) {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   123
                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
   124
            }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   125
            // make a backup copy for re-use
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   126
            File bakFile = new File(f.getName() + ".bak");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   127
            if (!bakFile.exists()) {  // backup
9009
e7036c254324 7031166: (pack200) tools/pack200/CommandLineTests.java fail with testsdk on RO filesystem
ksrini
parents: 6314
diff changeset
   128
                Utils.copyFile(f, bakFile);
6314
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   129
            } else {  // restore
9009
e7036c254324 7031166: (pack200) tools/pack200/CommandLineTests.java fail with testsdk on RO filesystem
ksrini
parents: 6314
diff changeset
   130
                Utils.copyFile(bakFile, f);
6314
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   131
            }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   132
            cmdsList.clear();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   133
            cmdsList.add(Utils.getPack200Cmd());
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   134
            cmdsList.add("-J-esa");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   135
            cmdsList.add("-J-ea");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   136
            cmdsList.add(Utils.Is64Bit ? "-J-Xmx1g" : "-J-Xmx512m");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   137
            cmdsList.add("--repack");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   138
            cmdsList.add("--config-file=" + ConfigFile.getAbsolutePath());
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   139
            if (jre) {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   140
                cmdsList.add("--strip-debug");
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
            // NOTE: commented until 6965836 is fixed
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   143
            // cmdsList.add("--code-attribute=StackMapTable=strip");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   144
            cmdsList.add(f.getAbsolutePath());
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   145
            Utils.runExec(cmdsList);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   146
        }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   147
    }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   148
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   149
    static void testJRE() throws IOException {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   150
        runPack200(true);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   151
        // the speciment JRE
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   152
        List<String> cmdsList = new ArrayList<String>();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   153
        cmdsList.add(javaCmd.getAbsolutePath());
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   154
        cmdsList.add("-verify");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   155
        cmdsList.add("-version");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   156
        Utils.runExec(cmdsList);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   157
    }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   158
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   159
    static void testJDK() throws IOException {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   160
        runPack200(false);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   161
        // test the specimen JDK
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   162
        List<String> cmdsList = new ArrayList<String>();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   163
        cmdsList.add(javaCmd.getAbsolutePath());
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   164
        cmdsList.add("-verify");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   165
        cmdsList.add("-version");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   166
        Utils.runExec(cmdsList);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   167
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   168
        // invoke javac to test the tools.jar
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   169
        cmdsList.clear();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   170
        cmdsList.add(javacCmd.getAbsolutePath());
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   171
        cmdsList.add("-J-verify");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   172
        cmdsList.add("-help");
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   173
        Utils.runExec(cmdsList);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   174
    }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   175
    public static void main(String... args) {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   176
        try {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   177
            init();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   178
            testJRE();
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   179
            testJDK();
18594
b6a3c9f71ac8 8017463: [TEST_BUG] 2 tests from tools/pack200/ remain about 1 GB of data in work directory after execution
ksrini
parents: 14342
diff changeset
   180
            cleanup(); // cleanup only if we pass successfully
6314
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   181
        } catch (IOException ioe) {
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   182
            throw new RuntimeException(ioe);
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   183
        }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   184
    }
8ab691ddb904 6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff changeset
   185
}