Fixes and testing infrastructure for running programs in tests.