test/hotspot/jtreg/runtime/InvocationTests/shared/AbstractGenerator.java
author chegar
Thu, 17 Oct 2019 20:54:25 +0100
branchdatagramsocketimpl-branch
changeset 58679 9c3209ff7550
parent 58678 9cf78a70fa4f
parent 55552 9bd13d6dea77
permissions -rw-r--r--
datagramsocketimpl-branch: merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55497
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
     1
/*
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
     2
 * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
     4
 *
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
     7
 * published by the Free Software Foundation.
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
     8
 *
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    13
 * accompanied this code).
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    14
 *
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    18
 *
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    21
 * questions.
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    22
 *
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    23
 */
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    24
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    25
package shared;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    26
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    27
import java.io.File;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    28
import java.io.FileOutputStream;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    29
import java.util.Arrays;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    30
import java.util.Map;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    31
import java.util.List;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    32
import java.util.ArrayList;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    33
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    34
public abstract class AbstractGenerator {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    35
    protected final boolean dumpClasses;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    36
    protected final boolean executeTests;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    37
    private static int testNum = 0;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    38
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    39
    protected AbstractGenerator(String[] args) {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    40
        List<String> params = new ArrayList<String>(Arrays.asList(args));
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    41
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    42
        if (params.contains("--help")) {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    43
            Utils.printHelp();
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    44
            System.exit(0);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    45
        }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    46
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    47
        dumpClasses = params.contains("--dump");
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    48
        executeTests = !params.contains("--noexecute");
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    49
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    50
        params.remove("--dump");
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    51
        params.remove("--noexecute");
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    52
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    53
        Utils.init(params);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    54
    }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    55
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    56
    /*******************************************************************/
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    57
    public static void writeToFile(File dir, Map<String, byte[]> classes) {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    58
        for (String name : classes.keySet()) {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    59
            try {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    60
                writeToFile(dir, name, classes.get(name));
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    61
            } catch (Exception e) {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    62
                throw new RuntimeException(e);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    63
            }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    64
        }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    65
    }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    66
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    67
    /*******************************************************************/
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    68
    public static void writeToFile(File dir, String fullName, byte[] classBytecode) {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    69
        if (!dir.isDirectory()) {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    70
            throw new RuntimeException("Invalid parameter: dir doesn't point to an existing directory");
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    71
        }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    72
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    73
        File classFile =
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    74
            new File(
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    75
                    dir.getPath() + File.separator
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    76
                    + fullName.replaceAll("\\.", File.separator)
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    77
                    + ".class"
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    78
                    );
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    79
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    80
        classFile.getParentFile().mkdirs();
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    81
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    82
        try {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    83
            FileOutputStream fos = new FileOutputStream(classFile);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    84
            try {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    85
                fos.write(classBytecode);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    86
            } finally {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    87
                fos.close();
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    88
            }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    89
        } catch (Exception e) {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    90
            throw new RuntimeException(e);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    91
        }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    92
    }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    93
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    94
    protected boolean exec(Map<String, byte[]> classes, String description, String calleeClassName, String classNameC, String[] callSites) throws ClassNotFoundException {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    95
        boolean isPassed = true;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    96
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    97
        testNum++;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    98
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
    99
        String caseDescription = String.format("%4d| %s", testNum, description);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   100
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   101
        // Create test executor for a single case
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   102
        classes.put(
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   103
                ExecutorGenerator.className
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   104
                , new ExecutorGenerator(
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   105
                        caseDescription
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   106
                        , calleeClassName
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   107
                        , classNameC
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   108
                    ).generateExecutor(callSites)
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   109
        );
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   110
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   111
        // Dump generated set to disk, if needed
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   112
        if (dumpClasses) {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   113
            File dir = new File("classes" + File.separator + String.format("%04d", testNum));
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   114
            dir.mkdirs();
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   115
            writeToFile(dir, classes);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   116
        }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   117
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   118
        ByteArrayClassLoader loader = new ByteArrayClassLoader(classes);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   119
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   120
        Class paramClass;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   121
        Class targetClass;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   122
        Checker checker;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   123
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   124
        try {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   125
            paramClass = loader.loadClass(calleeClassName);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   126
            targetClass = loader.loadClass(classNameC);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   127
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   128
            checker = getChecker(paramClass, targetClass);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   129
        } catch (Throwable e) {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   130
            String result = Checker.abbreviateResult(e.getClass().getName());
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   131
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   132
            System.out.printf(caseDescription);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   133
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   134
            for (String site : callSites) {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   135
                System.out.printf(" %7s", result);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   136
            }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   137
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   138
            System.out.println("");
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   139
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   140
            return true;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   141
        }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   142
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   143
        if (executeTests) {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   144
            // Check runtime behavior
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   145
            Caller caller = new Caller(loader, checker, paramClass, targetClass);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   146
            boolean printedCaseDes = false;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   147
            for (String site : callSites) {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   148
                String callResult = caller.call(site);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   149
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   150
                if (!caller.isPassed()) {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   151
                    isPassed = false;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   152
                    if (!printedCaseDes) {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   153
                        System.out.printf(caseDescription);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   154
                        printedCaseDes = true;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   155
                    }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   156
                    System.out.printf(" %7s", callResult);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   157
                }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   158
            }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   159
            if (!caller.isPassed()) {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   160
                System.out.println(" |   FAILED");
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   161
            }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   162
        } else {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   163
            for (String site : callSites) {
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   164
                String result = checker.check(loader.loadClass(site));
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   165
                System.out.printf(" %7s", Checker.abbreviateResult(result));
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   166
            }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   167
        }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   168
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   169
        return isPassed;
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   170
    }
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   171
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   172
    protected abstract Checker getChecker(Class paramClass, Class targetClass);
d3a33953b936 8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff changeset
   173
}