changeset 16517:cb70055faeeb

[SPARC/AMD64] Ignore AllocatorTest when the platform does not match.
author Stefan Anzinger <stefan.anzinger@gmail.com>
date Wed, 09 Jul 2014 09:36:13 -0700
parents 587ff693e666
children 3eb13b910134
files graal/com.oracle.graal.compiler.amd64.test/src/com/oracle/graal/compiler/amd64/test/AMD64AllocatorTest.java graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/SPARCAllocatorTest.java graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java
diffstat 3 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.amd64.test/src/com/oracle/graal/compiler/amd64/test/AMD64AllocatorTest.java	Wed Jul 09 08:48:03 2014 -0700
+++ b/graal/com.oracle.graal.compiler.amd64.test/src/com/oracle/graal/compiler/amd64/test/AMD64AllocatorTest.java	Wed Jul 09 09:36:13 2014 -0700
@@ -26,8 +26,15 @@
 
 import com.oracle.graal.compiler.test.backend.*;
 
+import static org.junit.Assume.*;
+
 public class AMD64AllocatorTest extends AllocatorTest {
 
+    @Before
+    public void setUp() {
+        assumeTrue(isArchitecture("AMD64"));
+    }
+
     @Test
     public void test1() {
         test("test1snippet", 3, 1, 0);
--- a/graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/SPARCAllocatorTest.java	Wed Jul 09 08:48:03 2014 -0700
+++ b/graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/SPARCAllocatorTest.java	Wed Jul 09 09:36:13 2014 -0700
@@ -22,12 +22,19 @@
  */
 package com.oracle.graal.compiler.sparc.test;
 
+import static org.junit.Assume.*;
+
 import org.junit.*;
 
 import com.oracle.graal.compiler.test.backend.*;
 
 public class SPARCAllocatorTest extends AllocatorTest {
 
+    @Before
+    public void setUp() {
+        assumeTrue(isArchitecture("SPARC"));
+    }
+
     @Test
     public void test1() {
         test("test1snippet", 1, 0, 0);
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Wed Jul 09 08:48:03 2014 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Wed Jul 09 09:36:13 2014 -0700
@@ -743,4 +743,15 @@
     protected static boolean iterationCount(double i, boolean cond) {
         return cond;
     }
+
+    /**
+     * Test if the current test runs on the given platform. The name must match the name given in
+     * the {@link Architecture#getName()}.
+     *
+     * @param name The name to test
+     * @return true if we run on the architecture given by name
+     */
+    protected boolean isArchitecture(String name) {
+        return name.equals(backend.getTarget().arch.getName());
+    }
 }