當前位置: 首頁>>代碼示例>>Python>>正文


Python TestLib類代碼示例

本文整理匯總了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
開發者ID:BaylorCMS,項目名稱:NGCCMeFEC,代碼行數:28,代碼來源:bridge_test.py

示例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)
開發者ID:caleb-james-smith,項目名稱:QIETesting,代碼行數:7,代碼來源:igloo_test.py

示例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'
開發者ID:caleb-james-smith,項目名稱:QIETesting,代碼行數:33,代碼來源:igloo_test.py

示例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'
開發者ID:BaylorCMS,項目名稱:NGCCMeFEC,代碼行數:30,代碼來源:bridge_test.py

示例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()
開發者ID:caleb-james-smith,項目名稱:QIETesting,代碼行數:7,代碼來源:control_reg.py

示例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)
開發者ID:caleb-james-smith,項目名稱:QIETesting,代碼行數:7,代碼來源:igloo_test.py

示例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
開發者ID:BaylorCMS,項目名稱:NGCCMeFEC,代碼行數:8,代碼來源:bridge_test.py

示例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
開發者ID:caleb-james-smith,項目名稱:QIETesting,代碼行數:8,代碼來源:uniqueIDClass.py

示例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
開發者ID:caleb-james-smith,項目名稱:old_ngccm,代碼行數:8,代碼來源:bridge_test.py

示例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)
開發者ID:caleb-james-smith,項目名稱:QIETesting,代碼行數:10,代碼來源:temp.py

示例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
開發者ID:caleb-james-smith,項目名稱:QIETesting,代碼行數:11,代碼來源:bridge_test.py

示例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
開發者ID:caleb-james-smith,項目名稱:QIETesting,代碼行數:12,代碼來源:bridge_test.py

示例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)
開發者ID:BaylorCMS,項目名稱:NGCCMeFEC,代碼行數:7,代碼來源:bridge_test.py

示例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)
開發者ID:caleb-james-smith,項目名稱:old_ngccm,代碼行數:7,代碼來源:bridge_test.py

示例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"
開發者ID:caleb-james-smith,項目名稱:QIETesting,代碼行數:16,代碼來源:checkCRC.py


注:本文中的TestLib類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。