本文整理汇总了Python中TestLib类的典型用法代码示例。如果您正苦于以下问题:Python TestLib类的具体用法?Python TestLib怎么用?Python TestLib使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestLib类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: bridgeTests
def bridgeTests(slot, num_tests, verbosity=0):
passed = 0
failed = 0
neither = 0
print '## Number of Tests: '+str(num_tests)
for test in xrange(num_tests):
print '\n### Bridge Test: '+str(test)+' ###'
print '\n### Test Name: '+str(bridgeDict[test]['name'])
function = bridgeDict[test]['function']
address = bridgeDict[test]['address']
num_bytes = bridgeDict[test]['bits']/8
message = t.readRegisterBridge(slot, address, num_bytes)
print '\n*********** RAW MESSAGE :'+str(t.reverseBytes(message))+'\n'
result = function(message)
if result == 'PASS':
passed += 1
elif result == 'FAIL':
failed += 1
else:
print 'Neither PASS Nor FAIL'
neither += 1
if verbosity:
print 'Register Name: '+str(bridgeDict[test]['name'])
print 'Register Value: '+str(message)
print 'Test Result: '+str(result)
test_list = [passed, failed, neither]
return test_list
示例2: writeIgloo
def writeIgloo(rm,slot,address,messageList):
t.openRM(b,rm)
b.write(0x00,[0x06])
b.write(t.bridgeAddress(slot),[0x11,0x03,0,0,0])
b.write(0x09,[address] + messageList)
message = b.sendBatch()[-1]
return t.reverseBytes(message)
示例3: runIglooTests
def runIglooTests(rmList, slotList, testList, verbosity=0):
print '\n\nBRIDGE TEST\n\n'
total_passed = 0
total_failed = 0
total_neither = 0
num_slots = len(slotList)
num_tests = len(testList)
total_number_tests = num_slots * num_tests
total_test_list = [total_passed, total_failed, total_neither]
for rm in rmList:
t.openRM(b,rm)
print '\n-------------------- Test RM: ', rm, ' --------------------'
for slot in slotList[4-rm]:
# Reset all devices!
b.write(0x00,[0x06]) # also present in readRegisterIgloo.
print '\n-------------------- Test Slot: ', slot, ' --------------------'
test_list = iglooTests(slot,testList,verbosity)
total_test_list = map(add, total_test_list, test_list)
# daisyChain = q.qCard(webBus("pi5",0), t.bridgeAddress(slot))
# print '\n~~~~~~~~~~ QIE Daisy Chain ~~~~~~~~~~'
# print str(daisyChain)
if verbosity:
print '\nNumber passed = ', test_list[0]
print 'Number failed = ', test_list[1]
print 'Number neither pass nor fail = ', test_list[2], '\n'
# Print Final Test Results for Bridge FPGA
print '\n\n######## Final Test Results ########\n'
print 'Total Number of Tests = ', total_number_tests
print 'Number passed = ', total_test_list[0]
print 'Number failed = ', total_test_list[1]
print 'Number neither pass nor fail = ', total_test_list[2]
print 'Check total number of tests: ', total_number_tests == sum(total_test_list), '\n'
示例4: runBridgeTests
def runBridgeTests(RMList, num_slots, num_tests, verbosity=0):
print '\n\nBRIDGE TEST\n\n'
total_passed = 0
total_failed = 0
total_neither = 0
total_number_tests = num_slots * num_tests
total_test_list = [total_passed, total_failed, total_neither]
for rm in RMList:
t.openRM(rm)
print '\n-------------------- Test RM: '+str(rm)+' --------------------'
for slot in xrange(num_slots):
b.write(0x00,[0x06])
print '\n-------------------- Test Slot: '+str(slot)+' --------------------'
test_list = bridgeTests(slot,num_tests)
total_test_list = map(add, total_test_list, test_list)
daisyChain = q.qCard(webBus("pi5",0), q.QIEi2c[slot])
print '\n~~~~~~~~~~ QIE Daisy Chain ~~~~~~~~~~'
print str(daisyChain)
if verbosity:
print '\nNumber passed = '+str(test_list[0])
print 'Number failed = '+str(test_list[1])
print 'Number neither pass nor fail = '+str(test_list[2])+'\n'
# Print Final Test Results for Bridge FPGA
print '\n\n######## Final Test Results ########\n'
print 'Total Number of Tests = '+str(total_number_tests)
print 'Number passed = '+str(total_test_list[0])
print 'Number failed = '+str(total_test_list[1])
print 'Number neither pass nor fail = '+str(total_test_list[2])
print 'Check total number of tests: '+str(total_number_tests == sum(total_test_list))+'\n'
示例5: iglooReg
def iglooReg(bus,rm,slot,address,nbytes):
t.openRM(rm)
bus.write(0x00,[0x06])
bus.write(t.bridgeAddress(slot),[0x11,0x03,0,0,0])
bus.write(0x09,[address])
bus.read(0x09,nbytes)
return bus.sendBatch()
示例6: readIgloo
def readIgloo(slot, address, num_bytes):
b.write(0x00,[0x06])
b.write(t.bridgeAddress(slot),[0x11,0x03,0,0,0])
b.write(0x09,[address])
b.read(0x09, num_bytes)
message = b.sendBatch()[-1]
return t.reverseBytes(message)
示例7: qieDaisyChain0
def qieDaisyChain0(message):
hex_message = t.toHex(message,1)
print 'int message: '+str(message)
print 'hex message:'+str(hex_message)
split_message = t.splitMessage(hex_message,6)
for i in xrange(len(split_message)):
print 'QIE '+str(i+1)+': '+str(split_message[i])
return hex_message
示例8: getSerial
def getSerial(self):
if int(self.raw.split()[1]) != 0x70:
print 'Not in Family 0x70'
return 'Family_Code_Error'
serial = t.serialNum(self.raw) # cereal
oats = t.reverse(serial) # reversed
eggs = t.toHex(oats) # hex
return eggs
示例9: qieDaisyChain0
def qieDaisyChain0(message):
hex_message = t.toHex(message,1)
print 'int message: ', message
print 'hex message:', hex_message
split_message = t.splitMessage(hex_message,6)
for i in xrange(len(split_message)):
print 'QIE ',i+1,': ',split_message[i]
return hex_message
示例10: run
def run(rmList,slotList,iterations,delay,verbosity=0):
for rm in rmList:
t.openRM(bus,rm)
for slot in slotList[4-rm]:
print '\n--- RM: ',rm,' Slot: ',slot,'---\n'
for key in triggerDict:
# for hold in triggerDict[key]:
hold = 'nohold'
print '\n-----\n',key, ' ', hold,'\n-----\n'
readManyTemps(slot,iterations,key,hold,delay,verbosity)
示例11: zeroOrbits
def zeroOrbits(rm,slot):
# Check for zeros for all oribts but [71:48] (bin 3 of 7)
# This nonzero bin is address 0x1D
zeroOrbitRegisters = [0x19,0x1A,0x1B,0x1C,0x1E,0x1F]
t.openRM(b,rm)
for address in zeroOrbitRegisters:
message = readBridge(slot,address,3)
if t.getValue(message) != 0:
print 'Nonzero orbit error!'
return False
return True
示例12: control_reg_orbit_histo
def control_reg_orbit_histo(rm,slot,delay):
# Return value of [71:48] (bin 3 of 7)
# This nonzero bin is address 0x1D
writeBridge(rm,slot,0x18,[2,0,0,0])
writeBridge(rm,slot,0x18,[1,0,0,0])
time.sleep(delay)
writeBridge(rm,slot,0x18,[0,0,0,0])
# runBridgeTests([rm],t.getSlotList(rm,slot),range(16,24),0)
t.openRM(b,rm)
message = readBridge(slot, 0x1D, 3)
value = t.getValue(message)
return value
示例13: onesZeroes
def onesZeroes(message):
correct_value = '0xaaaaaaaa'
hex_message = t.toHex(message,0)
print 'correct value: '+str(correct_value)
print 'int message: '+str(message)
print 'hex message: '+str(hex_message)
return passFail(hex_message==correct_value)
示例14: zeroes
def zeroes(message):
correct_value = '0x00000000'
hex_message = t.toHex(message,0)
print 'correct value: ', correct_value
print 'int message: ', message
print 'hex message: ', hex_message
return passFail(hex_message==correct_value)
示例15: check
def check(bus, rmList, slotList):
for rm in rmList:
t.openRM(bus, rm)
for slot in slotList[4 - rm]:
print "\nUnique ID"
uniqueID = ID(bus, slot)
print uniqueID.raw
print uniqueID.cooked
check = Checksum(uniqueID.raw, 0)
print "result = ", check.result
if check.result == 2:
print "i2c error"
if check.result == 1:
print "checksum error"
if check.result == 0:
print "checksum ok"