Don't mlock in tests

This series of commits first adds a (fairly restricted) mechanism for testing at runtime if code is in a unit test

It then adds a helper for using the mlock() syscall which throws an exception if mlock fails in anything that isn't a test

Finally it changes indy to use the new mlock wrapper.