/* * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package compiler.lib.ir_framework; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Annotate all methods in your test class which the framework should test with {@code @Test}. *

* Let {@code m} be a test method specifying the {@code @Test} annotation. If {@code m} is neither part of a * checked test (an additional method specifying {@link Check @Check} with {@code @Check(test = "m")}) nor part * of a custom run test (an additional method specifying {@link Run @Run} with {@code @Run(test = "m")}), * then {@code m} is a so-called base test and the framework invokes {@code m} in the following way: *

    *
  1. The framework warms {@code m} up by invoking it for a predefined number of iterations (default: 2000) * or any number specified by an additional {@link Warmup @Warmup} annotation at {@code m} or by using * {@link TestFramework#setDefaultWarmup(int)} (could also be 0 which skips the warm-up completely which is similar * to simulating {@code -Xcomp}). More information about the warm-up in general can be found at {@link Warmup}

  2. *
  3. After the warm-up, the framework compiles {@code m} at the specified compilation level set by * {@link #compLevel()} (default {@link CompLevel#ANY} will pick the highest available level which is usually * {@link CompLevel#C2}).

  4. *
  5. The framework invokes {@code m} one more time to run the compilation.

  6. *
  7. The framework checks any specified {@link IR @IR} constraints at {@code m}. More information about IR matching * can be found at {@link IR}.

  8. *
* *

* {@code m} has the following properties: *

* *

* The following constraints must be met for the test method {@code m} specifying {@code @Test}: *

* *

* Examples on how to write base tests can be found in {@link ir_framework.examples.BaseTestExample} * and also as part of the internal testing in the package {@link ir_framework.tests}. * * @see Arguments */ @Retention(RetentionPolicy.RUNTIME) public @interface Test { /** * Specify at which compilation level the framework should eventually compile the test method after an optional * warm-up period. The default {@link CompLevel#ANY} will let the framework compile the method at the highest * available level which is usually {@link CompLevel#C2}. */ CompLevel compLevel() default CompLevel.ANY; }