test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java
author iignatyev
Thu, 02 Aug 2018 14:40:55 -0700
changeset 51287 7b1ddbafa134
parent 50791 b1e90a8a876c
child 51418 45d1f2ec5342
permissions -rw-r--r--
8208655: use JTreg skipped status in hotspot tests Reviewed-by: kvn, hseigel, iklam
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49896
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
     1
/*
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
     4
 *
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
     7
 * published by the Free Software Foundation.
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
     8
 *
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    13
 * accompanied this code).
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    14
 *
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    18
 *
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    21
 * questions.
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    22
 */
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    23
50791
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50093
diff changeset
    24
/**
49896
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    25
 * @test
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    26
 * @bug 8174994
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    27
 * @summary Test the clhsdb commands 'printmdo', 'printall' on a CDS enabled corefile.
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    28
 * @requires vm.cds
50791
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50093
diff changeset
    29
 * @requires vm.hasSA
49896
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    30
 * @requires os.family != "windows"
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    31
 * @requires vm.flavor == "server"
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    32
 * @library /test/lib
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    33
 * @modules java.base/jdk.internal.misc
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    34
 * @run main/othervm/timeout=2400 -Xmx1g ClhsdbCDSCore
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    35
 */
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    36
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    37
import java.util.List;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    38
import java.util.ArrayList;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    39
import java.util.Arrays;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    40
import java.util.Map;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    41
import java.util.HashMap;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    42
import jdk.test.lib.process.ProcessTools;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    43
import jdk.test.lib.Platform;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    44
import jdk.test.lib.process.OutputAnalyzer;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    45
import jdk.test.lib.cds.CDSTestUtils;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    46
import jdk.test.lib.cds.CDSOptions;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    47
import java.io.IOException;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    48
import java.io.File;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    49
import java.nio.file.Files;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    50
import java.nio.file.Path;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    51
import java.nio.file.Paths;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    52
import jdk.test.lib.Asserts;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    53
import java.util.regex.Pattern;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    54
import java.util.regex.Matcher;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    55
import jdk.internal.misc.Unsafe;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    56
import java.util.Scanner;
51287
7b1ddbafa134 8208655: use JTreg skipped status in hotspot tests
iignatyev
parents: 50791
diff changeset
    57
import jtreg.SkippedException;
49896
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    58
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    59
class CrashApp {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    60
    public static void main(String[] args) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    61
        Unsafe.getUnsafe().putInt(0L, 0);
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    62
    }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    63
}
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    64
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    65
public class ClhsdbCDSCore {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    66
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    67
    private static final String TEST_CDS_CORE_FILE_NAME = "cds_core_file";
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    68
    private static final String LOCATIONS_STRING = "location: ";
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    69
    private static final String RUN_SHELL_NO_LIMIT = "ulimit -c unlimited && ";
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    70
    private static final String SHARED_ARCHIVE_NAME = "ArchiveForClhsdbCDSCore.jsa";
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    71
    private static final String CORE_PATTERN_FILE_NAME = "/proc/sys/kernel/core_pattern";
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    72
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    73
    public static void main(String[] args) throws Exception {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    74
        System.out.println("Starting ClhsdbCDSCore test");
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    75
        cleanup();
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    76
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    77
        try {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    78
            CDSOptions opts = (new CDSOptions()).setArchiveName(SHARED_ARCHIVE_NAME);
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    79
            CDSTestUtils.createArchiveAndCheck(opts);
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    80
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    81
            String[] jArgs = {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    82
                "-XX:+UnlockDiagnosticVMOptions",
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    83
                "-XX:SharedArchiveFile=" + SHARED_ARCHIVE_NAME,
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    84
                "-XX:+CreateCoredumpOnCrash",
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    85
                "-Xshare:auto",
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    86
                "-XX:+ProfileInterpreter",
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    87
                "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED",
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    88
                CrashApp.class.getName()
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    89
            };
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    90
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    91
            OutputAnalyzer crashOut;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    92
            try {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    93
               List<String> options = new ArrayList<>();
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    94
               options.addAll(Arrays.asList(jArgs));
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    95
               crashOut =
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    96
                   ProcessTools.executeProcess(getTestJavaCommandlineWithPrefix(
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    97
                   RUN_SHELL_NO_LIMIT, options.toArray(new String[0])));
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    98
            } catch (Throwable t) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
    99
               throw new Error("Can't execute the java cds process.", t);
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   100
            }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   101
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   102
            System.out.println(crashOut.getOutput());
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   103
            String crashOutputString = crashOut.getOutput();
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   104
            String coreFileLocation = getCoreFileLocation(crashOutputString);
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   105
            if (coreFileLocation == null) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   106
                if (Platform.isOSX()) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   107
                    File coresDir = new File("/cores");
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   108
                    if (!coresDir.isDirectory() || !coresDir.canWrite()) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   109
                        throw new Error("cores is not a directory or does not have write permissions");
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   110
                    }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   111
                } else if (Platform.isLinux()) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   112
                    // Check if a crash report tool is installed.
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   113
                    File corePatternFile = new File(CORE_PATTERN_FILE_NAME);
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   114
                    Scanner scanner = new Scanner(corePatternFile);
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   115
                    while (scanner.hasNextLine()) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   116
                        String line = scanner.nextLine();
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   117
                        line = line.trim();
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   118
                        System.out.println(line);
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   119
                        if (line.startsWith("|")) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   120
                            System.out.println(
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   121
                                "\nThis system uses a crash report tool ($cat /proc/sys/kernel/core_pattern).\n" +
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   122
                                "Core files might not be generated. Please reset /proc/sys/kernel/core_pattern\n" +
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   123
                                "to enable core generation. Skipping this test.");
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   124
                            cleanup();
51287
7b1ddbafa134 8208655: use JTreg skipped status in hotspot tests
iignatyev
parents: 50791
diff changeset
   125
                            throw new SkippedException("This system uses a crash report tool");
49896
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   126
                        }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   127
                    }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   128
                }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   129
                throw new Error("Couldn't find core file location in: '" + crashOutputString + "'");
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   130
            }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   131
            try {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   132
                Asserts.assertGT(new File(coreFileLocation).length(), 0L, "Unexpected core size");
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   133
                Files.move(Paths.get(coreFileLocation), Paths.get(TEST_CDS_CORE_FILE_NAME));
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   134
            } catch (IOException ioe) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   135
                throw new Error("Can't move core file: " + ioe, ioe);
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   136
            }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   137
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   138
            ClhsdbLauncher test = new ClhsdbLauncher();
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   139
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   140
            // Ensure that UseSharedSpaces is turned on.
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   141
            List<String> cmds = List.of("flags UseSharedSpaces");
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   142
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   143
            String useSharedSpacesOutput = test.runOnCore(TEST_CDS_CORE_FILE_NAME, cmds,
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   144
                                                          null, null);
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   145
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   146
            if (useSharedSpacesOutput == null) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   147
                // Output could be null due to attach permission issues.
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   148
                cleanup();
51287
7b1ddbafa134 8208655: use JTreg skipped status in hotspot tests
iignatyev
parents: 50791
diff changeset
   149
                throw new SkippedException("Could not determine the UseSharedSpaces value");
49896
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   150
            }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   151
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   152
            if (!useSharedSpacesOutput.contains("true")) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   153
                // CDS archive is not mapped. Skip the rest of the test.
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   154
                cleanup();
51287
7b1ddbafa134 8208655: use JTreg skipped status in hotspot tests
iignatyev
parents: 50791
diff changeset
   155
                throw new SkippedException("The CDS archive is not mapped");
49896
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   156
            }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   157
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   158
            cmds = List.of("printmdo -a", "printall");
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   159
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   160
            Map<String, List<String>> expStrMap = new HashMap<>();
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   161
            Map<String, List<String>> unExpStrMap = new HashMap<>();
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   162
            expStrMap.put("printmdo -a", List.of(
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   163
                "CounterData",
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   164
                "BranchData"));
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   165
            unExpStrMap.put("printmdo -a", List.of(
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   166
                "No suitable match for type of address"));
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   167
            expStrMap.put("printall", List.of(
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   168
                "aload_0",
50093
55153a374d18 8174995: SA: clhsdb 'where -a' throws Assertion Failure with illegal code 236 when CDS is used
jgeorge
parents: 49896
diff changeset
   169
                "_nofast_aload_0",
55153a374d18 8174995: SA: clhsdb 'where -a' throws Assertion Failure with illegal code 236 when CDS is used
jgeorge
parents: 49896
diff changeset
   170
                "_nofast_getfield",
55153a374d18 8174995: SA: clhsdb 'where -a' throws Assertion Failure with illegal code 236 when CDS is used
jgeorge
parents: 49896
diff changeset
   171
                "_nofast_putfield",
49896
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   172
                "Constant Pool of",
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   173
                "public static void main(java.lang.String[])",
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   174
                "Bytecode",
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   175
                "invokevirtual",
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   176
                "checkcast",
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   177
                "Exception Table",
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   178
                "invokedynamic"));
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   179
            unExpStrMap.put("printall", List.of(
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   180
                "sun.jvm.hotspot.types.WrongTypeException",
50093
55153a374d18 8174995: SA: clhsdb 'where -a' throws Assertion Failure with illegal code 236 when CDS is used
jgeorge
parents: 49896
diff changeset
   181
                "illegal code",
55153a374d18 8174995: SA: clhsdb 'where -a' throws Assertion Failure with illegal code 236 when CDS is used
jgeorge
parents: 49896
diff changeset
   182
                "Failure occurred at bci",
49896
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   183
                "No suitable match for type of address"));
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   184
            test.runOnCore(TEST_CDS_CORE_FILE_NAME, cmds, expStrMap, unExpStrMap);
51287
7b1ddbafa134 8208655: use JTreg skipped status in hotspot tests
iignatyev
parents: 50791
diff changeset
   185
        } catch (SkippedException e) {
7b1ddbafa134 8208655: use JTreg skipped status in hotspot tests
iignatyev
parents: 50791
diff changeset
   186
            throw e;
49896
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   187
        } catch (Exception ex) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   188
            throw new RuntimeException("Test ERROR " + ex, ex);
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   189
        }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   190
        cleanup();
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   191
        System.out.println("Test PASSED");
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   192
    }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   193
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   194
    // lets search for a few possible locations using process output and return existing location
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   195
    private static String getCoreFileLocation(String crashOutputString) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   196
        Asserts.assertTrue(crashOutputString.contains(LOCATIONS_STRING),
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   197
            "Output doesn't contain the location of core file.");
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   198
        String stringWithLocation = Arrays.stream(crashOutputString.split("\\r?\\n"))
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   199
            .filter(str -> str.contains(LOCATIONS_STRING))
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   200
            .findFirst()
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   201
            .get();
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   202
        stringWithLocation = stringWithLocation.substring(stringWithLocation
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   203
            .indexOf(LOCATIONS_STRING) + LOCATIONS_STRING.length());
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   204
        String coreWithPid;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   205
        if (stringWithLocation.contains("or ")) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   206
            Matcher m = Pattern.compile("or.* ([^ ]+[^\\)])\\)?").matcher(stringWithLocation);
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   207
            if (!m.find()) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   208
                throw new Error("Couldn't find path to core inside location string");
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   209
            }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   210
            coreWithPid = m.group(1);
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   211
        } else {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   212
            coreWithPid = stringWithLocation.trim();
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   213
        }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   214
        if (new File(coreWithPid).exists()) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   215
            return coreWithPid;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   216
        }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   217
        String justCore = Paths.get("core").toString();
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   218
        if (new File(justCore).exists()) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   219
            return justCore;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   220
        }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   221
        Path coreWithPidPath = Paths.get(coreWithPid);
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   222
        String justFile = coreWithPidPath.getFileName().toString();
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   223
        if (new File(justFile).exists()) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   224
            return justFile;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   225
        }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   226
        Path parent = coreWithPidPath.getParent();
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   227
        if (parent != null) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   228
            String coreWithoutPid = parent.resolve("core").toString();
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   229
            if (new File(coreWithoutPid).exists()) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   230
                return coreWithoutPid;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   231
            }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   232
        }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   233
        return null;
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   234
    }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   235
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   236
    private static String[] getTestJavaCommandlineWithPrefix(String prefix, String... args) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   237
        try {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   238
            String cmd = ProcessTools.getCommandLine(ProcessTools.createJavaProcessBuilder(true, args));
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   239
            return new String[]{"sh", "-c", prefix + cmd};
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   240
        } catch (Throwable t) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   241
            throw new Error("Can't create process builder: " + t, t);
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   242
        }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   243
    }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   244
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   245
    private static void cleanup() {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   246
        remove(TEST_CDS_CORE_FILE_NAME);
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   247
        remove(SHARED_ARCHIVE_NAME);
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   248
    }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   249
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   250
    private static void remove(String item) {
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   251
        File toDelete = new File(item);
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   252
        toDelete.delete();
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   253
    }
ec2dd30adbc1 8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff changeset
   254
}