8147012: Fix includes in internalVMTests.cpp
Reviewed-by: stefank, mgerdin
This commit is contained in:
parent
4651887649
commit
f646b9fac7
@ -300,4 +300,8 @@ void AltHashing::test_alt_hash() {
|
||||
testMurmur3_32_ByteArray();
|
||||
testEquivalentHashes();
|
||||
}
|
||||
|
||||
void AltHashing_test() {
|
||||
AltHashing::test_alt_hash();
|
||||
}
|
||||
#endif // PRODUCT
|
||||
|
@ -608,7 +608,7 @@ void DirectivesParser::test(const char* text, bool should_pass) {
|
||||
cd.clean_tmp();
|
||||
}
|
||||
|
||||
bool DirectivesParser::test() {
|
||||
void DirectivesParser::test() {
|
||||
DirectivesParser::test("{}", false);
|
||||
DirectivesParser::test("[]", true);
|
||||
DirectivesParser::test("[{}]", false);
|
||||
@ -742,8 +742,10 @@ bool DirectivesParser::test() {
|
||||
" }" "\n"
|
||||
" }" "\n"
|
||||
"]" "\n", false);
|
||||
}
|
||||
|
||||
return true;
|
||||
void DirectivesParser_test() {
|
||||
DirectivesParser::test();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -136,7 +136,7 @@ private:
|
||||
#ifndef PRODUCT
|
||||
static void test(const char* json, bool valid);
|
||||
public:
|
||||
static bool test();
|
||||
static void test();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -630,4 +630,8 @@ void CollectedHeap::test_is_in() {
|
||||
assert(!heap->is_in(after_heap),
|
||||
"after_heap: " PTR_FORMAT " is unexpectedly in the heap", p2i(after_heap));
|
||||
}
|
||||
|
||||
void CollectedHeap_test() {
|
||||
CollectedHeap::test_is_in();
|
||||
}
|
||||
#endif
|
||||
|
@ -388,7 +388,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
void GCTimerAllTest::all() {
|
||||
void GCTimer_test() {
|
||||
GCTimerTest::all();
|
||||
TimePartitionPhasesIteratorTest::all();
|
||||
}
|
||||
|
@ -185,16 +185,4 @@ class TimePartitionPhasesIterator {
|
||||
virtual GCPhase* next();
|
||||
};
|
||||
|
||||
|
||||
/////////////// Unit tests ///////////////
|
||||
|
||||
#ifndef PRODUCT
|
||||
|
||||
class GCTimerAllTest {
|
||||
public:
|
||||
static void all();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // SHARE_VM_GC_SHARED_GCTIMER_HPP
|
||||
|
@ -157,5 +157,9 @@ void GuardedMemory::test_guarded_memory() {
|
||||
assert(GuardedMemory::free_copy(no_data_copy), "Expected valid guards even for no data copy");
|
||||
}
|
||||
|
||||
void GuardedMemory_test() {
|
||||
GuardedMemory::test_guarded_memory();
|
||||
}
|
||||
|
||||
#endif // !PRODUCT
|
||||
|
||||
|
@ -39,21 +39,24 @@ bool arrayOopDesc::check_max_length_overflow(BasicType type) {
|
||||
return (julong)(size_t)bytes == bytes;
|
||||
}
|
||||
|
||||
void arrayOopDesc::test_max_array_length() {
|
||||
assert(check_max_length_overflow(T_BOOLEAN), "size_t overflow for boolean array");
|
||||
assert(check_max_length_overflow(T_CHAR), "size_t overflow for char array");
|
||||
assert(check_max_length_overflow(T_FLOAT), "size_t overflow for float array");
|
||||
assert(check_max_length_overflow(T_DOUBLE), "size_t overflow for double array");
|
||||
assert(check_max_length_overflow(T_BYTE), "size_t overflow for byte array");
|
||||
assert(check_max_length_overflow(T_SHORT), "size_t overflow for short array");
|
||||
assert(check_max_length_overflow(T_INT), "size_t overflow for int array");
|
||||
assert(check_max_length_overflow(T_LONG), "size_t overflow for long array");
|
||||
assert(check_max_length_overflow(T_OBJECT), "size_t overflow for object array");
|
||||
assert(check_max_length_overflow(T_ARRAY), "size_t overflow for array array");
|
||||
assert(check_max_length_overflow(T_NARROWOOP), "size_t overflow for narrowOop array");
|
||||
static void test_max_array_length() {
|
||||
assert(arrayOopDesc::check_max_length_overflow(T_BOOLEAN), "size_t overflow for boolean array");
|
||||
assert(arrayOopDesc::check_max_length_overflow(T_CHAR), "size_t overflow for char array");
|
||||
assert(arrayOopDesc::check_max_length_overflow(T_FLOAT), "size_t overflow for float array");
|
||||
assert(arrayOopDesc::check_max_length_overflow(T_DOUBLE), "size_t overflow for double array");
|
||||
assert(arrayOopDesc::check_max_length_overflow(T_BYTE), "size_t overflow for byte array");
|
||||
assert(arrayOopDesc::check_max_length_overflow(T_SHORT), "size_t overflow for short array");
|
||||
assert(arrayOopDesc::check_max_length_overflow(T_INT), "size_t overflow for int array");
|
||||
assert(arrayOopDesc::check_max_length_overflow(T_LONG), "size_t overflow for long array");
|
||||
assert(arrayOopDesc::check_max_length_overflow(T_OBJECT), "size_t overflow for object array");
|
||||
assert(arrayOopDesc::check_max_length_overflow(T_ARRAY), "size_t overflow for array array");
|
||||
assert(arrayOopDesc::check_max_length_overflow(T_NARROWOOP), "size_t overflow for narrowOop array");
|
||||
|
||||
// T_VOID and T_ADDRESS are not supported by max_array_length()
|
||||
}
|
||||
|
||||
void arrayOopDesc_test() {
|
||||
test_max_array_length();
|
||||
}
|
||||
|
||||
#endif //PRODUCT
|
||||
|
@ -127,8 +127,6 @@ class arrayOopDesc : public oopDesc {
|
||||
// for unit testing
|
||||
#ifndef PRODUCT
|
||||
static bool check_max_length_overflow(BasicType type);
|
||||
static int32_t old_max_array_length(BasicType type);
|
||||
static void test_max_array_length();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -2470,4 +2470,8 @@ void ObjectMonitor::verify() {
|
||||
|
||||
void ObjectMonitor::print() {
|
||||
}
|
||||
|
||||
void ObjectMonitor_test() {
|
||||
ObjectMonitor::sanity_checks();
|
||||
}
|
||||
#endif
|
||||
|
@ -3496,4 +3496,8 @@ void VMStructs::test() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VMStructs_test() {
|
||||
VMStructs::test();
|
||||
}
|
||||
#endif
|
||||
|
@ -357,6 +357,11 @@ size_t lcm(size_t a, size_t b) {
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
// For unit testing only
|
||||
class GlobalDefinitions {
|
||||
public:
|
||||
static void test_globals();
|
||||
};
|
||||
|
||||
void GlobalDefinitions::test_globals() {
|
||||
intptr_t page_sizes[] = { os::vm_page_size(), 4096, 8192, 65536, 2*1024*1024 };
|
||||
@ -384,4 +389,8 @@ void GlobalDefinitions::test_globals() {
|
||||
}
|
||||
}
|
||||
|
||||
void GlobalDefinitions_test() {
|
||||
GlobalDefinitions::test_globals();
|
||||
}
|
||||
|
||||
#endif // PRODUCT
|
||||
|
@ -1452,14 +1452,4 @@ static inline void* dereference_vptr(const void* addr) {
|
||||
return *(void**)addr;
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
|
||||
// For unit testing only
|
||||
class GlobalDefinitions {
|
||||
public:
|
||||
static void test_globals();
|
||||
};
|
||||
|
||||
#endif // PRODUCT
|
||||
|
||||
#endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP
|
||||
|
@ -26,22 +26,9 @@
|
||||
|
||||
#ifndef PRODUCT
|
||||
|
||||
#include "classfile/altHashing.hpp"
|
||||
#include "compiler/directivesParser.hpp"
|
||||
#include "gc/shared/collectedHeap.hpp"
|
||||
#include "gc/shared/gcTimer.hpp"
|
||||
#include "memory/guardedMemory.hpp"
|
||||
#include "utilities/internalVMTests.hpp"
|
||||
#include "utilities/json.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
#include "utilities/ostream.hpp"
|
||||
#include "utilities/quickSort.hpp"
|
||||
#if INCLUDE_ALL_GCS
|
||||
#include "gc/g1/heapRegionRemSet.hpp"
|
||||
#endif
|
||||
#if INCLUDE_VM_STRUCTS
|
||||
#include "runtime/vmStructs.hpp"
|
||||
#endif
|
||||
|
||||
#define run_unit_test(unit_test_function_call) \
|
||||
tty->print_cr("Running test: " #unit_test_function_call); \
|
||||
@ -67,6 +54,21 @@ void TestResourcehash_test();
|
||||
void TestChunkedList_test();
|
||||
void Test_log_length();
|
||||
void Test_TempNewSymbol();
|
||||
void GlobalDefinitions_test();
|
||||
void GCTimer_test();
|
||||
void arrayOopDesc_test();
|
||||
void CollectedHeap_test();
|
||||
void QuickSort_test();
|
||||
void GuardedMemory_test();
|
||||
void AltHashing_test();
|
||||
void ObjectMonitor_test();
|
||||
void JSON_test();
|
||||
void DirectivesParser_test();
|
||||
|
||||
#if INCLUDE_VM_STRUCTS
|
||||
void VMStructs_test();
|
||||
#endif
|
||||
|
||||
#if INCLUDE_ALL_GCS
|
||||
void TestOldFreeSpaceCalculation_test();
|
||||
void TestG1BiasedArray_test();
|
||||
@ -74,7 +76,7 @@ void TestBufferingOopClosure_test();
|
||||
void TestCodeCacheRemSet_test();
|
||||
void FreeRegionList_test();
|
||||
void IHOP_test();
|
||||
void test_memset_with_concurrent_readers() NOT_DEBUG_RETURN;
|
||||
void test_memset_with_concurrent_readers();
|
||||
void TestPredictions_test();
|
||||
void WorkerDataArray_test();
|
||||
#endif
|
||||
@ -90,28 +92,28 @@ void InternalVMTests::run() {
|
||||
run_unit_test(TestMetaspaceAux_test());
|
||||
run_unit_test(TestMetachunk_test());
|
||||
run_unit_test(TestVirtualSpaceNode_test());
|
||||
run_unit_test(GlobalDefinitions::test_globals());
|
||||
run_unit_test(GCTimerAllTest::all());
|
||||
run_unit_test(arrayOopDesc::test_max_array_length());
|
||||
run_unit_test(CollectedHeap::test_is_in());
|
||||
run_unit_test(QuickSort::test_quick_sort());
|
||||
run_unit_test(GuardedMemory::test_guarded_memory());
|
||||
run_unit_test(AltHashing::test_alt_hash());
|
||||
run_unit_test(GlobalDefinitions_test());
|
||||
run_unit_test(GCTimer_test());
|
||||
run_unit_test(arrayOopDesc_test());
|
||||
run_unit_test(CollectedHeap_test());
|
||||
run_unit_test(QuickSort_test());
|
||||
run_unit_test(GuardedMemory_test());
|
||||
run_unit_test(AltHashing_test());
|
||||
run_unit_test(TestNewSize_test());
|
||||
run_unit_test(TestOldSize_test());
|
||||
run_unit_test(TestKlass_test());
|
||||
run_unit_test(TestBitMap_test());
|
||||
run_unit_test(TestAsUtf8());
|
||||
run_unit_test(TestResourcehash_test());
|
||||
run_unit_test(ObjectMonitor::sanity_checks());
|
||||
run_unit_test(ObjectMonitor_test());
|
||||
run_unit_test(Test_linked_list());
|
||||
run_unit_test(TestChunkedList_test());
|
||||
run_unit_test(JSONTest::test());
|
||||
run_unit_test(JSON_test());
|
||||
run_unit_test(Test_log_length());
|
||||
run_unit_test(DirectivesParser::test());
|
||||
run_unit_test(DirectivesParser_test());
|
||||
run_unit_test(Test_TempNewSymbol());
|
||||
#if INCLUDE_VM_STRUCTS
|
||||
run_unit_test(VMStructs::test());
|
||||
run_unit_test(VMStructs_test());
|
||||
#endif
|
||||
#if INCLUDE_ALL_GCS
|
||||
run_unit_test(TestOldFreeSpaceCalculation_test());
|
||||
|
@ -687,6 +687,24 @@ void JSON::error(JSON_ERROR e, const char* format, ...) {
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
class JSONTest : public JSON {
|
||||
public:
|
||||
static void test();
|
||||
|
||||
private:
|
||||
JSONTest(const char* text);
|
||||
static void test(const char* json, bool valid);
|
||||
|
||||
void log(uint level, const char* format, ...) ATTRIBUTE_PRINTF(3, 4);
|
||||
|
||||
bool callback(JSON_TYPE t, JSON_VAL* v, uint level);
|
||||
JSON_TYPE prev;
|
||||
};
|
||||
|
||||
void JSON_test() {
|
||||
JSONTest::test();
|
||||
}
|
||||
|
||||
void JSONTest::test(const char* text, bool should_pass) {
|
||||
JSONTest json(text);
|
||||
if (should_pass) {
|
||||
@ -707,7 +725,7 @@ JSONTest::JSONTest(const char* text) : JSON(text, !VerboseInternalVMTests, tty)
|
||||
parse();
|
||||
}
|
||||
|
||||
bool JSONTest::test() {
|
||||
void JSONTest::test() {
|
||||
JSONTest::test("{}", true);
|
||||
JSONTest::test("[]", true);
|
||||
JSONTest::test(" { } ", true);
|
||||
@ -842,8 +860,6 @@ bool JSONTest::test() {
|
||||
" blocking_compile: true" "\n"
|
||||
" }," "\n"
|
||||
"]" "\n", true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void JSONTest::log(uint indent, const char* format, ...) {
|
||||
|
@ -108,20 +108,4 @@ class JSON : public ResourceObj {
|
||||
const char* strerror(JSON_ERROR e);
|
||||
};
|
||||
|
||||
#ifndef PRODUCT
|
||||
class JSONTest : public JSON {
|
||||
public:
|
||||
static bool test();
|
||||
|
||||
private:
|
||||
JSONTest(const char* text);
|
||||
static void test(const char* json, bool valid);
|
||||
|
||||
void log(uint level, const char* format, ...) ATTRIBUTE_PRINTF(3, 4);
|
||||
|
||||
bool callback(JSON_TYPE t, JSON_VAL* v, uint level);
|
||||
JSON_TYPE prev;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // SHARE_VM_UTILITIES_JSON_HPP
|
||||
|
@ -72,7 +72,7 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
void QuickSort::print_array(const char* prefix, int* array, int length) {
|
||||
static void print_array(const char* prefix, int* array, int length) {
|
||||
tty->print("%s:", prefix);
|
||||
for (int i = 0; i < length; i++) {
|
||||
tty->print(" %d", array[i]);
|
||||
@ -80,7 +80,7 @@ void QuickSort::print_array(const char* prefix, int* array, int length) {
|
||||
tty->cr();
|
||||
}
|
||||
|
||||
bool QuickSort::compare_arrays(int* actual, int* expected, int length) {
|
||||
static bool compare_arrays(int* actual, int* expected, int length) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (actual[i] != expected[i]) {
|
||||
print_array("Sorted array ", actual, length);
|
||||
@ -92,12 +92,12 @@ bool QuickSort::compare_arrays(int* actual, int* expected, int length) {
|
||||
}
|
||||
|
||||
template <class C>
|
||||
bool QuickSort::sort_and_compare(int* arrayToSort, int* expectedResult, int length, C comparator, bool idempotent) {
|
||||
sort<int, C>(arrayToSort, length, comparator, idempotent);
|
||||
static bool sort_and_compare(int* arrayToSort, int* expectedResult, int length, C comparator, bool idempotent = false) {
|
||||
QuickSort::sort<int, C>(arrayToSort, length, comparator, idempotent);
|
||||
return compare_arrays(arrayToSort, expectedResult, length);
|
||||
}
|
||||
|
||||
void QuickSort::test_quick_sort() {
|
||||
void QuickSort_test() {
|
||||
{
|
||||
int* test_array = NULL;
|
||||
int* expected_array = NULL;
|
||||
@ -208,15 +208,14 @@ void QuickSort::test_quick_sort() {
|
||||
// Now sort them once with the test_even_odd_comparator. Then sort the
|
||||
// test_array one more time with test_even_odd_comparator and verify that
|
||||
// it is idempotent.
|
||||
sort(expected_array, length, test_even_odd_comparator, true);
|
||||
sort(test_array, length, test_even_odd_comparator, true);
|
||||
QuickSort::sort(expected_array, length, test_even_odd_comparator, true);
|
||||
QuickSort::sort(test_array, length, test_even_odd_comparator, true);
|
||||
assert(compare_arrays(test_array, expected_array, length), "Sorting identical arrays rendered different results");
|
||||
sort(test_array, length, test_even_odd_comparator, true);
|
||||
QuickSort::sort(test_array, length, test_even_odd_comparator, true);
|
||||
assert(compare_arrays(test_array, expected_array, length), "Sorting already sorted array changed order of elements - not idempotent");
|
||||
|
||||
FREE_C_HEAP_ARRAY(int, test_array);
|
||||
FREE_C_HEAP_ARRAY(int, expected_array);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -124,14 +124,6 @@ class QuickSort : AllStatic {
|
||||
inner_sort<T, C, false>(array, length, comparator);
|
||||
}
|
||||
}
|
||||
|
||||
// for unit testing
|
||||
#ifndef PRODUCT
|
||||
static void print_array(const char* prefix, int* array, int length);
|
||||
static bool compare_arrays(int* actual, int* expected, int length);
|
||||
template <class C> static bool sort_and_compare(int* arrayToSort, int* expectedResult, int length, C comparator, bool idempotent = false);
|
||||
static void test_quick_sort();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user