def clean(self): """ Remove the temporary dir that was created. This is also called by the destructor. """ if self.name and os.path.exists(self.name): utils.safe_rmdir(self.name) self.name = None
logging.info("------------- End of test output ------------") if migrate_background and bg: bg.join() # Do some cleanup work on host if test need a server. if server_process: if server_process.is_alive(): utils_misc.kill_process_tree(server_process.get_pid(), signal.SIGINT) server_process.close() # Remove the result dir produced by server_process. server_result = os.path.join(autotest_path, "results", os.path.basename(server_control_path)) if os.path.isdir(server_result): utils.safe_rmdir() # Remove the control file for server. if os.path.exists(server_control_path): os.remove(server_control_path) except aexpect.ShellTimeoutError: if vm.is_alive(): get_results(destination_autotest_path) get_results_summary() raise error.TestError("Timeout elapsed while waiting for job to " "complete") else: raise error.TestError("Autotest job on guest failed " "(VM terminated during job)") except aexpect.ShellProcessTerminatedError: get_results(destination_autotest_path)
def _cleanup_results_dir(self): """Delete everything in resultsdir""" assert os.path.exists(self.resultdir) utils.safe_rmdir(self.resultdir) os.mkdir(self.resultdir)