Add build script for tests; add runtime checks for thread_cond