def execTests(self, env, tag=None): #launch test suite try: #subprocess.check_call("bash setup-test-data.sh -t integration/smoke -m %s -p password -d %s -h xen"%(mgmtHostInfo['ip'],mgmtHostInfo['ip']),shell=True) self.logger.info("Launching integration tests after a sleep") #time.sleep(300) self.logger.info("%s/nosetests-2.7 -v --with-marvin --marvin-config=%s -w ./test/integration/smoke --load --with-xunit %s"%(pythonPath,marvin_config,("" if tag==None else "-a tag=%s"%tag))) subprocess.check_out("%s/nosetests-2.7 -v --with-marvin --marvin-config=%s -w ./test/integration/smoke --load --with-xunit %s"%(pythonPath,marvin_config,("" if tag==None else "-a tag=%s"%tag)),shell=True) except Exception, e: self.info.error(e)
def execTests(self, env, noOfExecutors, tag = None): try: testMgr = testManager(testSpecifierString, env['virtenvPath']) tests = testMgr.getTests() while tests is not None: if tests.__len__() < noOfExecutors: noOfExecutors = tests.__len__() pool = Pool(processes=noOfExecutors) self.logger.info('Launching integration tests after a sleep') self.logger.info('%s/nosetests-2.7 -v --with-marvin --marvin-config=%s -w ./test/integration/smoke --load --with-xunit %s' % (pythonPath, marvin_config, '' if tag == None else '-a tag=%s' % tag)) subprocess.check_out('%s/nosetests-2.7 -v --with-marvin --marvin-config=%s -w ./test/integration/smoke --load --with-xunit %s' % (pythonPath, marvin_config, '' if tag == None else '-a tag=%s' % tag), shell=True) except Exception as e: self.info.error(e)
def run_command(command): # command = command.rstrip() # try: output = subprocess.check_out(command,stderr=subprocess.STDOUT,shell=True) except: output = "Failend to execute command.\r\n" # return output
def run_command(command): # trim the newline command = command.rstrip() # run the command and get the output back try: output = subprocess.check_out(command, stderr=subprocess.STDOUT, shell=True) except: output = "Failed to execute command.\r\n" # send the output back to the client return output
def lsofdatthang: data = subprocess.check_out(["ps, aux"]) ws = [()]
# subprocess执行shell脚本 import subprocess output = subprocess.check_out('dir', shell=Tr) print(output) # 优于subprocess import os os.system('dir')
import subprocess, re #myout = subprocess.check_output("javac Exception/*java lexer/*java parser/*java parsingTokens/*java typeChecker/*java ir/*java optimization/*java", shell=True) #myout = subprocess.check_output("java ir.IrMain ../cg_tests/b_tc_test1.x3", shell=True) #myout = subprocess.check_output("cp out.c ../pa4-provided", shell=True) try: myout = subprocess.check_output("make -C ../pa4-provided", shell=True) print "crap" except: myout = subprocess.check_out("echo --- SCRIPT COMPLETED ---", shell=True) #myout = subprocess.check_output("", shell=True)
def find_file(file): return subprocess.check_out("find.-name '%s'" % file, shell=True).splitlines()
def run_spider(spider_main, spider_name): output = subprocess.check_out(['python', spider_main, '-n', spider_name], stderr=subprocess.STDOUT, shell=True) return output