Move test prep logic out of Makefile and into runtests.sh.