hotspot/test/serviceability/dcmd/compiler/CodeCacheTest.java
author neliasso
Tue, 30 Sep 2014 10:22:58 +0200
changeset 26941 96aa76b27b9c
parent 26919 hotspot/test/serviceability/dcmd/CodeCacheTest.java@361b4b4c92c0
child 28821 f7820f311663
permissions -rw-r--r--
8058891: serviceability/dcmd/CodelistTest.java - fails on all platforms Summary: Fix can not reflect MethodHandles Reviewed-by: kvn, drchase
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26587
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
     1
/*
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
     4
 *
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
     7
 * published by the Free Software Foundation.
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
     8
 *
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    13
 * accompanied this code).
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    14
 *
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    18
 *
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    21
 * questions.
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    22
 */
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    23
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    24
/*
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    25
 * @test CodeCacheTest
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    26
 * @bug 8054889
26941
96aa76b27b9c 8058891: serviceability/dcmd/CodelistTest.java - fails on all platforms
neliasso
parents: 26919
diff changeset
    27
 * @library ..
26587
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    28
 * @build DcmdUtil CodeCacheTest
26810
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    29
 * @run main/othervm -XX:+SegmentedCodeCache CodeCacheTest
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    30
 * @run main/othervm -XX:-SegmentedCodeCache CodeCacheTest
26941
96aa76b27b9c 8058891: serviceability/dcmd/CodelistTest.java - fails on all platforms
neliasso
parents: 26919
diff changeset
    31
 * @run main/othervm -Xint -XX:+SegmentedCodeCache CodeCacheTest
26587
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    32
 * @summary Test of diagnostic command Compiler.codecache
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    33
 */
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    34
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    35
import java.io.BufferedReader;
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    36
import java.io.StringReader;
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    37
import java.lang.reflect.Method;
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    38
import java.util.regex.Matcher;
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    39
import java.util.regex.Pattern;
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    40
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    41
public class CodeCacheTest {
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    42
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    43
    /**
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    44
     * This test calls Jcmd (diagnostic command tool) Compiler.codecache and then parses the output,
26810
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    45
     * making sure that all numbers look ok
26587
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    46
     *
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    47
     *
26810
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    48
     * Expected output without code cache segmentation:
26587
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    49
     *
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    50
     * CodeCache: size=245760Kb used=4680Kb max_used=4680Kb free=241079Kb
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    51
     * bounds [0x00007f5bd9000000, 0x00007f5bd94a0000, 0x00007f5be8000000]
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    52
     * total_blobs=575 nmethods=69 adapters=423
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    53
     * compilation: enabled
26810
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    54
     *
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    55
     * Expected output with code cache segmentation (number of segments may change):
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    56
     *
26919
361b4b4c92c0 8059468: Fix PrintCodeCache output changed by JDK-8059137
thartmann
parents: 26810
diff changeset
    57
     * CodeHeap 'non-nmethods': size=5696Kb used=2236Kb max_used=2238Kb free=3459Kb
26810
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    58
     *  bounds [0x00007fa0f0ffe000, 0x00007fa0f126e000, 0x00007fa0f158e000]
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    59
     * CodeHeap 'profiled nmethods': size=120036Kb used=8Kb max_used=8Kb free=120027Kb
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    60
     *  bounds [0x00007fa0f158e000, 0x00007fa0f17fe000, 0x00007fa0f8ac7000]
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    61
     * CodeHeap 'non-profiled nmethods': size=120036Kb used=2Kb max_used=2Kb free=120034Kb
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    62
     *  bounds [0x00007fa0f8ac7000, 0x00007fa0f8d37000, 0x00007fa100000000]
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    63
     * total_blobs=486 nmethods=8 adapters=399
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    64
     * compilation: enabled
26587
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    65
     */
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    66
26810
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    67
    static Pattern line1 = Pattern.compile("(CodeCache|CodeHeap.*): size=(\\p{Digit}*)Kb used=(\\p{Digit}*)Kb max_used=(\\p{Digit}*)Kb free=(\\p{Digit}*)Kb");
26587
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    68
    static Pattern line2 = Pattern.compile(" bounds \\[0x(\\p{XDigit}*), 0x(\\p{XDigit}*), 0x(\\p{XDigit}*)\\]");
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    69
    static Pattern line3 = Pattern.compile(" total_blobs=(\\p{Digit}*) nmethods=(\\p{Digit}*) adapters=(\\p{Digit}*)");
26810
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    70
    static Pattern line4 = Pattern.compile(" compilation: (.*)");
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    71
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    72
    private static boolean getFlagBool(String flag, String where) {
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    73
      Matcher m = Pattern.compile(flag + "\\s+:?= (true|false)").matcher(where);
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    74
      if (!m.find()) {
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    75
        throw new RuntimeException("Could not find value for flag " + flag + " in output string");
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    76
      }
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    77
      return m.group(1).equals("true");
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    78
    }
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    79
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    80
    private static int getFlagInt(String flag, String where) {
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    81
      Matcher m = Pattern.compile(flag + "\\s+:?=\\s+\\d+").matcher(where);
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    82
      if (!m.find()) {
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    83
        throw new RuntimeException("Could not find value for flag " + flag + " in output string");
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    84
      }
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    85
      String match = m.group();
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    86
      return Integer.parseInt(match.substring(match.lastIndexOf(" ") + 1, match.length()));
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    87
    }
26587
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    88
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
    89
    public static void main(String arg[]) throws Exception {
26810
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    90
        // Get number of code cache segments
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    91
        int segmentsCount = 0;
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    92
        String flags = DcmdUtil.executeDcmd("VM.flags", "-all");
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    93
        if (!getFlagBool("SegmentedCodeCache", flags) || !getFlagBool("UseCompiler", flags)) {
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    94
          // No segmentation
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    95
          segmentsCount = 1;
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    96
        } else if (getFlagBool("TieredCompilation", flags) && getFlagInt("TieredStopAtLevel", flags) > 1) {
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    97
          // Tiered compilation: use all segments
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    98
          segmentsCount = 3;
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
    99
        } else {
26919
361b4b4c92c0 8059468: Fix PrintCodeCache output changed by JDK-8059137
thartmann
parents: 26810
diff changeset
   100
          // No TieredCompilation: only non-nmethod and non-profiled segment
26810
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   101
          segmentsCount = 2;
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   102
        }
26587
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   103
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   104
        // Get output from dcmd (diagnostic command)
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   105
        String result = DcmdUtil.executeDcmd("Compiler.codecache");
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   106
        BufferedReader r = new BufferedReader(new StringReader(result));
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   107
26810
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   108
        // Validate code cache segments
26587
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   109
        String line;
26810
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   110
        Matcher m;
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   111
        for (int s = 0; s < segmentsCount; ++s) {
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   112
          // Validate first line
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   113
          line = r.readLine();
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   114
          m = line1.matcher(line);
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   115
          if (m.matches()) {
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   116
              for (int i = 2; i <= 5; i++) {
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   117
                  int val = Integer.parseInt(m.group(i));
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   118
                  if (val < 0) {
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   119
                      throw new Exception("Failed parsing dcmd codecache output");
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   120
                  }
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   121
              }
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   122
          } else {
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   123
              throw new Exception("Regexp 1 failed");
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   124
          }
26587
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   125
26810
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   126
          // Validate second line
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   127
          line = r.readLine();
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   128
          m = line2.matcher(line);
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   129
          if (m.matches()) {
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   130
              String start = m.group(1);
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   131
              String mark  = m.group(2);
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   132
              String top   = m.group(3);
26806
4e6fbf9f59f4 8058479: serviceability/dcmd/CodeCacheTest.java fails
neliasso
parents: 26587
diff changeset
   133
26810
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   134
              // Lexical compare of hex numbers to check that they look sane.
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   135
              if (start.compareTo(mark) > 1) {
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   136
                  throw new Exception("Failed parsing dcmd codecache output");
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   137
              }
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   138
              if (mark.compareTo(top) > 1) {
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   139
                  throw new Exception("Failed parsing dcmd codecache output");
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   140
              }
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   141
          } else {
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   142
              throw new Exception("Regexp 2 failed line: " + line);
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   143
          }
26587
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   144
        }
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   145
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   146
        // Validate third line
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   147
        line = r.readLine();
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   148
        m = line3.matcher(line);
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   149
        if (m.matches()) {
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   150
            int blobs = Integer.parseInt(m.group(1));
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   151
            if (blobs <= 0) {
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   152
                throw new Exception("Failed parsing dcmd codecache output");
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   153
            }
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   154
            int nmethods = Integer.parseInt(m.group(2));
26810
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   155
            if (nmethods < 0) {
26587
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   156
                throw new Exception("Failed parsing dcmd codecache output");
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   157
            }
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   158
            int adapters = Integer.parseInt(m.group(3));
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   159
            if (adapters <= 0) {
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   160
                throw new Exception("Failed parsing dcmd codecache output");
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   161
            }
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   162
            if (blobs < (nmethods + adapters)) {
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   163
                throw new Exception("Failed parsing dcmd codecache output");
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   164
            }
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   165
        } else {
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   166
            throw new Exception("Regexp 3 failed");
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   167
        }
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   168
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   169
        // Validate fourth line
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   170
        line = r.readLine();
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   171
        m = line4.matcher(line);
26810
ad491ed6cda8 8058712: [TESTBUG] serviceability/dcmd/CodeCacheTest.java fails with java.lang.Exception
thartmann
parents: 26806
diff changeset
   172
        if (!m.matches()) {
26587
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   173
            throw new Exception("Regexp 4 failed");
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   174
        }
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   175
    }
e8b28fa936af 8054889: Compiler team's implementation task
neliasso
parents:
diff changeset
   176
}