Made spec_tests.py more DRY.

Factored test selection logic out of do_tests.
Eliminated do_tests, putting the (now very short) code into main.

Improves 1ba4822 @cirosantilli