Compile test: Unify a lot of code into build_firmware()

The compiler tester is now feature complete.