提交 260dbba1 编写于 作者: A alanb

7142847: TEST_BUG: java/nio/file/WatchService/SensitivityModifier.java has...

7142847: TEST_BUG: java/nio/file/WatchService/SensitivityModifier.java has incorrect @run tag, runs Basic
Reviewed-by: chegar
上级 82583604
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* @bug 4313887 6838333 7017446 * @bug 4313887 6838333 7017446
* @summary Unit test for java.nio.file.WatchService * @summary Unit test for java.nio.file.WatchService
* @library .. * @library ..
* @run main/timeout=120 Basic * @run main Basic
*/ */
import java.nio.file.*; import java.nio.file.*;
...@@ -281,11 +281,11 @@ public class Basic { ...@@ -281,11 +281,11 @@ public class Basic {
System.out.println("poll with timeout..."); System.out.println("poll with timeout...");
try { try {
long start = System.currentTimeMillis(); long start = System.nanoTime();
key = watcher.poll(3000, TimeUnit.MILLISECONDS); key = watcher.poll(3000, TimeUnit.MILLISECONDS);
if (key != null) if (key != null)
throw new RuntimeException("no keys registered"); throw new RuntimeException("no keys registered");
long waited = System.currentTimeMillis() - start; long waited = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
if (waited < 2900) if (waited < 2900)
throw new RuntimeException("poll was too short"); throw new RuntimeException("poll was too short");
} catch (InterruptedException x) { } catch (InterruptedException x) {
...@@ -358,14 +358,14 @@ public class Basic { ...@@ -358,14 +358,14 @@ public class Basic {
} }
// assume that poll throws exception immediately // assume that poll throws exception immediately
long start = System.currentTimeMillis(); long start = System.nanoTime();
try { try {
watcher.poll(10000, TimeUnit.MILLISECONDS); watcher.poll(10000, TimeUnit.MILLISECONDS);
throw new RuntimeException("ClosedWatchServiceException not thrown"); throw new RuntimeException("ClosedWatchServiceException not thrown");
} catch (InterruptedException x) { } catch (InterruptedException x) {
throw new RuntimeException(x); throw new RuntimeException(x);
} catch (ClosedWatchServiceException x) { } catch (ClosedWatchServiceException x) {
long waited = System.currentTimeMillis() - start; long waited = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
if (waited > 5000) if (waited > 5000)
throw new RuntimeException("poll was too long"); throw new RuntimeException("poll was too long");
} }
......
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
/* @test /* @test
* @bug 4313887 * @bug 4313887
* @summary Sanity test for Sun-specific sensitivyt level watch event modifier * @summary Sanity test for Sun-specific sensitivity level watch event modifier
* @library .. * @library ..
* @run main/timeout=330 Basic * @run main/timeout=240 SensitivityModifier
*/ */
import java.nio.file.*; import java.nio.file.*;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册