author | sangheki |
Mon, 08 Apr 2019 12:15:40 -0700 | |
changeset 54467 | 0c5d713cf43f |
parent 51675 | b487c1e914d0 |
permissions | -rw-r--r-- |
15645
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
1 |
/* |
51675 | 2 |
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. |
15645
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
4 |
* |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
8 |
* |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
13 |
* accompanied this code). |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
14 |
* |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
18 |
* |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
21 |
* questions. |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
22 |
*/ |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
23 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
24 |
/* |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
25 |
* @test |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
26 |
* @summary Test the OutputAnalyzer utility class |
30820 | 27 |
* @modules java.management |
51675 | 28 |
* @library /test/lib |
29 |
* @run main OutputAnalyzerTest |
|
15645
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
30 |
*/ |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
31 |
|
51675 | 32 |
import jdk.test.lib.process.OutputAnalyzer; |
33 |
||
15645
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
34 |
public class OutputAnalyzerTest { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
35 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
36 |
public static void main(String args[]) throws Exception { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
37 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
38 |
String stdout = "aaaaaa"; |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
39 |
String stderr = "bbbbbb"; |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
40 |
String nonExistingString = "cccc"; |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
41 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
42 |
OutputAnalyzer output = new OutputAnalyzer(stdout, stderr); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
43 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
44 |
if (!stdout.equals(output.getStdout())) { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
45 |
throw new Exception("getStdout() returned '" + output.getStdout() |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
46 |
+ "', expected '" + stdout + "'"); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
47 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
48 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
49 |
if (!stderr.equals(output.getStderr())) { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
50 |
throw new Exception("getStderr() returned '" + output.getStderr() |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
51 |
+ "', expected '" + stderr + "'"); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
52 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
53 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
54 |
try { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
55 |
output.shouldContain(stdout); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
56 |
output.stdoutShouldContain(stdout); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
57 |
output.shouldContain(stderr); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
58 |
output.stderrShouldContain(stderr); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
59 |
} catch (RuntimeException e) { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
60 |
throw new Exception("shouldContain() failed", e); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
61 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
62 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
63 |
try { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
64 |
output.shouldContain(nonExistingString); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
65 |
throw new Exception("shouldContain() failed to throw exception"); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
66 |
} catch (RuntimeException e) { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
67 |
// expected |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
68 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
69 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
70 |
try { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
71 |
output.stdoutShouldContain(stderr); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
72 |
throw new Exception( |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
73 |
"stdoutShouldContain() failed to throw exception"); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
74 |
} catch (RuntimeException e) { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
75 |
// expected |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
76 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
77 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
78 |
try { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
79 |
output.stderrShouldContain(stdout); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
80 |
throw new Exception( |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
81 |
"stdoutShouldContain() failed to throw exception"); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
82 |
} catch (RuntimeException e) { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
83 |
// expected |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
84 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
85 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
86 |
try { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
87 |
output.shouldNotContain(nonExistingString); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
88 |
output.stdoutShouldNotContain(nonExistingString); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
89 |
output.stderrShouldNotContain(nonExistingString); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
90 |
} catch (RuntimeException e) { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
91 |
throw new Exception("shouldNotContain() failed", e); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
92 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
93 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
94 |
try { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
95 |
output.shouldNotContain(stdout); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
96 |
throw new Exception("shouldContain() failed to throw exception"); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
97 |
} catch (RuntimeException e) { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
98 |
// expected |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
99 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
100 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
101 |
try { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
102 |
output.stdoutShouldNotContain(stdout); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
103 |
throw new Exception("shouldContain() failed to throw exception"); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
104 |
} catch (RuntimeException e) { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
105 |
// expected |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
106 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
107 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
108 |
try { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
109 |
output.stderrShouldNotContain(stderr); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
110 |
throw new Exception("shouldContain() failed to throw exception"); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
111 |
} catch (RuntimeException e) { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
112 |
// expected |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
113 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
114 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
115 |
String stdoutPattern = "[a]"; |
28098
fbc3debb3d50
8066106: sun/tools/jps/TestJpsClass.java failed to remove stale attach pid file
ykantser
parents:
27189
diff
changeset
|
116 |
String stdoutByLinePattern = "a*"; |
15645
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
117 |
String stderrPattern = "[b]"; |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
118 |
String nonExistingPattern = "[c]"; |
28098
fbc3debb3d50
8066106: sun/tools/jps/TestJpsClass.java failed to remove stale attach pid file
ykantser
parents:
27189
diff
changeset
|
119 |
String byLinePattern = "[ab]*"; |
15645
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
120 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
121 |
// Should match |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
122 |
try { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
123 |
output.shouldMatch(stdoutPattern); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
124 |
output.stdoutShouldMatch(stdoutPattern); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
125 |
output.shouldMatch(stderrPattern); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
126 |
output.stderrShouldMatch(stderrPattern); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
127 |
} catch (RuntimeException e) { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
128 |
throw new Exception("shouldMatch() failed", e); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
129 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
130 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
131 |
try { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
132 |
output.shouldMatch(nonExistingPattern); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
133 |
throw new Exception("shouldMatch() failed to throw exception"); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
134 |
} catch (RuntimeException e) { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
135 |
// expected |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
136 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
137 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
138 |
try { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
139 |
output.stdoutShouldMatch(stderrPattern); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
140 |
throw new Exception( |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
141 |
"stdoutShouldMatch() failed to throw exception"); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
142 |
} catch (RuntimeException e) { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
143 |
// expected |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
144 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
145 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
146 |
try { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
147 |
output.stderrShouldMatch(stdoutPattern); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
148 |
throw new Exception( |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
149 |
"stderrShouldMatch() failed to throw exception"); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
150 |
} catch (RuntimeException e) { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
151 |
// expected |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
152 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
153 |
|
51675 | 154 |
try { |
155 |
output.shouldMatchByLine(byLinePattern); |
|
156 |
} catch (RuntimeException e) { |
|
157 |
throw new Exception("shouldMatchByLine() failed", e); |
|
28098
fbc3debb3d50
8066106: sun/tools/jps/TestJpsClass.java failed to remove stale attach pid file
ykantser
parents:
27189
diff
changeset
|
158 |
} |
51675 | 159 |
|
28098
fbc3debb3d50
8066106: sun/tools/jps/TestJpsClass.java failed to remove stale attach pid file
ykantser
parents:
27189
diff
changeset
|
160 |
try { |
fbc3debb3d50
8066106: sun/tools/jps/TestJpsClass.java failed to remove stale attach pid file
ykantser
parents:
27189
diff
changeset
|
161 |
output.shouldMatchByLine(nonExistingPattern); |
fbc3debb3d50
8066106: sun/tools/jps/TestJpsClass.java failed to remove stale attach pid file
ykantser
parents:
27189
diff
changeset
|
162 |
throw new Exception("shouldMatchByLine() failed to throw exception"); |
fbc3debb3d50
8066106: sun/tools/jps/TestJpsClass.java failed to remove stale attach pid file
ykantser
parents:
27189
diff
changeset
|
163 |
} catch (RuntimeException e) { |
fbc3debb3d50
8066106: sun/tools/jps/TestJpsClass.java failed to remove stale attach pid file
ykantser
parents:
27189
diff
changeset
|
164 |
// expected |
fbc3debb3d50
8066106: sun/tools/jps/TestJpsClass.java failed to remove stale attach pid file
ykantser
parents:
27189
diff
changeset
|
165 |
} |
51675 | 166 |
|
167 |
try { |
|
168 |
output.stdoutShouldMatchByLine(stdoutByLinePattern); |
|
169 |
} catch (RuntimeException e) { |
|
170 |
throw new Exception("stdoutShouldMatchByLine() failed", e); |
|
28098
fbc3debb3d50
8066106: sun/tools/jps/TestJpsClass.java failed to remove stale attach pid file
ykantser
parents:
27189
diff
changeset
|
171 |
} |
fbc3debb3d50
8066106: sun/tools/jps/TestJpsClass.java failed to remove stale attach pid file
ykantser
parents:
27189
diff
changeset
|
172 |
|
15645
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
173 |
// Should not match |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
174 |
try { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
175 |
output.shouldNotMatch(nonExistingPattern); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
176 |
output.stdoutShouldNotMatch(nonExistingPattern); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
177 |
output.stderrShouldNotMatch(nonExistingPattern); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
178 |
} catch (RuntimeException e) { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
179 |
throw new Exception("shouldNotMatch() failed", e); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
180 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
181 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
182 |
try { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
183 |
output.shouldNotMatch(stdoutPattern); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
184 |
throw new Exception("shouldNotMatch() failed to throw exception"); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
185 |
} catch (RuntimeException e) { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
186 |
// expected |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
187 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
188 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
189 |
try { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
190 |
output.stdoutShouldNotMatch(stdoutPattern); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
191 |
throw new Exception("shouldNotMatch() failed to throw exception"); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
192 |
} catch (RuntimeException e) { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
193 |
// expected |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
194 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
195 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
196 |
try { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
197 |
output.stderrShouldNotMatch(stderrPattern); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
198 |
throw new Exception("shouldNotMatch() failed to throw exception"); |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
199 |
} catch (RuntimeException e) { |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
200 |
// expected |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
201 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
202 |
} |
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
203 |
|
8d05e519bffb
8007142: Add utility classes for writing better multiprocess tests in jtreg
ykantser
parents:
diff
changeset
|
204 |
} |