From b37db2a9db7eeff4005236da8dd735604da3a62b Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Tue, 7 Feb 2012 13:28:32 +0000 Subject: [PATCH] 7142847: TEST_BUG: java/nio/file/WatchService/SensitivityModifier.java has incorrect @run tag, runs Basic Reviewed-by: chegar --- jdk/test/java/nio/file/WatchService/Basic.java | 10 +++++----- .../nio/file/WatchService/SensitivityModifier.java | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/jdk/test/java/nio/file/WatchService/Basic.java b/jdk/test/java/nio/file/WatchService/Basic.java index fd1dee4b007..019ec96c30f 100644 --- a/jdk/test/java/nio/file/WatchService/Basic.java +++ b/jdk/test/java/nio/file/WatchService/Basic.java @@ -25,7 +25,7 @@ * @bug 4313887 6838333 7017446 * @summary Unit test for java.nio.file.WatchService * @library .. - * @run main/timeout=120 Basic + * @run main Basic */ import java.nio.file.*; @@ -281,11 +281,11 @@ public class Basic { System.out.println("poll with timeout..."); try { - long start = System.currentTimeMillis(); + long start = System.nanoTime(); key = watcher.poll(3000, TimeUnit.MILLISECONDS); if (key != null) throw new RuntimeException("no keys registered"); - long waited = System.currentTimeMillis() - start; + long waited = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start); if (waited < 2900) throw new RuntimeException("poll was too short"); } catch (InterruptedException x) { @@ -358,14 +358,14 @@ public class Basic { } // assume that poll throws exception immediately - long start = System.currentTimeMillis(); + long start = System.nanoTime(); try { watcher.poll(10000, TimeUnit.MILLISECONDS); throw new RuntimeException("ClosedWatchServiceException not thrown"); } catch (InterruptedException x) { throw new RuntimeException(x); } catch (ClosedWatchServiceException x) { - long waited = System.currentTimeMillis() - start; + long waited = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start); if (waited > 5000) throw new RuntimeException("poll was too long"); } diff --git a/jdk/test/java/nio/file/WatchService/SensitivityModifier.java b/jdk/test/java/nio/file/WatchService/SensitivityModifier.java index 3027d8d4e09..b0cafb330c2 100644 --- a/jdk/test/java/nio/file/WatchService/SensitivityModifier.java +++ b/jdk/test/java/nio/file/WatchService/SensitivityModifier.java @@ -23,9 +23,9 @@ /* @test * @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 .. - * @run main/timeout=330 Basic + * @run main/timeout=240 SensitivityModifier */ import java.nio.file.*;