func main() { … } // configureAndRunWithEnv uses the given environment to configure and then start the test run. // It will handle TERM signals gracefully and kill the test process and will // save the logs/results to the location specified via the RESULTS_DIR environment // variable. func configureAndRunWithEnv(env Getenver) error { … } // setupSigHandler will kill the process identified by the given PID if it // gets a TERM signal. func setupSigHandler(pid int) { … } // saveResults will tar the results directory and write the resulting tarball path // into the donefile. func saveResults(resultsDir string) error { … }