|
1 /* |
|
2 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. |
|
8 * |
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
|
13 * accompanied this code). |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License version |
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 * |
|
23 */ |
|
24 package com.sun.hotspot.tools.compiler; |
|
25 |
|
26 import java.util.Arrays; |
|
27 import java.util.Collection; |
|
28 import org.junit.Test; |
|
29 import org.junit.BeforeClass; |
|
30 import org.junit.experimental.categories.Category; |
|
31 import junit.framework.Assert; |
|
32 import org.junit.After; |
|
33 import org.junit.Before; |
|
34 import org.junit.Test; |
|
35 import org.junit.runner.RunWith; |
|
36 import org.junit.runners.Parameterized; |
|
37 import org.junit.runners.Parameterized.Parameters; |
|
38 import static org.junit.Assert.*; |
|
39 |
|
40 @RunWith(value = Parameterized.class) |
|
41 public class TestLogCompilation { |
|
42 |
|
43 String logFile; |
|
44 |
|
45 public TestLogCompilation(String logFile) { |
|
46 this.logFile = logFile; |
|
47 } |
|
48 |
|
49 @Parameters |
|
50 public static Collection data() { |
|
51 Object[][] data = new Object[][]{ |
|
52 // Simply running this jar with jdk-9 no args, |
|
53 // no file (just prints the help) |
|
54 {"./src/test/resources/hotspot_pid23756.log"}, |
|
55 // LogCompilation output of running on above file |
|
56 {"./src/test/resources/hotspot_pid25109.log"} |
|
57 |
|
58 }; |
|
59 return Arrays.asList(data); |
|
60 } |
|
61 |
|
62 @Test |
|
63 public void testDashi() throws Exception { |
|
64 String[] args = {"-i", |
|
65 logFile |
|
66 }; |
|
67 |
|
68 LogCompilation.main(args); |
|
69 } |
|
70 |
|
71 @Test |
|
72 public void testDashiDasht() throws Exception { |
|
73 String[] args = {"-i", |
|
74 "-t", |
|
75 logFile |
|
76 }; |
|
77 |
|
78 LogCompilation.main(args); |
|
79 } |
|
80 |
|
81 @Test |
|
82 public void testDefault() throws Exception { |
|
83 String[] args = { |
|
84 logFile |
|
85 }; |
|
86 |
|
87 LogCompilation.main(args); |
|
88 } |
|
89 |
|
90 @Test |
|
91 public void testDashS() throws Exception { |
|
92 String[] args = {"-S", |
|
93 logFile |
|
94 }; |
|
95 |
|
96 LogCompilation.main(args); |
|
97 } |
|
98 |
|
99 @Test |
|
100 public void testDashU() throws Exception { |
|
101 String[] args = {"-U", |
|
102 logFile |
|
103 }; |
|
104 |
|
105 LogCompilation.main(args); |
|
106 } |
|
107 |
|
108 @Test |
|
109 public void testDashe() throws Exception { |
|
110 String[] args = {"-e", |
|
111 logFile |
|
112 }; |
|
113 |
|
114 LogCompilation.main(args); |
|
115 } |
|
116 |
|
117 @Test |
|
118 public void testDashn() throws Exception { |
|
119 String[] args = {"-n", |
|
120 logFile |
|
121 }; |
|
122 |
|
123 LogCompilation.main(args); |
|
124 } |
|
125 } |