Partially revert r184225 test changes and make a smaller and more generic fix.