# HG changeset patch # User Tom Rodriguez # Date 1423782240 28800 # Node ID f7b121b82697c3c3adcce9f9ea3fcc241c2eb968 # Parent 5eb28dbbeb376724ed8dda9ad0123334ff805b39 Fix HotSpotMethodSubstitutionTest tests diff -r 5eb28dbbeb37 -r f7b121b82697 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMethodSubstitutionTest.java --- 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); } }