refactor code to test builds in a new test_runner module

This is a first step for

https://bugzilla.mozilla.org/show_bug.cgi?id=999036