changeset 19342:f7b121b82697

Fix HotSpotMethodSubstitutionTest tests
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Thu, 12 Feb 2015 15:04:00 -0800
parents 5eb28dbbeb37
children 83b35b97959c
files graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMethodSubstitutionTest.java
diffstat 1 files changed, 18 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMethodSubstitutionTest.java	Thu Feb 12 15:02:00 2015 -0800
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMethodSubstitutionTest.java	Thu Feb 12 15:04:00 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -33,25 +33,20 @@
  */
 public class HotSpotMethodSubstitutionTest extends MethodSubstitutionTest {
 
-    /*
-     * We have to ignore this test for now because currently there is no way to read uncompressed
-     * pointers in a compressed world via JNI.
-     */
-    @Ignore
     @Test
     public void testObjectSubstitutions() {
+        TestClassA obj = new TestClassA();
+
         test("getClass0");
         test("objectHashCode");
 
-        Object obj = new Object();
-
-        assertDeepEquals("a string".getClass(), ObjectSubstitutions.getClass("a string"));
-        assertDeepEquals(obj.hashCode(), ObjectSubstitutions.hashCode(obj));
+        test("getClass0", "a string");
+        test("objectHashCode", obj);
     }
 
     @SuppressWarnings("all")
-    public static boolean getClass0(Object obj, Class<?> clazz) {
-        return obj.getClass() == clazz;
+    public static Class<?> getClass0(Object obj) {
+        return obj.getClass();
     }
 
     @SuppressWarnings("all")
@@ -59,11 +54,6 @@
         return obj.hashCode();
     }
 
-    /*
-     * We have to ignore this test for now because currently there is no way to read uncompressed
-     * pointers in a compressed world via JNI.
-     */
-    @Ignore
     @Test
     public void testClassSubstitutions() {
         test("getModifiers");
@@ -74,12 +64,12 @@
         test("getComponentType");
 
         for (Class<?> c : new Class[]{getClass(), Cloneable.class, int[].class, String[][].class}) {
-            assertDeepEquals(c.getModifiers(), HotSpotClassSubstitutions.getModifiers(c));
-            assertDeepEquals(c.isInterface(), HotSpotClassSubstitutions.isInterface(c));
-            assertDeepEquals(c.isArray(), HotSpotClassSubstitutions.isArray(c));
-            assertDeepEquals(c.isPrimitive(), HotSpotClassSubstitutions.isPrimitive(c));
-            assertDeepEquals(c.getSuperclass(), HotSpotClassSubstitutions.getSuperclass(c));
-            assertDeepEquals(c.getComponentType(), HotSpotClassSubstitutions.getComponentType(c));
+            test("getModifiers", c);
+            test("isInterface", c);
+            test("isArray", c);
+            test("isPrimitive", c);
+            test("getSuperClass", c);
+            test("getComponentType", c);
         }
     }
 
@@ -113,11 +103,6 @@
         return clazz.getComponentType();
     }
 
-    /*
-     * We have to ignore this test for now because currently there is no way to read uncompressed
-     * pointers in a compressed world via JNI.
-     */
-    @Ignore
     @Test
     public void testThreadSubstitutions() {
         test("currentThread");
@@ -125,13 +110,13 @@
         test("threadInterrupted");
 
         Thread currentThread = Thread.currentThread();
-        assertDeepEquals(currentThread, ThreadSubstitutions.currentThread());
-        assertDeepEquals(currentThread.isInterrupted(), ThreadSubstitutions.isInterrupted(currentThread, false));
+        test("currentThread", currentThread);
+        test("threadIsInterrupted", currentThread);
     }
 
     @SuppressWarnings("all")
-    public static Thread currentThread() {
-        return Thread.currentThread();
+    public static boolean currentThread(Thread other) {
+        return Thread.currentThread() == other;
     }
 
     @SuppressWarnings("all")
@@ -152,7 +137,7 @@
         SystemSubstitutions.currentTimeMillis();
         SystemSubstitutions.nanoTime();
         for (Object o : new Object[]{this, new int[5], new String[2][], new Object()}) {
-            assertDeepEquals(System.identityHashCode(o), SystemSubstitutions.identityHashCode(o));
+            test("systemIdentityHashCode", o);
         }
     }