hotspot/test/testlibrary_tests/OutputAnalyzerTest.java
author ctornqvi
Fri, 19 Aug 2016 10:06:30 -0400
changeset 40631 ed82623d7831
parent 36851 03e2f4d0a421
permissions -rw-r--r--
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder Reviewed-by: coleenp, gtriantafill, mseledtsov, iignatyev, dholmes, dsamersoff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15441
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
     1
/*
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 36851
diff changeset
     2
 * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
15441
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
     4
 *
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
     7
 * published by the Free Software Foundation.
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
     8
 *
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    13
 * accompanied this code).
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    14
 *
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    18
 *
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    21
 * questions.
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    22
 */
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    23
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    24
/*
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    25
 * @test
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    26
 * @summary Test the OutputAnalyzer utility class
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 36851
diff changeset
    27
 * @library /test/lib
36851
03e2f4d0a421 8153737: Unsupported Module
chegar
parents: 30604
diff changeset
    28
 * @modules java.base/jdk.internal.misc
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 20280
diff changeset
    29
 *          java.management
15441
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    30
 */
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    31
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 36851
diff changeset
    32
import jdk.test.lib.process.OutputAnalyzer;
15441
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    33
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    34
public class OutputAnalyzerTest {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    35
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    36
  public static void main(String args[]) throws Exception {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    37
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    38
    String stdout = "aaaaaa";
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    39
    String stderr = "bbbbbb";
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    40
16666
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
    41
    // Regexps used for testing pattern matching of the test input
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
    42
    String stdoutPattern = "[a]";
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
    43
    String stderrPattern = "[b]";
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
    44
    String nonExistingPattern = "[c]";
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
    45
15441
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    46
    OutputAnalyzer output = new OutputAnalyzer(stdout, stderr);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    47
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    48
    if (!stdout.equals(output.getStdout())) {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    49
      throw new Exception("getStdout() returned '" + output.getStdout() + "', expected '" + stdout + "'");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    50
    }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    51
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    52
    if (!stderr.equals(output.getStderr())) {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    53
      throw new Exception("getStderr() returned '" + output.getStderr() + "', expected '" + stderr + "'");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    54
    }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    55
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    56
    try {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    57
      output.shouldContain(stdout);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    58
      output.stdoutShouldContain(stdout);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    59
      output.shouldContain(stderr);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    60
      output.stderrShouldContain(stderr);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    61
    } catch (RuntimeException e) {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    62
      throw new Exception("shouldContain() failed", e);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    63
    }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    64
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    65
    try {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    66
      output.shouldContain("cccc");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    67
      throw new Exception("shouldContain() failed to throw exception");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    68
    } catch (RuntimeException e) {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    69
      // expected
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    70
    }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    71
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    72
    try {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    73
      output.stdoutShouldContain(stderr);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    74
      throw new Exception("stdoutShouldContain() failed to throw exception");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    75
    } catch (RuntimeException e) {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    76
      // expected
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    77
    }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    78
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    79
    try {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    80
      output.stderrShouldContain(stdout);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    81
      throw new Exception("stdoutShouldContain() failed to throw exception");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    82
    } catch (RuntimeException e) {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    83
      // expected
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    84
    }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    85
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    86
    try {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    87
      output.shouldNotContain("cccc");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    88
      output.stdoutShouldNotContain("cccc");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    89
      output.stderrShouldNotContain("cccc");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    90
    } catch (RuntimeException e) {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    91
      throw new Exception("shouldNotContain() failed", e);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    92
    }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    93
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    94
    try {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    95
      output.shouldNotContain(stdout);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    96
      throw new Exception("shouldContain() failed to throw exception");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    97
    } catch (RuntimeException e) {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    98
      // expected
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    99
    }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   100
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   101
    try {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   102
      output.stdoutShouldNotContain(stdout);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   103
      throw new Exception("shouldContain() failed to throw exception");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   104
    } catch (RuntimeException e) {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   105
      // expected
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   106
    }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   107
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   108
    try {
16666
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   109
        output.stderrShouldNotContain(stderr);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   110
        throw new Exception("shouldContain() failed to throw exception");
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   111
    } catch (RuntimeException e) {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   112
        // expected
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   113
    }
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   114
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   115
    // Should match
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   116
    try {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   117
        output.shouldMatch(stdoutPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   118
        output.stdoutShouldMatch(stdoutPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   119
        output.shouldMatch(stderrPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   120
        output.stderrShouldMatch(stderrPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   121
    } catch (RuntimeException e) {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   122
        throw new Exception("shouldMatch() failed", e);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   123
    }
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   124
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   125
    try {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   126
        output.shouldMatch(nonExistingPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   127
        throw new Exception("shouldMatch() failed to throw exception");
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   128
    } catch (RuntimeException e) {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   129
        // expected
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   130
    }
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   131
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   132
    try {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   133
        output.stdoutShouldMatch(stderrPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   134
        throw new Exception(
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   135
                "stdoutShouldMatch() failed to throw exception");
15441
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   136
    } catch (RuntimeException e) {
16666
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   137
        // expected
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   138
    }
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   139
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   140
    try {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   141
        output.stderrShouldMatch(stdoutPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   142
        throw new Exception(
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   143
                "stderrShouldMatch() failed to throw exception");
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   144
    } catch (RuntimeException e) {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   145
        // expected
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   146
    }
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   147
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   148
    // Should not match
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   149
    try {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   150
        output.shouldNotMatch(nonExistingPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   151
        output.stdoutShouldNotMatch(nonExistingPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   152
        output.stderrShouldNotMatch(nonExistingPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   153
    } catch (RuntimeException e) {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   154
        throw new Exception("shouldNotMatch() failed", e);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   155
    }
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   156
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   157
    try {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   158
        output.shouldNotMatch(stdoutPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   159
        throw new Exception("shouldNotMatch() failed to throw exception");
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   160
    } catch (RuntimeException e) {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   161
        // expected
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   162
    }
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   163
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   164
    try {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   165
        output.stdoutShouldNotMatch(stdoutPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   166
        throw new Exception("shouldNotMatch() failed to throw exception");
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   167
    } catch (RuntimeException e) {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   168
        // expected
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   169
    }
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   170
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   171
    try {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   172
        output.stderrShouldNotMatch(stderrPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   173
        throw new Exception("shouldNotMatch() failed to throw exception");
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   174
    } catch (RuntimeException e) {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   175
        // expected
15441
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   176
    }
19991
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   177
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   178
    {
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   179
      String aaaa = "aaaa";
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   180
      String result = output.firstMatch(aaaa);
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   181
      if (!aaaa.equals(result)) {
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   182
        throw new Exception("firstMatch(String) faild to match. Expected: " + aaaa + " got: " + result);
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   183
      }
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   184
    }
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   185
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   186
    {
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   187
      String aa = "aa";
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   188
      String aa_grouped_aa = aa + "(" + aa + ")";
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   189
      String result = output.firstMatch(aa_grouped_aa, 1);
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   190
      if (!aa.equals(result)) {
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   191
        throw new Exception("firstMatch(String, int) failed to match. Expected: " + aa + " got: " + result);
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   192
      }
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   193
    }
15441
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   194
  }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   195
}