def iterate_pass(current_pass, path): state = current_pass.new(path) while state != None: (result, state) = current_pass.transform(path, state, ProcessEventNotifier(None)) if result == PassResult.OK: state = current_pass.advance_on_success(path, state) else: state = current_pass.advance(path, state)
def run_test(self, verbose): try: os.chdir(self.folder) stdout, stderr, returncode = ProcessEventNotifier(self.pid_queue).run_process(self.test_script, shell=True) if verbose and returncode != 0: logging.debug('stdout:\n' + stdout) logging.debug('stderr:\n' + stderr) finally: os.chdir(self.pwd) return returncode
def run(self): try: # transform by state (result, self.state) = self.transform(self.test_case_path, self.state, ProcessEventNotifier(self.pid_queue)) self.result = result if self.result != PassResult.OK: return self # run test script self.exitcode = self.run_test(False) return self except OSError: # this can happen when we clean up temporary files for cancelled processes return self except Exception as e: print('Unexpected TestEnvironment::run failure: ' + str(e)) traceback.print_exc() return self
def setUp(self): self.pass_ = IfPass(external_programs={'unifdef': 'unifdef'}) self.process_event_notifier = ProcessEventNotifier(None)