Factor out most of the regression test to separate script