Mercurial > hg > graal-compiler
annotate test/testlibrary/OutputAnalyzerTest.java @ 8479:a6ba61be2b5f
made method substitutions for Object be interpretable
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 26 Mar 2013 12:56:27 +0100 |
parents | 9be6cde7919d |
children | 3b890cd4da64 |
rev | line source |
---|---|
7960
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
1 /* |
9be6cde7919d
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. |
9be6cde7919d
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. |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
4 * |
9be6cde7919d
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 |
9be6cde7919d
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 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
8 * |
9be6cde7919d
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 |
9be6cde7919d
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 |
9be6cde7919d
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 |
9be6cde7919d
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 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
13 * accompanied this code). |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
14 * |
9be6cde7919d
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 |
9be6cde7919d
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, |
9be6cde7919d
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. |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
18 * |
9be6cde7919d
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 |
9be6cde7919d
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 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
21 * questions. |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
22 */ |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
23 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
24 /* |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
25 * @test |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
26 * @summary Test the OutputAnalyzer utility class |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
27 * @library /testlibrary |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
28 */ |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
29 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
30 import com.oracle.java.testlibrary.OutputAnalyzer; |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
31 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
32 public class OutputAnalyzerTest { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
33 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
34 public static void main(String args[]) throws Exception { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
35 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
36 String stdout = "aaaaaa"; |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
37 String stderr = "bbbbbb"; |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
38 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
39 OutputAnalyzer output = new OutputAnalyzer(stdout, stderr); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
40 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
41 if (!stdout.equals(output.getStdout())) { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
42 throw new Exception("getStdout() returned '" + output.getStdout() + "', expected '" + stdout + "'"); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
43 } |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
44 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
45 if (!stderr.equals(output.getStderr())) { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
46 throw new Exception("getStderr() returned '" + output.getStderr() + "', expected '" + stderr + "'"); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
47 } |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
48 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
49 try { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
50 output.shouldContain(stdout); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
51 output.stdoutShouldContain(stdout); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
52 output.shouldContain(stderr); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
53 output.stderrShouldContain(stderr); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
54 } catch (RuntimeException e) { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
55 throw new Exception("shouldContain() failed", e); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
56 } |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
57 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
58 try { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
59 output.shouldContain("cccc"); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
60 throw new Exception("shouldContain() failed to throw exception"); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
61 } catch (RuntimeException e) { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
62 // expected |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
63 } |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
64 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
65 try { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
66 output.stdoutShouldContain(stderr); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
67 throw new Exception("stdoutShouldContain() failed to throw exception"); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
68 } catch (RuntimeException e) { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
69 // expected |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
70 } |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
71 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
72 try { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
73 output.stderrShouldContain(stdout); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
74 throw new Exception("stdoutShouldContain() failed to throw exception"); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
75 } catch (RuntimeException e) { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
76 // expected |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
77 } |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
78 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
79 try { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
80 output.shouldNotContain("cccc"); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
81 output.stdoutShouldNotContain("cccc"); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
82 output.stderrShouldNotContain("cccc"); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
83 } catch (RuntimeException e) { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
84 throw new Exception("shouldNotContain() failed", e); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
85 } |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
86 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
87 try { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
88 output.shouldNotContain(stdout); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
89 throw new Exception("shouldContain() failed to throw exception"); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
90 } catch (RuntimeException e) { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
91 // expected |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
92 } |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
93 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
94 try { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
95 output.stdoutShouldNotContain(stdout); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
96 throw new Exception("shouldContain() failed to throw exception"); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
97 } catch (RuntimeException e) { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
98 // expected |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
99 } |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
100 |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
101 try { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
102 output.stderrShouldNotContain(stderr); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
103 throw new Exception("shouldContain() failed to throw exception"); |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
104 } catch (RuntimeException e) { |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
105 // expected |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
106 } |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
107 } |
9be6cde7919d
8006413: Add utility classes for writing better multiprocess tests in jtreg
ctornqvi
parents:
diff
changeset
|
108 } |