[patch] Refactor out test running logic to separate script.