8227563: jvmti/scenarios/contention/TC05/tc05t001 fails due to "ERROR: tc05t001.cpp, 278: (waitedThreadCpuTime - waitThreadCpuTime) < (EXPECTED_ACCURACY * 1000000)"

Reviewed-by: amenkov, cjplummer, sspitsyn
This commit is contained in:
David Holmes 2019-09-05 18:39:22 -04:00
parent d2db14b836
commit 8b42387ea6
2 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2019, 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
@ -43,7 +43,7 @@
* /test/lib
* @run driver jdk.test.lib.FileInstaller . .
* @run main/othervm/native
* -agentlib:tc05t001=-waittime=5
* -agentlib:tc05t001=verbose,waittime=5
* nsk.jvmti.scenarios.contention.TC05.tc05t001
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2019, 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
@ -39,7 +39,11 @@ static const jlong EXPECTED_TIMEOUT = 1;
*/
static const jlong EXPECTED_TIMEOUT_ACCURACY_NS = 300000;
static const jlong EXPECTED_ACCURACY = 10;
#if (defined(WIN32) || defined(_WIN32))
static const jlong EXPECTED_ACCURACY = 16; // 16ms is longest clock update interval
#else
static const jlong EXPECTED_ACCURACY = 10; // high frequency clock updates expected
#endif
/* scaffold objects */
static jlong timeout = 0;
@ -264,7 +268,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
jlong_to_string(waitedTime - waitTime, buffer));
if (!(NSK_VERIFY((waitedTime - waitTime) >= (EXPECTED_TIMEOUT * 1000000) - EXPECTED_TIMEOUT_ACCURACY_NS))) {
#if (defined(WIN32) || defined(_WIN32))
/* Do not fail on Windows as spurious wakeups are expected. The JDK-6313903 was closed as "Won't Fix". */
/* Do not fail on Windows as early returns are expected and wait() treats them as spurious wakeups. */
#else
nsk_jvmti_setFailStatus();
#endif