Making testing play nicely when shared libraries are used