Skip to content

Commit aabe830

Browse files
author
Satyen Subramaniam
committed
8314319: LogCompilation doesn't reset lateInlining when it encounters a failure.
Backport-of: e9e0c5699b8d0fbd1bd3a6caa3e0182a2e5bdda3
1 parent c6e19d6 commit aabe830

File tree

3 files changed

+614
-0
lines changed

3 files changed

+614
-0
lines changed

src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,7 @@ public void startElement(String uri, String localName, String qname, Attributes
10821082
site.setReason("succeed: " + search(atts, "reason"));
10831083
} else if (qname.equals("failure")) {
10841084
failureReason = search(atts, "reason");
1085+
lateInlining = false;
10851086
} else if (qname.equals("task_done")) {
10861087
compile.setEnd(Double.parseDouble(search(atts, "stamp")));
10871088
if (Integer.parseInt(search(atts, "success")) == 0) {
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
* Copyright Amazon.com Inc. 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 org.junit.Assert;
27+
import org.junit.Test;
28+
import org.junit.runner.RunWith;
29+
import org.junit.runners.Parameterized;
30+
import org.junit.runners.Parameterized.Parameters;
31+
32+
import java.io.File;
33+
import java.io.FilenameFilter;
34+
import java.util.ArrayList;
35+
import java.util.Collection;
36+
import java.util.List;
37+
38+
@RunWith(value = Parameterized.class)
39+
public class TestPrebuiltLogs {
40+
private String logFile;
41+
static List<String> tests = new ArrayList<String>();
42+
43+
// BeforeClass is invoked after @Parameters, so we use static block to evaluate tests first.
44+
static {
45+
File file = new File("src/test/resources");
46+
File[] testData = file.listFiles(new FilenameFilter() {
47+
@Override
48+
public boolean accept(File dir, String name) {
49+
return name.endsWith(".xml");
50+
}
51+
});
52+
53+
for (File f: testData) {
54+
tests.add(f.toString());
55+
}
56+
}
57+
58+
@Parameters
59+
public static Collection data() {
60+
return tests;
61+
}
62+
63+
public TestPrebuiltLogs(String logFile) {
64+
this.logFile = logFile;
65+
}
66+
67+
void doItOrFail(String[] args) {
68+
try {
69+
LogCompilation.main(args);
70+
} catch (Throwable e) {
71+
e.printStackTrace();
72+
Assert.fail(e.getMessage());
73+
}
74+
}
75+
76+
@Test
77+
public void testDashi() throws Exception {
78+
String[] args = {"-i", logFile};
79+
doItOrFail(args);
80+
}
81+
82+
@Test
83+
public void testNone() throws Exception {
84+
String[] args = {logFile};
85+
doItOrFail(args);
86+
}
87+
}

0 commit comments

Comments
 (0)