def __init__(order,orderid): global dut print "the test order %s is initing..."%orderid order.orderid=orderid order.failedcases={} order.passedcases=[] order.remainingcases=[] order.starttime=datetime.datetime.now().strftime('%Y_%m_%d_%H_%M_%S') order.endtime='' order.tester='test' order.testerid=11 order.testtype='vw' order.clientlist=[] order.client_location=[] order.clientIP={} order.xangle='' dut['swbuild_id'],dut['product_id'],order.testbed,order.testplan,order.clientlist,order.client_location,order.xangle,order.clientIP,dut['APModel'],dut['APSWVersion'],order.caselist,dut['IP'],dut['NumTxAntennas'],dut['NumTxAntennas5G']=TMS2.getixchorder(orderid) order.totalcases=len(order.caselist) order.remainingcases=order.caselist[:] #order.backupfilename='%s_%s_%s_%s_on_%s'%(dut['APModel'],dut['APSWVersion'],order.orderid,order.starttime) order.backupfilename='testorder_%s_%s_%s_%s_on_%s'%(order.orderid,dut['APModel'],dut['APSWVersion'],order.starttime) order.backupdir='resultbackup%s%s'%(os.sep,order.backupfilename) print order.backupdir #winbackupdir='c:\\ixch'+order.backupdir #print winbackupdir os.mkdir(order.backupdir,0755) #os.mkdir(winbackupdir) if order.testbed !=8 and order.testbed !=9: #what is ths for ixia or OTA print "Please choose the correct testbed, it should be the OTA Fisk or OTA chamber" sys.exit(1)
def run(order,toruncases): #order.starttime=datetime.datetime.now().strftime('%Y-%m-%d_%H:%M:%S') print "\n---------------------------------The test order %s begins at %s-----------------------"%(order.orderid,order.starttime) print 'Thread %s is running\n'%threading.current_thread().name for crcase in toruncases[:]: #print 'rem:',curorder.remainingcases,'total:',curorder.caselist active_status=TMS2.getrunningstatus(order.orderid) if not active_status: print "The test order %s has been stop by the server" break match=re.search(r'^(\d{1,4})\s(\d+)',crcase) if not match: print 'Not matched, the format of testcase is not correct, can not generate the tclfile' order.failedcases[crcase]= "The test case is not in database" #order.remainingcases.remove(crcase) else: #order.remainingcases.remove(crcase) order.passedcases.append(crcase) print match.group(1),match.group(2) cur_case=iccase(match.group(1),match.group(2)) #print order.clientIP if cur_case.isInited(): for curclient in order.clientlist: print 'curclient:',curclient curclientinfo=order.clientIP[curclient] if cur_case.radio != curclientinfo['radio']: print 'The current case radio is different, skip this client-------------------\n' else: print '\n-----radio',cur_case.radio,curclientinfo['radio'],'clientID',curclientinfo['clientid'],'\n clientIP',curclientinfo['A'],'------' cur_case.clientID=curclientinfo['clientid'] if order.testbed ==9: cur_case.location=['A','B','C','D','E'] elif order.testbed ==8: cur_case.location=['A','B','C','D','E'] else: print "wrong testbed" sys.exit(0) if cur_case.radio=='2.4GHz': cur_case.endpoint_2G['A']=curclientinfo['A'] if order.testbed == 8: cur_case.endpoint_2G['B']=curclientinfo['B'] cur_case.endpoint_2G['C']=curclientinfo['C'] cur_case.endpoint_2G['D']=curclientinfo['D'] cur_case.endpoint_2G['E']=curclientinfo['E'] elif cur_case.radio=='5GHz': cur_case.endpoint_5G['A']=curclientinfo['A'] if order.testbed == 8: cur_case.endpoint_5G['B']=curclientinfo['B'] cur_case.endpoint_5G['C']=curclientinfo['C'] cur_case.endpoint_5G['D']=curclientinfo['D'] cur_case.endpoint_5G['E']=curclientinfo['E'] else: print "not supported" cur_case.creatclonefile() if order.xangle!=0: for iangle in range(order.xangle): cur_case.xangle=[0,90,180,270][iangle] #setangle_success=ixchorder.iturntable.setangle(cur_case.xangle) time.sleep(10) if not setangle_success: print " Failed to set the turntable angle, the system exit" break #print 'order.client:',order.client cur_case.go(curclient, order.client_location) cur_case.uploadresult(order,dut,tms_server) print cur_case.result_pdf,'\n',cur_case.result_csv,'\n',cur_case.result_tst #for angleindex in range(order.xangle): #cur_case.xangle=ixchorder.iturntable.angle[angleindex] # #print " Failed to set the turntable angle, the system exit" #sys.exit(0) else: print iangle,[0,90,180,270][iangle] #print ixchorder.iturntable[0] #print curclientinfo case.location=['A','B','C','D','E'] case.clientID='2' #print 'curclient:',curclient,'radio',curclient,'clientID',curclientinfo['clientid'],'A:',curclientinfo['A'],'E:',curclientinfo['E'] #case_i.dealresult(dut,'./tmpresult','./tmpresult') #case_i.uploadresult(testorder,dut,tms_server) print 'Failinfo',cur_case.Failinfo if not cur_case.Failinfo: print 'pass' else: print 'fail' else: print "the case failed"