Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalTest.java @ 11659:ec7aad9dfc47
made 'mx build' refresh IDE configs automatically
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 16 Sep 2013 13:09:02 +0200 |
parents | d9d883aeb96f |
children | b42977294f02 |
rev | line source |
---|---|
7717
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
1 /* |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
4 * |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
8 * |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
14 * |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
18 * |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
21 * questions. |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
22 */ |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.test; |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
24 |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
25 import java.lang.reflect.*; |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
26 |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
27 import org.junit.*; |
8340
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
7717
diff
changeset
|
28 import org.junit.runner.*; |
7717
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
29 |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
30 /** |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
31 * Base class for Graal tests. |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
32 * <p> |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
33 * This contains common utility methods that are used in multiple test projects. |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
34 */ |
8340
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
7717
diff
changeset
|
35 @RunWith(GraalLongUnitTest.class) |
7717
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
36 public class GraalTest { |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
37 |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
38 protected Method getMethod(String methodName) { |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
39 Method found = null; |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
40 for (Method m : this.getClass().getMethods()) { |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
41 if (m.getName().equals(methodName)) { |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
42 Assert.assertNull(found); |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
43 found = m; |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
44 } |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
45 } |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
46 if (found != null) { |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
47 return found; |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
48 } else { |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
49 throw new RuntimeException("method not found: " + methodName); |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
50 } |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
51 } |
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
52 } |