def test_socket(cmd_list): logging.info('Running %s' % ' '.join([str(x) for x in cmd_list])) process = subprocess.Popen(cmd_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = process.communicate() log_multilines(logging.info, stdout) log_multilines(logging.info, stderr) if process.returncode != 0: raise TestFailureError('Test failed with exit code %s' % str(process.returncode), process.returncode) return stdout, stderr
def test_shield(cmd_list): server = ThreadedHTTPServer() server.start() logging.info('Running %s' % ' '.join([str(x) for x in cmd_list])) process = subprocess.Popen(cmd_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = process.communicate() server.stop() log_multilines(logging.info, stdout) log_multilines(logging.info, stderr) if process.returncode != 0: raise TestFailureError('Test failed with exit code %s' % str(process.returncode), process.returncode) return stdout, stderr
def test_serial (cmd_list, m_name, s_name): master = Serial ('\\\\.\\%s' % m_name, timeout = 0) listen_thread = Listener (master, write, read) listen_thread.daemon = True listen_thread.start () cmd_to_run = cmd_list + [s_name] logging.info ('Running %s' % ' '.join ([str (x) for x in cmd_to_run])) process = subprocess.Popen (cmd_to_run, stdout = subprocess.PIPE, stderr = subprocess.PIPE) stdout, stderr = process.communicate () log_multilines (logging.info, stdout) log_multilines (logging.info, stderr) master.close () if process.returncode != 0: raise TestFailureError ('Test failed with exit code %s' % str (process.returncode), process.returncode) return stdout, stderr