Moved some more code into common, notably some utility functions for the
test runner.