In my quest for coding nirvana I came across the need to test parallel code correctly.
Current testing toolkits are rather scarce on this front. There is no thread management included with them.
Once I needed that all code would be tested under 2 conditions: threaded and serial.
I had to create a new revision with a lot of code changes. The way I wanted it to be would be through an implicit thread manager, that can be told to force the code to be serial.
So far I thought up a simple technique of enhancing Thread class by adding callbacks to constructors and start method. This technique actually works. All you need is to define a transformer by the means of Java 6.0 instrumentation functionality. And using ASM from Objectweb you can add hooks to Thread object, otherwise it is not allowed to redefine java.lang.* classes.
And I expect that someone will sometime find a way of adding more manageability to Threads during testing.
Therefore we could catch thread related bugs like race conditions etc...
Unfortunately wait method on Object is native, so it would be hard to control waiting aspect of testing...
Friday, August 17, 2007
Subscribe to:
Posts (Atom)
