views:

114

answers:

2

We have created a common threading framework to manage how we want to use threads in our applications. Are there any frameworks out there like gtest or cppunit that solely focus on unit testing threads, thread pools, thread queues, and such?

Right now I just kind of manually go through some steps that I know I should cover and do checks in the code to make sure that certain conditions are met (like values aren't corrupted b/c a shared resource was accessed simultaneously by two or more threads at once) If I'm not able to create definitive check, then I step through the debugger but this seems like it's testing in the 1990's.

I would like to more systematically test the functionality of the threading framework for it's internal functionality that might not be the same as all threading frameworks, but I also want to test common functionality that all threading frameworks should have (like not deadlocking, not corrupting data a.k.a counts are what they should be, etc ...).

Any suggestions would be greatly appreciated.

+1  A: 

If your threads are built on OpenMP, you can use VivaMP for static checking.

But you want dynamic checking with unit tests. I'm not aware of any existing framework for this purpose. You could roll your own with one of the many unit test frameworks out there, but it would be hard to make it robust. Intel has a suite of parallel development tools that might be of interest, but I've never used them. They say that they can help with unit tests from within Visual Studio.

mlimber
Intel Parallel Studio works well, but it's too bad it's $800+ to get a non-evaluation version.
Brian T Hannan
+1  A: 

If you write a threading library you have to debug it yourself. Threading libraries aren't as general purpose as general purpose programs =D so you won't find a specific unit testing framework for your specific problem :D

After that disclaimer though. If you were running on Solaris / OSX or FreeBSD.... dtrace would make it trivial to unit test your library.

Hassan Syed