Test fixes: more logging, typos, fixes to at-run targets JEP-349-branch
authormseledtsov
Mon, 23 Sep 2019 09:16:05 -0700
branchJEP-349-branch
changeset 58271 e47423f1318b
parent 58259 b6efcf2217f1
child 58343 ca19b94eac7a
Test fixes: more logging, typos, fixes to at-run targets
test/jdk/jdk/jfr/api/consumer/recordingstream/TestClose.java
test/jdk/jdk/jfr/api/consumer/recordingstream/TestDisable.java
test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnClose.java
test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnEvent.java
test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnFlush.java
test/jdk/jdk/jfr/api/consumer/recordingstream/TestRemove.java
test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetFlushInterval.java
test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetSettings.java
test/jdk/jdk/jfr/api/consumer/recordingstream/TestStart.java
test/jdk/jdk/jfr/api/consumer/security/TestStreamingFile.java
test/jdk/jdk/jfr/api/consumer/streaming/TestRemovedChunks.java
test/jdk/jdk/jfr/api/consumer/streaming/TestRepositoryMigration.java
test/jdk/jdk/jfr/api/consumer/streaming/TestRepositoryProperty.java
test/jdk/jdk/jfr/api/event/TestEventDuration.java
--- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestClose.java	Sun Sep 22 17:31:57 2019 +0200
+++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestClose.java	Mon Sep 23 09:16:05 2019 -0700
@@ -54,6 +54,7 @@
     }
 
     private static void testCloseMySelf() throws Exception {
+        log("Entering testCloseMySelf()");
         CountDownLatch l1 = new CountDownLatch(1);
         CountDownLatch l2 = new CountDownLatch(1);
         RecordingStream r = new RecordingStream();
@@ -71,9 +72,11 @@
         c.commit();
         l1.countDown();
         l2.await();
+        log("Leaving testCloseMySelf()");
     }
 
     private static void testCloseStreaming() throws Exception {
+        log("Entering testCloseStreaming()");
         CountDownLatch streaming = new CountDownLatch(1);
         RecordingStream r = new RecordingStream();
         AtomicLong count = new AtomicLong();
@@ -92,24 +95,34 @@
         streaming.await();
         r.close();
         streamingLoop.cancel(true);
+        log("Leaving testCloseStreaming()");
     }
 
     private static void testCloseStarted() {
+        log("Entering testCloseStarted()");
         RecordingStream r = new RecordingStream();
         r.startAsync();
         r.close();
+        log("Leaving testCloseStarted()");
     }
 
     private static void testCloseUnstarted() {
+        log("Entering testCloseUnstarted()");
         RecordingStream r = new RecordingStream();
         r.close();
+        log("Leaving testCloseUnstarted()");
     }
 
     private static void testCloseTwice() {
+        log("Entering testCloseTwice()");
         RecordingStream r = new RecordingStream();
         r.startAsync();
         r.close();
         r.close();
+        log("Leaving testCloseTwice()");
     }
 
+    private static void log(String msg) {
+        System.out.println(msg);
+    }
 }
--- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestDisable.java	Sun Sep 22 17:31:57 2019 +0200
+++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestDisable.java	Mon Sep 23 09:16:05 2019 -0700
@@ -37,7 +37,7 @@
  * @key jfr
  * @requires vm.hasJFR
  * @library /test/lib
- * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestConstructor
+ * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestDisable
  */
 public class TestDisable {
 
--- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnClose.java	Sun Sep 22 17:31:57 2019 +0200
+++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnClose.java	Mon Sep 23 09:16:05 2019 -0700
@@ -37,12 +37,13 @@
  * @key jfr
  * @requires vm.hasJFR
  * @library /test/lib
- * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestMaxAge
+ * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestOnClose
  */
 public class TestOnClose {
 
     private static class CloseEvent extends Event {
     }
+
     public static void main(String... args) throws Exception {
         testOnCloseNull();
         testOnClosedUnstarted();
--- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnEvent.java	Sun Sep 22 17:31:57 2019 +0200
+++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnEvent.java	Mon Sep 23 09:16:05 2019 -0700
@@ -61,6 +61,7 @@
     }
 
     private static void testOnEventNull() {
+        log("Entering testOnEventNull()");
         try (RecordingStream rs = new RecordingStream()) {
            try {
                rs.onEvent(null);
@@ -83,9 +84,11 @@
                // OK; as expected
            }
         }
+        log("Leaving testOnEventNull()");
      }
 
     private static void testTwoEventWithSameName() throws Exception {
+        log("Entering testTwoEventWithSameName()");
         CountDownLatch eventA = new CountDownLatch(2);
         try (RecordingStream r = new RecordingStream()) {
             r.onEvent("A", e -> {
@@ -99,9 +102,11 @@
             a2.commit();
             eventA.await();
         }
+        log("Leaving testTwoEventWithSameName()");
     }
 
     private static void testNamedEvent() throws Exception {
+        log("Entering testNamedEvent()");
         try (RecordingStream r = new RecordingStream()) {
             CountDownLatch eventA = new CountDownLatch(1);
             CountDownLatch eventC = new CountDownLatch(1);
@@ -126,9 +131,11 @@
             eventA.await();
             eventC.await();
         }
+        log("Leaving testNamedEvent()");
     }
 
     private static void testOnEvent() throws Exception {
+        log("Entering testOnEvent()");
         try (RecordingStream r = new RecordingStream()) {
             CountDownLatch event = new CountDownLatch(1);
             r.onEvent(e -> {
@@ -139,5 +146,10 @@
             a.commit();
             event.await();
         }
+        log("Leaving testOnEvent()");
+    }
+
+    private static void log(String msg) {
+        System.out.println(msg);
     }
 }
--- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnFlush.java	Sun Sep 22 17:31:57 2019 +0200
+++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnFlush.java	Mon Sep 23 09:16:05 2019 -0700
@@ -50,6 +50,7 @@
     }
 
     private static void testOnFlushNull() {
+        log("Entering testOnFlushNull()");
         try (RecordingStream rs = new RecordingStream()) {
            try {
                rs.onFlush(null);
@@ -58,9 +59,11 @@
                // OK; as expected
            }
         }
+        log("Leaving testOnFlushNull()");
      }
 
     private static void testNoEvent() throws Exception {
+        log("Entering testNoEvent()");
         CountDownLatch flush = new CountDownLatch(1);
         try (RecordingStream r = new RecordingStream()) {
             r.onFlush(() -> {
@@ -69,9 +72,11 @@
             r.startAsync();
             flush.await();
         }
+        log("Leaving testNoEvent()");
     }
 
     private static void testOneEvent() throws InterruptedException {
+        log("Entering testOneEvent()");
         CountDownLatch flush = new CountDownLatch(1);
         try (RecordingStream r = new RecordingStream()) {
             r.onEvent(e -> {
@@ -85,5 +90,10 @@
             e.commit();
             flush.await();
         }
+        log("Leaving testOneEvent()");
+    }
+
+    private static void log(String msg) {
+        System.out.println(msg);
     }
 }
--- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRemove.java	Sun Sep 22 17:31:57 2019 +0200
+++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRemove.java	Mon Sep 23 09:16:05 2019 -0700
@@ -56,6 +56,7 @@
     }
 
     private static void testRemoveNull() {
+        log("Entering testRemoveNull()");
         try (RecordingStream rs = new RecordingStream()) {
            try {
                rs.remove(null);
@@ -64,9 +65,11 @@
                // OK; as expected
            }
         }
+        log("Leaving testRemoveNull()");
      }
 
     private static void testRemoveOnEvent() throws Exception {
+        log("Entering testRemoveOnEvent()");
         try (RecordingStream rs = new RecordingStream()) {
             AtomicInteger counter = new AtomicInteger(0);
             CountDownLatch events = new CountDownLatch(2);
@@ -91,9 +94,11 @@
                 throw new AssertionError("OnEvent handler not removed!");
             }
         }
+        log("Leaving testRemoveOnEvent()");
     }
 
     private static void testRemoveOnClose() {
+        log("Entering testRemoveOnClose()");
         try (RecordingStream rs = new RecordingStream()) {
             AtomicBoolean onClose = new AtomicBoolean(false);
             Runnable r = () -> {
@@ -106,9 +111,11 @@
                 throw new AssertionError("onClose handler not removed!");
             }
         }
+        log("Leaving testRemoveOnClose()");
     }
 
     private static void testRemoveOnFlush() throws Exception {
+        log("Entering testRemoveOnFlush()");
         try (RecordingStream rs = new RecordingStream()) {
             AtomicInteger flushCount = new AtomicInteger(2);
             AtomicBoolean removeExecuted = new AtomicBoolean(false);
@@ -133,5 +140,10 @@
                 throw new AssertionError("onFlush handler not removed!");
             }
         }
+        log("Leaving testRemoveOnFlush()");
+    }
+
+    private static void log(String msg) {
+        System.out.println(msg);
     }
 }
--- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetFlushInterval.java	Sun Sep 22 17:31:57 2019 +0200
+++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetFlushInterval.java	Mon Sep 23 09:16:05 2019 -0700
@@ -32,7 +32,7 @@
 
 /**
  * @test
- * @summary Tests RecordingStrream::setFlushInterval
+ * @summary Tests RecordingStream::setFlushInterval
  * @key jfr
  * @requires vm.hasJFR
  * @library /test/lib
@@ -53,7 +53,8 @@
                     r.close();
                     return;
                 }
-                System.out.println("Flush interval not set, was " + duration+ ", but expected " + expectedDuration);
+                System.out.println("Flush interval not set, was " + duration +
+                                   ", but expected " + expectedDuration);
             });
             r.start();
         }
--- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetSettings.java	Sun Sep 22 17:31:57 2019 +0200
+++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetSettings.java	Mon Sep 23 09:16:05 2019 -0700
@@ -35,7 +35,7 @@
 
 /**
  * @test
- * @summary Tests RecordingStrream::setSettings
+ * @summary Tests RecordingStream::setSettings
  * @key jfr
  * @requires vm.hasJFR
  * @library /test/lib
@@ -46,6 +46,7 @@
     @Name("LateBloomer")
     private final static class LateBloomer extends Event {
     }
+
     private static CountDownLatch lateBloomer = new CountDownLatch(1);
 
     public static void main(String... args) throws Exception {
--- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStart.java	Sun Sep 22 17:31:57 2019 +0200
+++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStart.java	Mon Sep 23 09:16:05 2019 -0700
@@ -77,6 +77,7 @@
     }
 
     private static void testStartTwice() throws Exception {
+        log("Entering testStartTwice()");
         CountDownLatch started = new CountDownLatch(1);
         try (RecordingStream rs = new RecordingStream()) {
             EventProducer t = new EventProducer();
@@ -98,9 +99,11 @@
                 // OK, as expected
             }
         }
+        log("Leaving testStartTwice()");
     }
 
     static void testStart() throws Exception {
+        log("Entering testStart()");
         CountDownLatch started = new CountDownLatch(1);
         try (RecordingStream rs = new RecordingStream()) {
             rs.onEvent(e -> {
@@ -114,9 +117,11 @@
             started.await();
             t.kill();
         }
+        log("Leaving testStart()");
     }
 
     static void testStartOnEvent() throws Exception {
+        log("Entering testStartOnEvent()");
         AtomicBoolean ISE = new AtomicBoolean(false);
         CountDownLatch startedTwice = new CountDownLatch(1);
         try (RecordingStream rs = new RecordingStream()) {
@@ -141,9 +146,11 @@
                 throw new AssertionError("Expected IllegalStateException");
             }
         }
+        log("Leaving testStartOnEvent()");
     }
 
     static void testStartClosed() {
+        log("Entering testStartClosed()");
         RecordingStream rs = new RecordingStream();
         rs.close();
         try {
@@ -152,6 +159,10 @@
         } catch (IllegalStateException ise) {
             // OK, as expected.
         }
+        log("Leaving testStartClosed()");
     }
 
+    private static void log(String msg) {
+        System.out.println(msg);
+    }
 }
--- a/test/jdk/jdk/jfr/api/consumer/security/TestStreamingFile.java	Sun Sep 22 17:31:57 2019 +0200
+++ b/test/jdk/jdk/jfr/api/consumer/security/TestStreamingFile.java	Mon Sep 23 09:16:05 2019 -0700
@@ -31,7 +31,7 @@
 
 /**
  * @test
- * @summary Test that a event file stream can't be opened without permissions
+ * @summary Test that an event file stream can't be opened without permissions
  * @key jfr
  * @requires vm.hasJFR
  * @library /test/lib
--- a/test/jdk/jdk/jfr/api/consumer/streaming/TestRemovedChunks.java	Sun Sep 22 17:31:57 2019 +0200
+++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestRemovedChunks.java	Mon Sep 23 09:16:05 2019 -0700
@@ -36,12 +36,12 @@
  * @key jfr
  * @requires vm.hasJFR
  * @library /test/lib
- * @run main/othervm jdk.jfr.api.consumer.streaming.TestFilledChunks
+ * @run main/othervm jdk.jfr.api.consumer.streaming.TestRemovedChunks
  */
 public class TestRemovedChunks {
     private final static CountDownLatch parkLatch = new CountDownLatch(1);
     private final static CountDownLatch removalLatch = new CountDownLatch(1);
-    private final static CountDownLatch IfeelFineLatch = new CountDownLatch(1);
+    private final static CountDownLatch IFeelFineLatch = new CountDownLatch(1);
 
     static class DataEvent extends Event {
         double double1;
@@ -67,7 +67,7 @@
 
             });
             s.onEvent(IFeelFine.class.getName(), e -> {
-                IfeelFineLatch.countDown();
+                IFeelFineLatch.countDown();
             });
             s.startAsync();
             emitData(15_000_000);
@@ -79,7 +79,7 @@
             removalLatch.countDown();
             IFeelFine i = new IFeelFine();
             i.commit();
-            await(IfeelFineLatch);
+            await(IFeelFineLatch);
         }
 
     }
--- a/test/jdk/jdk/jfr/api/consumer/streaming/TestRepositoryMigration.java	Sun Sep 22 17:31:57 2019 +0200
+++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestRepositoryMigration.java	Mon Sep 23 09:16:05 2019 -0700
@@ -68,6 +68,8 @@
                 }
             });
             es.startAsync();
+            System.out.println("Started es.startAsync()");
+
             try (Recording r = new Recording()) {
                 r.setFlushInterval(Duration.ofSeconds(1));
                 r.start();
@@ -76,6 +78,7 @@
                 e1.id = 1;
                 e1.commit();
                 event1.await();
+                System.out.println("Passed the event1.await()");
                 JcmdHelper.jcmd("JFR.configure", "repositorypath=" + newRepository.toAbsolutePath());
                 // Chunk in new repository
                 MigrationEvent e2 = new MigrationEvent();
@@ -83,6 +86,7 @@
                 e2.commit();
                 r.stop();
                 event2.await();
+                System.out.println("Passed the event2.await()");
                 // Verify that it happened in new repository
                 if (!Files.exists(newRepository)) {
                     throw new AssertionError("Could not find repository " + newRepository);
--- a/test/jdk/jdk/jfr/api/consumer/streaming/TestRepositoryProperty.java	Sun Sep 22 17:31:57 2019 +0200
+++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestRepositoryProperty.java	Mon Sep 23 09:16:05 2019 -0700
@@ -90,7 +90,7 @@
             r.start();
             String location = System.getProperty(JFR_REPOSITORY_LOCATION_PROPERTY);
             if (location == null) {
-                throw new AssertionError("Repository path should exit before JFR is initialized");
+                throw new AssertionError("Repository path should exist before JFR is initialized");
             }
             System.out.println("repository=" + location);
             Path p = Path.of(location);
@@ -104,7 +104,7 @@
     private static void testBeforeInitialization() {
         String location = System.getProperty(JFR_REPOSITORY_LOCATION_PROPERTY);
         if (location != null) {
-            throw new AssertionError("Repository path should exit before JFR is initialized");
+            throw new AssertionError("Repository path should not exist before JFR is initialized");
         }
     }
 }
--- a/test/jdk/jdk/jfr/api/event/TestEventDuration.java	Sun Sep 22 17:31:57 2019 +0200
+++ b/test/jdk/jdk/jfr/api/event/TestEventDuration.java	Mon Sep 23 09:16:05 2019 -0700
@@ -33,7 +33,7 @@
 
 /**
  * @test
- * @summary Test s that a duration is recorded.
+ * @summary Tests that a duration is recorded.
  * @key jfr
  * @requires vm.hasJFR
  * @library /test/lib