8165613: Convert TestKlass_test to Gtest

Reviewed-by: coleenp, rehn
This commit is contained in:
Kirill Zhaldybin 2016-09-16 19:49:03 +03:00
parent 9cc42b8afa
commit 0581d8c4cb
3 changed files with 13 additions and 27 deletions

View File

@ -734,27 +734,3 @@ bool Klass::verify_itable_index(int i) {
}
#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

View File

@ -57,7 +57,6 @@ void InternalVMTests::run() {
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);

View File

@ -19,18 +19,29 @@
* 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/symbolTable.hpp"
#include "classfile/systemDictionary.hpp"
#include "memory/resourceArea.hpp"
#include "oops/instanceKlass.hpp"
#include "unittest.hpp"
// Tests InstanceKlass::package_from_name()
TEST_VM(instanceKlass, null_symbol) {
TEST_VM(InstanceKlass, null_symbol) {
ResourceMark rm;
TempNewSymbol package_sym = InstanceKlass::package_from_name(NULL, NULL);
ASSERT_TRUE(package_sym == NULL) << "Wrong package for NULL symbol";
}
// Tests for InstanceKlass::is_class_loader_instance_klass() function
TEST_VM(InstanceKlass, class_loader_class) {
InstanceKlass* klass = SystemDictionary::ClassLoader_klass();
ASSERT_TRUE(klass->is_class_loader_instance_klass());
}
TEST_VM(InstanceKlass, string_klass) {
InstanceKlass* klass = SystemDictionary::String_klass();
ASSERT_TRUE(!klass->is_class_loader_instance_klass());
}