8227563: jvmti/scenarios/contention/TC05/tc05t001 fails due to "ERROR: tc05t001.cpp, 278: (waitedThreadCpuTime - waitThreadCpuTime) < (EXPECTED_ACCURACY * 1000000)"
authordholmes
Thu, 05 Sep 2019 18:39:22 -0400
changeset 58025 cfd0f43fdf5f
parent 58024 6eb44470aa98
child 58026 1e3f58d409f7
8227563: jvmti/scenarios/contention/TC05/tc05t001 fails due to "ERROR: tc05t001.cpp, 278: (waitedThreadCpuTime - waitThreadCpuTime) < (EXPECTED_ACCURACY * 1000000)" Reviewed-by: amenkov, cjplummer, sspitsyn
test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/TestDescription.java	Thu Sep 05 14:12:01 2019 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/TestDescription.java	Thu Sep 05 18:39:22 2019 -0400
@@ -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
  */
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp	Thu Sep 05 14:12:01 2019 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp	Thu Sep 05 18:39:22 2019 -0400
@@ -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_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 @@
         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