PATCH: make BasicPTXTest's main more flexible

Doug Simon @ Oracle doug.simon at oracle.com
Tue Apr 2 14:15:53 PDT 2013


I'll integrate it now and push it through to the OpenJDK repository.

On Apr 2, 2013, at 10:57 PM, Christian Thalinger <christian.thalinger at oracle.com> wrote:

> Could we push this patch?  It makes it easier to run newly added methods from the command line (and print the code).
> 
> -- Chris
> 
> diff --git a/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/BasicPTXTest.java b/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/BasicPTXTest.java
> --- a/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/BasicPTXTest.java
> +++ b/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/BasicPTXTest.java
> @@ -22,6 +22,8 @@
>  */
> package com.oracle.graal.compiler.ptx.test;
> 
> +import java.lang.reflect.Method;
> +
> import org.junit.*;
> 
> import com.oracle.graal.api.code.*;
> @@ -90,7 +92,12 @@
> 
>     public static void main(String[] args) {
>         BasicPTXTest basicPTXTest = new BasicPTXTest();
> -        System.out.println("testAddSnippet: \n" + new String(basicPTXTest.test("testAddSnippet").getTargetCode()));
> -        System.out.println("testArraySnippet: \n" + new String(basicPTXTest.test("testArraySnippet").getTargetCode()));
> +        Method[] methods = BasicPTXTest.class.getMethods();
> +        for (Method m : methods) {
> +            if (m.getAnnotation(Test.class) != null) {
> +                String name = m.getName() + "Snippet";
> +                System.out.println(name + ": \n" + new String(basicPTXTest.test(name).getTargetCode()));
> +            }
> +        }
>     }
> }
> 



More information about the graal-dev mailing list