/hg/icedtea-web: rewritten deadlock test
jvanek at icedtea.classpath.org
jvanek at icedtea.classpath.org
Tue Jun 19 03:15:25 PDT 2012
changeset 79bd211c37be in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=79bd211c37be
author: Jiri Vanek <jvanek at redhat.com>
date: Tue Jun 19 12:15:07 2012 +0200
rewritten deadlock test
diffstat:
ChangeLog | 11 +++
tests/jnlp_tests/simple/AppletTest/resources/appletAutoTests.html | 2 +-
tests/jnlp_tests/simple/deadlocktest/srcs/DeadlockTest.java | 6 +-
tests/jnlp_tests/simple/deadlocktest/testcases/DeadLockTestTest.java | 31 +++++++--
tests/netx/unit/net/sourceforge/jnlp/runtime/CodeBaseClassLoaderTest.java | 2 +
5 files changed, 43 insertions(+), 9 deletions(-)
diffs (136 lines):
diff -r 15ca40344c8c -r 79bd211c37be ChangeLog
--- a/ChangeLog Mon Jun 18 10:47:55 2012 -0400
+++ b/ChangeLog Tue Jun 19 12:15:07 2012 +0200
@@ -1,3 +1,14 @@
+2012-06-15 Jiri Vanek <jvanek at redhat.com>
+
+ * tests/jnlp_tests/simple/AppletTest/resources/appletAutoTests.html:
+ Added quotes around parameters of html applet tag.
+ * tests/jnlp_tests/simple/deadlocktest/testcases/DeadLockTestTest.java:
+ Output verification is counting with repeated and probably unfinished outputs.
+ * tests/jnlp_tests/simple/deadlocktest/srcs/DeadlockTest.java
+ Is now printing out sentence in intervals to avoid destroy-consume as much as possible
+ * tests/netx/unit/net/sourceforge/jnlp/runtime/CodeBaseClassLoaderTest.java:
+ Added bug annotation with threads on distro-pkg-dev
+
2012-06-15 Adam Domurad <adomurad at redhat.com>
Fixed two memory leaks
diff -r 15ca40344c8c -r 79bd211c37be tests/jnlp_tests/simple/AppletTest/resources/appletAutoTests.html
--- a/tests/jnlp_tests/simple/AppletTest/resources/appletAutoTests.html Mon Jun 18 10:47:55 2012 -0400
+++ b/tests/jnlp_tests/simple/AppletTest/resources/appletAutoTests.html Tue Jun 19 12:15:07 2012 +0200
@@ -36,7 +36,7 @@
-->
<html><head></head><body bgcolor="blue">
-<p><applet code="AppletTest.class" archive="XslowXAppletTest.jar" codebase="." width=800 height=600>
+<p><applet code="AppletTest.class" archive="XslowXAppletTest.jar" codebase="." width="800" height="600">
<param name="key1" value="value1">
<param name="key2" value="#value2">
</applet></p>
diff -r 15ca40344c8c -r 79bd211c37be tests/jnlp_tests/simple/deadlocktest/srcs/DeadlockTest.java
--- a/tests/jnlp_tests/simple/deadlocktest/srcs/DeadlockTest.java Mon Jun 18 10:47:55 2012 -0400
+++ b/tests/jnlp_tests/simple/deadlocktest/srcs/DeadlockTest.java Tue Jun 19 12:15:07 2012 +0200
@@ -42,11 +42,15 @@
public static void main(String[] args) throws Exception {
long startTime = System.nanoTime() / 1000000l;
System.out.println("Deadlock test started");
+ int i=0;
while (true) {
long now = System.nanoTime() / 1000000l;
- Thread.sleep(10);
+ Thread.sleep(3500);
+ i++;
+ System.out.println(i+" Deadlock sleeping");
if (now - startTime > DEADLOCK_TEST_TIME_OF_LIFE) {
System.out.println("This process is hanging more then "+DEADLOCK_TEST_TIME_OF_LIFE/1000+"s. Should be killed");
+ System.out.flush();
System.exit(5);
}
}
diff -r 15ca40344c8c -r 79bd211c37be tests/jnlp_tests/simple/deadlocktest/testcases/DeadLockTestTest.java
--- a/tests/jnlp_tests/simple/deadlocktest/testcases/DeadLockTestTest.java Mon Jun 18 10:47:55 2012 -0400
+++ b/tests/jnlp_tests/simple/deadlocktest/testcases/DeadLockTestTest.java Tue Jun 19 12:15:07 2012 +0200
@@ -62,28 +62,36 @@
@Test
public void testDeadLockTestTerminated() throws Exception {
testDeadLockTestTerminatedBody(deadlocktest);
+ testDeadLockTestTerminatedBody(deadlocktest);
+ ServerAccess.logOutputReprint("Currently running javas12 " + countJavaInstances());
}
@Test
public void testDeadLockTestTerminated2() throws Exception {
testDeadLockTestTerminatedBody(deadlocktest_1);
+ testDeadLockTestTerminatedBody(deadlocktest_1);
+ /**
+ * this happens, when p.p.destroy is called before p.interrupt. and destroyed variable is removedI have no idea why, but it is incorrect.
+ Assert.assertNotNull("return can not be null in no fork process. Was ",pr.returnValue);//in this case forking is forbiden, and sojava throws an exception after destroy
+ */
+ ServerAccess.logOutputReprint("Currently running javas13 " + countJavaInstances());
}
public void testDeadLockTestTerminatedBody(String jnlp) throws Exception {
List<String> before = countJavaInstances();
- ServerAccess.logOutputReprint("java1 "+jnlp+" : " + before.size());
+ ServerAccess.logOutputReprint("java1 " + jnlp + " : " + before.size());
ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, jnlp);
assertDeadlockTestLaunched(pr);
List<String> after = countJavaInstances();
- ServerAccess.logOutputReprint("java2 "+jnlp+" : " + after.size());
- String ss="This process is hanging more than 30s. Should be killed";
- Assert.assertFalse("stdout shoud not contains: "+ss+", but did",pr.stdout.contains(ss));
+ ServerAccess.logOutputReprint("java2 " + jnlp + " : " + after.size());
+ String ss = "This process is hanging more than 30s. Should be killed";
+ Assert.assertFalse("stdout should not contains: " + ss + ", but did", pr.stdout.contains(ss));
// Assert.assertTrue(pr.stderr.contains("xception"));, exception is thrown by engine,not by application
Assert.assertTrue("testDeadLockTestTerminated should be terminated, but wasn't", pr.wasTerminated);
- Assert.assertEquals(null, pr.returnValue);//killed process have no value
+ Assert.assertNull("Killed process must have null return value. Have not - ", pr.returnValue);
killDiff(before, after);
List<String> afterKill = countJavaInstances();
- ServerAccess.logOutputReprint("java3 "+jnlp+" : " + afterKill.size());
+ ServerAccess.logOutputReprint("java3 " + jnlp + " : " + afterKill.size());
Assert.assertEquals("assert that just old javas remians", 0, (before.size() - afterKill.size()));
}
@@ -191,7 +199,7 @@
}
public static void main(String[] args) throws Exception {
- ServerAccess.logOutputReprint(""+countJavaInstances());
+ ServerAccess.logOutputReprint("" + countJavaInstances());
}
private void assertDeadlockTestLaunched(ProcessResult pr) {
@@ -199,6 +207,15 @@
Assert.assertTrue("Deadlock test should print out " + s + ", but did not", pr.stdout.contains(s));
String ss = "xception";
Assert.assertFalse("Deadlock test should not stderr " + ss + " but did", pr.stderr.contains(ss));
+ //each 3500 seconds deadlock test stdout something
+ //timeout is 20s
+ //so it should write out FIVE sentences, but is mostly just three or four. Last is nearly always consumed by termination
+ for (int i = 1; i <= 3; i++) {
+ String sentence = i + " Deadlock sleeping";
+ Assert.assertTrue(
+ "stdout should contains: " + sentence + ", didn't, so framework have consumed to much during termination",
+ pr.stdout.contains(sentence));
+ }
}
private void waitForBackgroundDeadlock(final BackgroundDeadlock bd) throws InterruptedException {
diff -r 15ca40344c8c -r 79bd211c37be tests/netx/unit/net/sourceforge/jnlp/runtime/CodeBaseClassLoaderTest.java
--- a/tests/netx/unit/net/sourceforge/jnlp/runtime/CodeBaseClassLoaderTest.java Mon Jun 18 10:47:55 2012 -0400
+++ b/tests/netx/unit/net/sourceforge/jnlp/runtime/CodeBaseClassLoaderTest.java Tue Jun 19 12:15:07 2012 +0200
@@ -51,9 +51,11 @@
import net.sourceforge.jnlp.ServerAccess;
import net.sourceforge.jnlp.runtime.JNLPClassLoader;
import net.sourceforge.jnlp.runtime.JNLPClassLoader.CodeBaseClassLoader;
+import net.sourceforge.jnlp.annotations.Bug;
import org.junit.Test;
+ at Bug(id={"PR895","http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-March/017626.html","http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-March/017667.html"})
public class CodeBaseClassLoaderTest {
@Test
More information about the distro-pkg-dev
mailing list