This is the mail archive of the mauve-discuss@sources.redhat.com mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Thread.contextClassLoader test make unsafe timingassumption


While trying to track down some intermittent test failures in recent
kaffe I found a problem in
gnu/testlet/java/lang/Thread/contextClassLoader.java. When testing that
context class loaders gets inherited correctly the mauve test assumes
that the first thread will complete before the data is set up for the
next one. When new thread execution for some reason is slow the test
will sometimes fail.

The attached patch solves the problem by waiting for the first thread to
finish before the next one is set up.

/noa
? mauve-threadfix.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/mauve/mauve/ChangeLog,v
retrieving revision 1.675
diff -u -r1.675 ChangeLog
--- ChangeLog	23 Sep 2004 20:11:27 -0000	1.675
+++ ChangeLog	25 Sep 2004 08:23:19 -0000
@@ -1,3 +1,8 @@
+2004-09-25  Noa Resare  <noa@resare.com>
+
+	* gnu/testlet/java/lang/Thread/contextClassLoader.java:
+	Wait for test threads to finish before continuing.
+
 2004-09-23  David Daney  <ddaney@avtrex.com>
 
 	* gnu/testlet/java/net/URL/URLTest.java: Add tests for getUserInfo().
Index: gnu/testlet/java/lang/Thread/contextClassLoader.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/lang/Thread/contextClassLoader.java,v
retrieving revision 1.2
diff -u -r1.2 contextClassLoader.java
--- gnu/testlet/java/lang/Thread/contextClassLoader.java	12 Apr 2004 11:44:39 -0000	1.2
+++ gnu/testlet/java/lang/Thread/contextClassLoader.java	25 Sep 2004 08:23:29 -0000
@@ -51,6 +51,7 @@
 	checkClassLoader = t_cl;
 	check_msg = "Run with default contextClassLoader";
 	t.start();
+	t.join();
 	
 	current.setContextClassLoader(null);
 	harness.check(current.getContextClassLoader() == null,
@@ -62,6 +63,7 @@
 	checkClassLoader = null;
 	check_msg = "run with null classloader";
 	t.start();
+	t.join();
       }
     finally
       {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]