Skip to content

Commit d29794f

Browse files
author
SendaoYan
committed
8325277: [21u] Backout test change of JDK-8291809
Reviewed-by: phh
1 parent aa0e9e7 commit d29794f

File tree

4 files changed

+776
-862
lines changed

4 files changed

+776
-862
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright (c) 2016, 2020, 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 compiler.c2.cr7200264;
25+
26+
import java.util.HashMap;
27+
import java.util.List;
28+
import java.util.Map;
29+
30+
import jdk.test.lib.Asserts;
31+
import jdk.test.lib.process.OutputAnalyzer;
32+
import jdk.test.lib.process.ProcessTools;
33+
34+
public class TestDriver {
35+
private final Map<String, Long> expectedVectorizationNumbers
36+
= new HashMap<>();
37+
38+
public void addExpectedVectorization(String v, long num) {
39+
expectedVectorizationNumbers.put(v, num);
40+
}
41+
42+
public void run() throws Throwable {
43+
verifyVectorizationNumber(executeApplication());
44+
}
45+
46+
private List<String> executeApplication() throws Throwable {
47+
OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJava(
48+
"-Xbatch",
49+
"-XX:-TieredCompilation",
50+
"-XX:+PrintCompilation",
51+
"-XX:+TraceNewVectors",
52+
"-XX:+IgnoreUnrecognizedVMOptions",
53+
"-XX:StressLongCountedLoop=0", // make sure int loops do not get converted to long
54+
TestIntVect.class.getName());
55+
outputAnalyzer.shouldHaveExitValue(0);
56+
return outputAnalyzer.asLines();
57+
}
58+
59+
private void verifyVectorizationNumber(List<String> vectorizationLog) {
60+
for (Map.Entry<String, Long> entry : expectedVectorizationNumbers.entrySet()) {
61+
String v = entry.getKey();
62+
long actualNum = vectorizationLog.stream()
63+
.filter(s -> s.contains(v)).count();
64+
long expectedNum = entry.getValue();
65+
Asserts.assertGTE(actualNum, expectedNum,
66+
"Unexpected " + entry.getKey() + " number");
67+
}
68+
}
69+
}

0 commit comments

Comments
 (0)