hotspot/test/testlibrary_tests/OutputAnalyzerTest.java
author ctornqvi
Wed, 25 Sep 2013 17:47:22 +0200
changeset 20280 0305ea27e15b
parent 19991 hotspot/test/testlibrary/OutputAnalyzerTest.java@d0d0186a8cd6
child 29678 dd2f3932c21e
permissions -rw-r--r--
8024677: [TESTBUG] Move tests for classes in /testlibrary Summary: Moved the tests to /testlibrary_tests and updated TEST.groups Reviewed-by: dholmes, sla
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
/*
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
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
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    27
 * @library /testlibrary
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    28
 */
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    29
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    30
import com.oracle.java.testlibrary.OutputAnalyzer;
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    31
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    32
public class OutputAnalyzerTest {
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 static void main(String args[]) throws Exception {
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
    String stdout = "aaaaaa";
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    37
    String stderr = "bbbbbb";
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    38
16666
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
    39
    // Regexps used for testing pattern matching of the test input
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
    40
    String stdoutPattern = "[a]";
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
    41
    String stderrPattern = "[b]";
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
    42
    String nonExistingPattern = "[c]";
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
    43
15441
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    44
    OutputAnalyzer output = new OutputAnalyzer(stdout, stderr);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    45
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    46
    if (!stdout.equals(output.getStdout())) {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    47
      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
    48
    }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    49
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    50
    if (!stderr.equals(output.getStderr())) {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    51
      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
    52
    }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    53
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    54
    try {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    55
      output.shouldContain(stdout);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    56
      output.stdoutShouldContain(stdout);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    57
      output.shouldContain(stderr);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    58
      output.stderrShouldContain(stderr);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    59
    } catch (RuntimeException e) {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    60
      throw new Exception("shouldContain() failed", e);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    61
    }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    62
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    63
    try {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    64
      output.shouldContain("cccc");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    65
      throw new Exception("shouldContain() failed to throw exception");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    66
    } catch (RuntimeException e) {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    67
      // expected
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    68
    }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    69
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    70
    try {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    71
      output.stdoutShouldContain(stderr);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    72
      throw new Exception("stdoutShouldContain() failed to throw exception");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    73
    } catch (RuntimeException e) {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    74
      // expected
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    75
    }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    76
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    77
    try {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    78
      output.stderrShouldContain(stdout);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    79
      throw new Exception("stdoutShouldContain() failed to throw exception");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    80
    } catch (RuntimeException e) {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    81
      // expected
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    82
    }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    83
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    84
    try {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    85
      output.shouldNotContain("cccc");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    86
      output.stdoutShouldNotContain("cccc");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    87
      output.stderrShouldNotContain("cccc");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    88
    } catch (RuntimeException e) {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    89
      throw new Exception("shouldNotContain() failed", e);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    90
    }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    91
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    92
    try {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    93
      output.shouldNotContain(stdout);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    94
      throw new Exception("shouldContain() failed to throw exception");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    95
    } catch (RuntimeException e) {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    96
      // expected
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    97
    }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    98
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
    99
    try {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   100
      output.stdoutShouldNotContain(stdout);
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   101
      throw new Exception("shouldContain() failed to throw exception");
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   102
    } catch (RuntimeException e) {
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   103
      // expected
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   104
    }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   105
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   106
    try {
16666
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   107
        output.stderrShouldNotContain(stderr);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   108
        throw new Exception("shouldContain() failed to throw exception");
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   109
    } catch (RuntimeException e) {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   110
        // expected
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   111
    }
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   112
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   113
    // Should match
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   114
    try {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   115
        output.shouldMatch(stdoutPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   116
        output.stdoutShouldMatch(stdoutPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   117
        output.shouldMatch(stderrPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   118
        output.stderrShouldMatch(stderrPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   119
    } catch (RuntimeException e) {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   120
        throw new Exception("shouldMatch() failed", e);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   121
    }
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   122
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   123
    try {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   124
        output.shouldMatch(nonExistingPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   125
        throw new Exception("shouldMatch() failed to throw exception");
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   126
    } catch (RuntimeException e) {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   127
        // expected
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   128
    }
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   129
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   130
    try {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   131
        output.stdoutShouldMatch(stderrPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   132
        throw new Exception(
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   133
                "stdoutShouldMatch() failed to throw exception");
15441
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   134
    } catch (RuntimeException e) {
16666
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   135
        // expected
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   136
    }
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   137
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   138
    try {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   139
        output.stderrShouldMatch(stdoutPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   140
        throw new Exception(
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   141
                "stderrShouldMatch() failed to throw exception");
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   142
    } catch (RuntimeException e) {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   143
        // expected
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   144
    }
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   145
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   146
    // Should not match
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   147
    try {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   148
        output.shouldNotMatch(nonExistingPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   149
        output.stdoutShouldNotMatch(nonExistingPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   150
        output.stderrShouldNotMatch(nonExistingPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   151
    } catch (RuntimeException e) {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   152
        throw new Exception("shouldNotMatch() failed", e);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   153
    }
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   154
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   155
    try {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   156
        output.shouldNotMatch(stdoutPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   157
        throw new Exception("shouldNotMatch() failed to throw exception");
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   158
    } catch (RuntimeException e) {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   159
        // expected
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   160
    }
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   161
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   162
    try {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   163
        output.stdoutShouldNotMatch(stdoutPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   164
        throw new Exception("shouldNotMatch() failed to throw exception");
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   165
    } catch (RuntimeException e) {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   166
        // expected
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   167
    }
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   168
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   169
    try {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   170
        output.stderrShouldNotMatch(stderrPattern);
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   171
        throw new Exception("shouldNotMatch() failed to throw exception");
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   172
    } catch (RuntimeException e) {
da191c7e38d2 8009125: Add NMT tests for Virtual Memory operations
ctornqvi
parents: 15441
diff changeset
   173
        // expected
15441
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   174
    }
19991
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   175
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   176
    {
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   177
      String aaaa = "aaaa";
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   178
      String result = output.firstMatch(aaaa);
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   179
      if (!aaaa.equals(result)) {
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   180
        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
   181
      }
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   182
    }
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
      String aa = "aa";
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   186
      String aa_grouped_aa = aa + "(" + aa + ")";
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   187
      String result = output.firstMatch(aa_grouped_aa, 1);
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   188
      if (!aa.equals(result)) {
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   189
        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
   190
      }
d0d0186a8cd6 8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
stefank
parents: 16666
diff changeset
   191
    }
15441
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   192
  }
b96e139eb20c 8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff changeset
   193
}