Mercurial > hg > truffle
annotate test/compiler/testlibrary/intrinsics/Verifier.java @ 21007:f84166ee0798
removed application of NodeIntrinsificationPhase in ReplacementsImpl since node intrinsification is always done during graph parsing now
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 17 Apr 2015 17:13:09 +0200 |
parents | 17d3ee6e9d3c |
children |
rev | line source |
---|---|
20426
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
1 /* |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
4 * |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
8 * |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
13 * accompanied this code). |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
14 * |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
18 * |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
21 * questions. |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
22 */ |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
23 package intrinsics; |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
24 |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
25 import java.io.BufferedReader; |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
26 import java.io.FileReader; |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
27 import java.util.Properties; |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
28 |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
29 public class Verifier { |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
30 enum VerificationStrategy { |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
31 VERIFY_STRONG_EQUALITY { |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
32 @Override |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
33 void verify(Properties expectedProperties, int fullMatchCnt, |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
34 int suspectCnt) { |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
35 int expectedCount = Integer.parseInt( |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
36 expectedProperties.getProperty( |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
37 Verifier.INTRINSIC_EXPECTED_COUNT_PROPERTY)); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
38 String intrinsicID = expectedProperties.getProperty( |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
39 Verifier.INTRINSIC_NAME_PROPERTY); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
40 |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
41 System.out.println("Intrinsic " + intrinsicID |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
42 + " verification, expected: " + expectedCount |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
43 + ", matched: " + fullMatchCnt |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
44 + ", suspected: " + suspectCnt); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
45 if (expectedCount != fullMatchCnt) { |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
46 throw new RuntimeException( |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
47 "Unexpected count of intrinsic " |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
48 + intrinsicID |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
49 + " expected:" + expectedCount |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
50 + ", matched: " + fullMatchCnt |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
51 + ", suspected: " + suspectCnt); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
52 } |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
53 } |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
54 }, |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
55 |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
56 VERIFY_INTRINSIC_USAGE { |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
57 @Override |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
58 void verify(Properties expectedProperties, int fullMatchCnt, |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
59 int suspectCnt) { |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
60 boolean isExpected = Boolean.parseBoolean( |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
61 expectedProperties.getProperty( |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
62 Verifier.INTRINSIC_IS_EXPECTED_PROPERTY)); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
63 String intrinsicID = expectedProperties.getProperty( |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
64 Verifier.INTRINSIC_NAME_PROPERTY); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
65 |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
66 System.out.println("Intrinsic " + intrinsicID |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
67 + " verification, is expected: " + isExpected |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
68 + ", matched: " + fullMatchCnt |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
69 + ", suspected: " + suspectCnt); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
70 if ((fullMatchCnt == 0 && isExpected) |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
71 || (fullMatchCnt > 0 && !isExpected)) { |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
72 throw new RuntimeException( |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
73 "Unexpected count of intrinsic " |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
74 + intrinsicID |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
75 + " is expected:" + isExpected |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
76 + ", matched: " + fullMatchCnt |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
77 + ", suspected: " + suspectCnt); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
78 } |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
79 } |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
80 }; |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
81 |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
82 void verify(Properties expectedProperties, int fullMathCnt, |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
83 int suspectCnt) { |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
84 throw new RuntimeException("Default strategy is not implemented."); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
85 } |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
86 } |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
87 |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
88 public static final String PROPERTY_FILE_SUFFIX = ".verify.properties"; |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
89 public static final String INTRINSIC_NAME_PROPERTY = "intrinsic.name"; |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
90 public static final String INTRINSIC_IS_EXPECTED_PROPERTY |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
91 = "intrinsic.expected"; |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
92 public static final String INTRINSIC_EXPECTED_COUNT_PROPERTY |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
93 = "intrinsic.expectedCount"; |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
94 private static final String DEFAULT_STRATEGY |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
95 = VerificationStrategy.VERIFY_STRONG_EQUALITY.name(); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
96 |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
97 public static void main(String[] args) throws Exception { |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
98 if (args.length == 0) { |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
99 throw new RuntimeException("Test bug, nothing to verify"); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
100 } |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
101 for (String hsLogFile : args) { |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
102 verify(hsLogFile); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
103 } |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
104 } |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
105 |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
106 private static void verify(String hsLogFile) throws Exception { |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
107 System.out.println("Verifying " + hsLogFile); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
108 |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
109 Properties expectedProperties = new Properties(); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
110 FileReader reader = new FileReader(hsLogFile |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
111 + Verifier.PROPERTY_FILE_SUFFIX); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
112 expectedProperties.load(reader); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
113 reader.close(); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
114 |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
115 int fullMatchCnt = 0; |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
116 int suspectCnt = 0; |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
117 String intrinsicId = expectedProperties.getProperty( |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
118 Verifier.INTRINSIC_NAME_PROPERTY); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
119 String prefix = "<intrinsic id='"; |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
120 String prefixWithId = prefix + intrinsicId + "'"; |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
121 |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
122 try (BufferedReader compLogReader |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
123 = new BufferedReader(new FileReader(hsLogFile))) { |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
124 String logLine; |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
125 while ((logLine = compLogReader.readLine()) != null) { |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
126 if (logLine.startsWith(prefix)) { |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
127 if (logLine.startsWith(prefixWithId)) { |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
128 fullMatchCnt++; |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
129 } else { |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
130 suspectCnt++; |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
131 System.err.println( |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
132 "WARNING: Other intrinsic detected " + logLine); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
133 } |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
134 } |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
135 } |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
136 } |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
137 |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
138 VerificationStrategy strategy = VerificationStrategy.valueOf( |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
139 System.getProperty("verificationStrategy", |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
140 Verifier.DEFAULT_STRATEGY)); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
141 strategy.verify(expectedProperties, fullMatchCnt, suspectCnt); |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
142 } |
17d3ee6e9d3c
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff
changeset
|
143 } |