tags:

views:

158

answers:

3

Hi

I'm using Galileo Eclipse on Ubuntu running inside a VirtualBox VM hosted on Windows XP.

Eclipse is running under JDK 1.5 ( via the -vm command line switch )

The project that I am working with runs under JDK 1.3 ( set via the Build Path )

When I run a unit test from within eclipse ( by right clicking the source file and doing "Run as Junit Test"), the test seems to run properly, except it never finishes. The progress bar moves right across to its fullest extent, and the jUnit window gives a strong indication that it has finished, but if I go in to the Debug perspective I can see that the junit process is still running and the only think I can do is to terminate it manually.

If I change the project VM to java 1.5, then the tests work successfully.

If I run the tests from the command line using the "normal" junit textui runner, they work successfully.

Has anyone come across before, or can suggest a workaround? I've not turned up much on my own Google attempts.

Thanks

dave

A: 

Do you really, really need JDK 1.3? If so, you may consider running your unit tests as Ant tasks rather than through the shiny Eclipse GUI.

Carl Smotricz
You can eliminate ant or maven or what-have-you as well: JUnit runs just fine from the cmdline. However, the point stands: @davehowes: does it show the same behaviour if you run the test from the cmdline?
Confusion
Unfortunately I do - ant just isn't as convenient, but I suppose I may have to go for it.
@Confusion: the tests do run fine from the command line, it's just less convenient. The problem appears to be related to the eclipse RemoteTestRunner class - I haven't been able to force a stack dump, but I have a feeling that the communication between the unit test and eclipse itself ( via a socket ) is hanging.
The reason I recommend Ant is that Ant task starting is already built into Eclipse, so it's almost as convenient. Output is captured into an Eclipse console, too. IMO this beats jumping out into a cold, dark shell.
Carl Smotricz
A: 

It could be that a thread is left running for some reason, preventing the VM from terminating (perhaps a bug in the 1.3 VM; or a change in behaviour in later versions). Run the unit tests in debug mode to inspect the process.

McDowell
I've re-run the test in debug mode and I'm left with one process - 2 threads - still running. Thread Main is hanging in BufferedReader.close(), while Thread ReaderThread is in SocketInputStream.socketRead - ( a native method ). From the look of the stack, it would appear they both have a reference to the same BufferedReader instance and I wonder if there is some lock contention going on. But this is getting very close to the limit of my knowledge ...
A: 

Click on the test class -> properties -> run/debug settings select the test class and click on "Edit..." Then un-check "Keep JUnit running after ..."

edmiikk grumble