Teach rake test tasks how to re-run failed tests

@wedaly @nedbat: Review?