Fixed up test infrastructure somewhat; corrected some build errors.