hotspot/test/compiler/testlibrary/intrinsics/Verifier.java
author fzhinkin
Wed, 03 Sep 2014 15:24:26 +0400
changeset 26437 b6e75523f59b
child 39438 206a712f8f16
permissions -rw-r--r--
8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality Reviewed-by: kvn, iignatyev
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26437
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
     1
/*
b6e75523f59b 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.
b6e75523f59b 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.
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
     4
 *
b6e75523f59b 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
b6e75523f59b 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
b6e75523f59b 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.
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
     8
 *
b6e75523f59b 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
b6e75523f59b 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
b6e75523f59b 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
b6e75523f59b 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
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    13
 * accompanied this code).
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    14
 *
b6e75523f59b 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
b6e75523f59b 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,
b6e75523f59b 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.
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    18
 *
b6e75523f59b 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
b6e75523f59b 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
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    21
 * questions.
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    22
 */
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    23
package intrinsics;
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    24
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    25
import java.io.BufferedReader;
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    26
import java.io.FileReader;
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    27
import java.util.Properties;
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    28
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    29
public class Verifier {
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    30
    enum VerificationStrategy {
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    31
        VERIFY_STRONG_EQUALITY {
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    32
            @Override
b6e75523f59b 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,
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    34
                        int suspectCnt) {
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    35
                int expectedCount = Integer.parseInt(
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    36
                        expectedProperties.getProperty(
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    37
                                Verifier.INTRINSIC_EXPECTED_COUNT_PROPERTY));
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    38
                String intrinsicID = expectedProperties.getProperty(
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    39
                        Verifier.INTRINSIC_NAME_PROPERTY);
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    40
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    41
                System.out.println("Intrinsic " + intrinsicID
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    42
                        + " verification, expected: " + expectedCount
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    43
                        + ", matched: " + fullMatchCnt
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    44
                        + ", suspected: " + suspectCnt);
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    45
                if (expectedCount != fullMatchCnt) {
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    46
                    throw new RuntimeException(
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    47
                            "Unexpected count of intrinsic  "
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    48
                                    + intrinsicID
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    49
                                    + " expected:" + expectedCount
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    50
                                    + ", matched: " + fullMatchCnt
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    51
                                    + ", suspected: " + suspectCnt);
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    52
                }
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    53
            }
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    54
        },
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    55
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    56
        VERIFY_INTRINSIC_USAGE {
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    57
            @Override
b6e75523f59b 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,
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    59
                        int suspectCnt) {
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    60
                boolean isExpected = Boolean.parseBoolean(
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    61
                        expectedProperties.getProperty(
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    62
                                Verifier.INTRINSIC_IS_EXPECTED_PROPERTY));
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    63
                String intrinsicID = expectedProperties.getProperty(
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    64
                        Verifier.INTRINSIC_NAME_PROPERTY);
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    65
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    66
                System.out.println("Intrinsic " + intrinsicID
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    67
                        + " verification, is expected: " + isExpected
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    68
                        + ", matched: " + fullMatchCnt
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    69
                        + ", suspected: " + suspectCnt);
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    70
                if ((fullMatchCnt == 0 && isExpected)
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    71
                        || (fullMatchCnt > 0 && !isExpected)) {
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    72
                    throw new RuntimeException(
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    73
                            "Unexpected count of intrinsic  "
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    74
                                    + intrinsicID
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    75
                                    + " is expected:" + isExpected
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    76
                                    + ", matched: " + fullMatchCnt
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    77
                                    + ", suspected: " + suspectCnt);
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    78
                }
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    79
            }
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    80
        };
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    81
b6e75523f59b 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,
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    83
                    int suspectCnt) {
b6e75523f59b 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.");
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    85
        }
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    86
    }
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    87
b6e75523f59b 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";
b6e75523f59b 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";
b6e75523f59b 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
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    91
            = "intrinsic.expected";
b6e75523f59b 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
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    93
            = "intrinsic.expectedCount";
b6e75523f59b 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
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    95
            = VerificationStrategy.VERIFY_STRONG_EQUALITY.name();
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    96
b6e75523f59b 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 {
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
    98
        if (args.length == 0) {
b6e75523f59b 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");
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   100
        }
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   101
        for (String hsLogFile : args) {
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   102
            verify(hsLogFile);
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   103
        }
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   104
    }
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   105
b6e75523f59b 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 {
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   107
        System.out.println("Verifying " + hsLogFile);
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   108
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   109
        Properties expectedProperties = new Properties();
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   110
        FileReader reader = new FileReader(hsLogFile
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   111
                + Verifier.PROPERTY_FILE_SUFFIX);
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   112
        expectedProperties.load(reader);
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   113
        reader.close();
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   114
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   115
        int fullMatchCnt = 0;
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   116
        int suspectCnt = 0;
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   117
        String intrinsicId = expectedProperties.getProperty(
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   118
                Verifier.INTRINSIC_NAME_PROPERTY);
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   119
        String prefix = "<intrinsic id='";
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   120
        String prefixWithId = prefix + intrinsicId + "'";
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   121
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   122
        try (BufferedReader compLogReader
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   123
                     = new BufferedReader(new FileReader(hsLogFile))) {
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   124
            String logLine;
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   125
            while ((logLine = compLogReader.readLine()) != null) {
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   126
                if (logLine.startsWith(prefix)) {
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   127
                    if (logLine.startsWith(prefixWithId)) {
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   128
                        fullMatchCnt++;
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   129
                    } else {
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   130
                        suspectCnt++;
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   131
                        System.err.println(
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   132
                                "WARNING: Other intrinsic detected " + logLine);
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   133
                    }
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   134
                }
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   135
            }
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   136
        }
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   137
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   138
        VerificationStrategy strategy = VerificationStrategy.valueOf(
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   139
                System.getProperty("verificationStrategy",
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   140
                        Verifier.DEFAULT_STRATEGY));
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   141
        strategy.verify(expectedProperties, fullMatchCnt, suspectCnt);
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   142
    }
b6e75523f59b 8056091: Move compiler/intrinsics/mathexact/sanity/Verifier to compiler/testlibrary and extend its functionality
fzhinkin
parents:
diff changeset
   143
}