Minor cleanups in finalizer timeout tests
Improve comments and don't ignore unexpected interrupts.
Test: Treehugger
Change-Id: I341d7c9085a9d9cc3e26cc9a2a65f0a5b859f5c7
diff --git a/test/030-bad-finalizer/src/Main.java b/test/030-bad-finalizer/src/Main.java
index f33b3aa..bdc2b41 100644
--- a/test/030-bad-finalizer/src/Main.java
+++ b/test/030-bad-finalizer/src/Main.java
@@ -21,8 +21,10 @@
/**
* Test a class with a bad finalizer.
*
- * This test is inherently flaky. It assumes that the system will schedule the finalizer daemon
- * and finalizer watchdog daemon enough to reach the timeout and throwing the fatal exception.
+ * This test is inherently very slightly flaky. It assumes that the system will schedule the
+ * finalizer daemon and finalizer watchdog daemon soon and often enough to reach the timeout and
+ * throw the fatal exception before we time out. Since we build in a 100 second buffer, failures
+ * should be very rare.
*/
public class Main {
public static void main(String[] args) throws Exception {
@@ -76,6 +78,7 @@
try {
Thread.sleep(ms);
} catch (InterruptedException ie) {
+ System.out.println("Unexpected interrupt");
}
}
diff --git a/test/1336-short-finalizer-timeout/src/Main.java b/test/1336-short-finalizer-timeout/src/Main.java
index 1a28a64..3f024b1 100644
--- a/test/1336-short-finalizer-timeout/src/Main.java
+++ b/test/1336-short-finalizer-timeout/src/Main.java
@@ -22,7 +22,8 @@
* Test a class with a bad finalizer in an environment with a short finalizer timeout.
*
* This test is inherently flaky. It assumes that the system will schedule the finalizer daemon
- * and finalizer watchdog daemon enough to reach the timeout and throwing the fatal exception.
+ * and finalizer watchdog daemon soon and often enough to reach the timeout and throw the fatal
+ * exception before we time out here.
* Largely cloned from 030-bad-finalizer.
*/
public class Main {
@@ -49,7 +50,7 @@
snooze(9800);
// We should not get here, since it should only take 5.5 seconds for the timed out
- // fiinalizer to kill the process.
+ // finalizer to kill the process.
System.out.println("UNREACHABLE");
System.exit(0);
}