def main(argv): for ix in range(100): print argv[1], "starting pass ", ix with open("log%s_%s.txt" % (argv[1], ix), "wb") as f: try: subprocess.check_call( "ulimit -c unlimited; " + " ".join(["python"] + argv[2:]) + " 2> log%s_%s.txt > out%s_%s.txt" % (argv[1], ix, argv[1], ix), stderr=subprocess.STDOUT, shell=True ) except subprocess.CalledProcessError as e: print "ERRORS in log%s_%s.txt" % (argv[1],ix) print >> f, e.output
def startSubprocess(): self.process = subprocess.Popen(self.subprocessArguments, stdin=stdInRead, stdout=stdOutWrite, stderr=stdErrWrite, env=self.env) subprocessEvent.set()
def startProxyProcess(): self.proxyProcess = subprocess.Popen([ 'coffee', localProxyPath, '--user', credentials[0], '--password', credentials[1], '--server', relayEndpoint ], stdin=stdInRead, stdout=stdOutWrite, stderr=stdErrWrite) proxyEvent.set()
def testInMem(): val = subprocess.Popen( ['fora -e "1+2"'], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, #make sure we pass the script-setup environment variables down env=dict(os.environ)).communicate() if removeFirstLine(val[0]).lstrip().rstrip() == '3': return True print 'testInMem failed:', val return False
def runNodeTests(): exitCode = subprocess.call( "mocha --compilers coffee:coffee-script ufora/web/relay/server/unitTests/*", shell=True) return exitCode == 0
def runScript_(self, script): print print "Running %s" % script print "with a timeout of %s sec" % self.getTimeout(script) if sys.platform == 'linux2': directory, filename = os.path.split(script) args = [ sys.executable, "-u", '-c', "print 'started'; execfile('%s')" % filename ] with DirectoryScope(directory): tries = 0 runner = None while tries < 5 and runner is None: startedEvent = threading.Event() def printOutput(line): if line == 'started': startedEvent.set() print "Script %s started" % filename else: print "OUT> %s\n" % line, def printErr(line): print "ERR> %s\n" % line, runner = SubprocessRunner.SubprocessRunner( args, printOutput, printErr, self.envVars) runner.start() startedEvent.wait(5) if not startedEvent.isSet(): runner.terminate() runner = None tries = tries + 1 print "Retrying script ", filename, " as python failed to start." if runner is None: print "Test %s failed to start a python process in 5 tries" % filename return False else: result = runner.wait(self.getTimeout(script)) if result is None: try: runner.terminate() except: print "Failed to terminate test runner: ", traceback.format_exc( ) print "Test %s timed out" % filename, return False runner.stop() if result != 0: print "Test %s failed" % filename, return False return True else: subprocess.check_call('cd "%s" & c:\python27\python.exe %s ' % os.path.split(script), shell=True) return True
def runNodeTests(): exitCode = subprocess.call( "mocha --compilers coffee:coffee-script ufora/web/relay/server/unitTests/*", shell=True ) return exitCode == 0
def runScript_(self, script): print print "Running %s" % script print "with a timeout of ", self.getTimeout(script) if sys.platform == 'linux2': directory, filename = os.path.split(script) genCore = os.path.abspath('generateCore.gdb') args = [sys.executable, "-u", '-c', "print 'started'; execfile('%s')" % filename] with DirectoryScope(directory): tries = 0 runner = None while tries < 5 and runner is None: startedEvent = threading.Event() def printOutput(line): if line == 'started': startedEvent.set() print "Script %s started" % filename else: print "OUT> %s\n" % line, def printErr(line): print "ERR> %s\n" % line, runner = SubprocessRunner.SubprocessRunner( args, printOutput, printErr, self.envVars ) runner.start() startedEvent.wait(5) if not startedEvent.isSet(): runner.terminate() runner = None tries = tries + 1 print "Retrying script ", filename, " as python failed to start." if runner is None: print "Test %s failed to start a python process in 5 tries" % filename return False else: result = runner.wait(self.getTimeout(script)) if result is None: try: runner.terminate() except: print "Failed to terminate test runner: ", traceback.format_exc() print "Test %s timed out" % filename, return False runner.stop() if result != 0: print "Test %s failed" % filename, return False return True else: subprocess.check_call('cd "%s" & c:\python27\python.exe %s ' % os.path.split(script), shell = True ) return True