8254042: gtest/GTestWrapper.java failed os.test_random
Reviewed-by: dholmes, stuefe, kbarrett
This commit is contained in:
parent
962f7a3bae
commit
4db05e991b
@ -2464,8 +2464,6 @@ void os::init(void) {
|
|||||||
|
|
||||||
clock_tics_per_sec = sysconf(_SC_CLK_TCK);
|
clock_tics_per_sec = sysconf(_SC_CLK_TCK);
|
||||||
|
|
||||||
init_random(1234567);
|
|
||||||
|
|
||||||
// _main_thread points to the thread that created/loaded the JVM.
|
// _main_thread points to the thread that created/loaded the JVM.
|
||||||
Aix::_main_thread = pthread_self();
|
Aix::_main_thread = pthread_self();
|
||||||
|
|
||||||
|
@ -2089,8 +2089,6 @@ void os::init(void) {
|
|||||||
|
|
||||||
clock_tics_per_sec = CLK_TCK;
|
clock_tics_per_sec = CLK_TCK;
|
||||||
|
|
||||||
init_random(1234567);
|
|
||||||
|
|
||||||
Bsd::set_page_size(getpagesize());
|
Bsd::set_page_size(getpagesize());
|
||||||
if (Bsd::page_size() == -1) {
|
if (Bsd::page_size() == -1) {
|
||||||
fatal("os_bsd.cpp: os::init: sysconf failed (%s)", os::strerror(errno));
|
fatal("os_bsd.cpp: os::init: sysconf failed (%s)", os::strerror(errno));
|
||||||
|
@ -4394,8 +4394,6 @@ void os::init(void) {
|
|||||||
|
|
||||||
clock_tics_per_sec = sysconf(_SC_CLK_TCK);
|
clock_tics_per_sec = sysconf(_SC_CLK_TCK);
|
||||||
|
|
||||||
init_random(1234567);
|
|
||||||
|
|
||||||
Linux::set_page_size(sysconf(_SC_PAGESIZE));
|
Linux::set_page_size(sysconf(_SC_PAGESIZE));
|
||||||
if (Linux::page_size() == -1) {
|
if (Linux::page_size() == -1) {
|
||||||
fatal("os_linux.cpp: os::init: sysconf failed (%s)",
|
fatal("os_linux.cpp: os::init: sysconf failed (%s)",
|
||||||
|
@ -4164,8 +4164,6 @@ void nx_check_protection() {
|
|||||||
void os::init(void) {
|
void os::init(void) {
|
||||||
_initial_pid = _getpid();
|
_initial_pid = _getpid();
|
||||||
|
|
||||||
init_random(1234567);
|
|
||||||
|
|
||||||
win32::initialize_system_info();
|
win32::initialize_system_info();
|
||||||
win32::setmode_streams();
|
win32::setmode_streams();
|
||||||
init_page_sizes((size_t) win32::vm_page_size());
|
init_page_sizes((size_t) win32::vm_page_size());
|
||||||
|
@ -299,7 +299,6 @@ static jint wb_stress_virtual_space_resize(size_t reserved_space_size,
|
|||||||
|
|
||||||
int seed = os::random();
|
int seed = os::random();
|
||||||
tty->print_cr("Random seed is %d", seed);
|
tty->print_cr("Random seed is %d", seed);
|
||||||
os::init_random(seed);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < iterations; i++) {
|
for (size_t i = 0; i < iterations; i++) {
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
|
|
||||||
OSThread* os::_starting_thread = NULL;
|
OSThread* os::_starting_thread = NULL;
|
||||||
address os::_polling_page = NULL;
|
address os::_polling_page = NULL;
|
||||||
volatile unsigned int os::_rand_seed = 1;
|
volatile unsigned int os::_rand_seed = 1234567;
|
||||||
int os::_processor_count = 0;
|
int os::_processor_count = 0;
|
||||||
int os::_initial_active_processor_count = 0;
|
int os::_initial_active_processor_count = 0;
|
||||||
size_t os::_page_sizes[os::page_sizes_max];
|
size_t os::_page_sizes[os::page_sizes_max];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -120,10 +120,10 @@ TEST(os, test_random) {
|
|||||||
unsigned int seed = 1;
|
unsigned int seed = 1;
|
||||||
|
|
||||||
// tty->print_cr("seed %ld for %ld repeats...", seed, reps);
|
// tty->print_cr("seed %ld for %ld repeats...", seed, reps);
|
||||||
os::init_random(seed);
|
|
||||||
int num;
|
int num;
|
||||||
for (int k = 0; k < reps; k++) {
|
for (int k = 0; k < reps; k++) {
|
||||||
num = os::random();
|
// Use next_random so the calculation is stateless.
|
||||||
|
num = seed = os::next_random(seed);
|
||||||
double u = (double)num / m;
|
double u = (double)num / m;
|
||||||
ASSERT_TRUE(u >= 0.0 && u <= 1.0) << "bad random number!";
|
ASSERT_TRUE(u >= 0.0 && u <= 1.0) << "bad random number!";
|
||||||
|
|
||||||
@ -148,7 +148,6 @@ TEST(os, test_random) {
|
|||||||
ASSERT_LT(t, eps) << "bad variance";
|
ASSERT_LT(t, eps) << "bad variance";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
TEST_VM_ASSERT_MSG(os, page_size_for_region_with_zero_min_pages, "sanity") {
|
TEST_VM_ASSERT_MSG(os, page_size_for_region_with_zero_min_pages, "sanity") {
|
||||||
size_t region_size = 16 * os::vm_page_size();
|
size_t region_size = 16 * os::vm_page_size();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user