Get test target building
Add flags for the test target
Add test for threaded access to the context

This test doesn't always cause a crash, it happens usually once in every three times.
Add a fix for threaded access to the context

Fixes the case when the context is accessed from two (or more) threads for the first time, causing the setup process to fire and collide when setting up the persistent store coordinator.