# HG changeset patch # User kzhaldyb # Date 1473345770 -10800 # Thu Sep 08 17:42:50 2016 +0300 # Node ID e776cf5197660a4907fc853d10ba95199ce16bf3 # Parent f722ed07b76bb8ffc26672ab952be7c0648fdc8f 8165613: Convert TestKlass_test to Gtest Reviewed-by: duke diff --git a/src/share/vm/oops/klass.cpp b/src/share/vm/oops/klass.cpp --- a/src/share/vm/oops/klass.cpp +++ b/src/share/vm/oops/klass.cpp @@ -728,27 +728,3 @@ } #endif - -/////////////// Unit tests /////////////// - -#ifndef PRODUCT - -class TestKlass { - public: - static void test_oop_is_instanceClassLoader() { - Klass* klass = SystemDictionary::ClassLoader_klass(); - guarantee(klass->is_instance_klass(), "assert"); - guarantee(InstanceKlass::cast(klass)->is_class_loader_instance_klass(), "test failed"); - - klass = SystemDictionary::String_klass(); - guarantee(!klass->is_instance_klass() || - !InstanceKlass::cast(klass)->is_class_loader_instance_klass(), - "test failed"); - } -}; - -void TestKlass_test() { - TestKlass::test_oop_is_instanceClassLoader(); -} - -#endif // PRODUCT diff --git a/src/share/vm/utilities/internalVMTests.cpp b/src/share/vm/utilities/internalVMTests.cpp --- a/src/share/vm/utilities/internalVMTests.cpp +++ b/src/share/vm/utilities/internalVMTests.cpp @@ -58,7 +58,6 @@ run_unit_test(GuardedMemory_test); run_unit_test(TestNewSize_test); run_unit_test(TestOldSize_test); - run_unit_test(TestKlass_test); run_unit_test(TestBitMap_test); run_unit_test(TestResourcehash_test); run_unit_test(ObjectMonitor_test); diff --git a/test/native/oops/test_klass.cpp b/test/native/oops/test_klass.cpp new file mode 100644 --- /dev/null +++ b/test/native/oops/test_klass.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#include "precompiled.hpp" +#include "classfile/systemDictionary.hpp" +#include "unittest.hpp" + +TEST_VM(SystemDictionary, class_loader_class) { + Klass* klass = SystemDictionary::ClassLoader_klass(); + ASSERT_TRUE(klass->is_instance_klass()); + ASSERT_TRUE(InstanceKlass::cast(klass)->is_class_loader_instance_klass()); +} + +TEST_VM(SystemDictionary, string_klass) { + Klass* klass = SystemDictionary::String_klass(); + ASSERT_TRUE(!klass->is_instance_klass() || + !InstanceKlass::cast(klass)->is_class_loader_instance_klass()); +}