def twoTests(zebra):
    print "Downloading defaults..."
    zebra.uploadFile(
        os.path.realpath(
            os.path.join(__file__, "..", "configs", "defaults.ini")))
    zebra.save()
    toterrors = 0
    for test, mismatch, match in (("unplugged", "OK", "BAD"), ("plugged in",
                                                               "BAD", "OK")):
        raw_input(
            "Ensure signal cables are %s and press return to run hardware tests."
            % test)
        repeat = "y"
        while repeat.lower() == "y":
            print "Doing hardware test with cables %s..." % test
            errors = doHardwareTest(zebra, mismatch=mismatch, match=match)
            repeat = raw_input("Repeat 'cable %s' test? (y/n): " % test)
        toterrors += errors
    print "Hardware test complete: %d Errors" % toterrors


if __name__ == "__main__":
    repeat = "y"
    while repeat.lower() == "y":
        if raw_input(
                "Would you like to test firmware? (y/n): ").lower() == "y":
            print "Testing firmware..."
            zebraFirmwareTest.main()
        twoTests(zebraTool("/dev/ttyUSB0"))
        repeat = raw_input("Test another zebra? (y/n): ")
 def setUp(self):
     self.zebra = zebraTool(self.portstr)
     for k, v in self.initial.items():
         self.zebra.writeReg(k % dict(name=self.name), v)
     self.zebra.reset()                    
Exemple #3
0
 def setUp(self):
     self.zebra = zebraTool(self.portstr)
     for k, v in self.initial.items():
         self.zebra.writeReg(k % dict(name=self.name), v)
     self.zebra.reset()
            os.path.join(__file__, "..", "configs", "defaults.ini")))
    zebra.save()
    toterrors = 0
    for test, mismatch, match in (("unplugged", "OK", "BAD"), ("plugged in",
                                                               "BAD", "OK")):
        raw_input(
            "Ensure signal cables are %s and press return to run hardware tests."
            % test)
        repeat = "y"
        while repeat.lower() == "y":
            print "Doing hardware test with cables %s..." % test
            errors = doHardwareTest(zebra, mismatch=mismatch, match=match)
            repeat = raw_input("Repeat 'cable %s' test? (y/n): " % test)
        toterrors += errors
    print "Hardware test complete: %d Errors" % toterrors


if __name__ == "__main__":
    repeat = "y"
    portstr = "/dev/ttyUSB0"
    tool = zebraTool(portstr)
    while repeat.lower() == "y":
        version = tool.readReg("SYS_VER")
        print "Zebra connected with firmware version 0x%X" % version
        if raw_input(
                "Would you like to test firmware? (y/n): ").lower() == "y":
            print "Testing firmware..."
            zebraFirmwareTest.main(portstr)
        twoTests(tool)
        repeat = raw_input("Test another zebra? (y/n): ")
            print ret
        zebra.writeReg("OUT%d_CONN" % i, "DISCONNECT")
            
    return errors


def twoTests(zebra):
    print "Downloading defaults..."
    zebra.uploadFile(os.path.realpath(os.path.join(__file__, "..", "configs", "defaults.ini")))
    zebra.save()        
    toterrors = 0
    for test, mismatch, match in (("unplugged", "OK", "BAD"),
                                  ("plugged in", "BAD", "OK")):  
        raw_input("Ensure signal cables are %s and press return to run hardware tests." % test)
        repeat = "y"
        while repeat.lower() == "y":        
            print "Doing hardware test with cables %s..." % test
            errors = doHardwareTest(zebra, mismatch=mismatch, match=match)
            repeat = raw_input("Repeat 'cable %s' test? (y/n): " % test)
        toterrors += errors
    print "Hardware test complete: %d Errors" % toterrors
    
if __name__=="__main__":
    repeat = "y"
    while repeat.lower() == "y":
        if raw_input("Would you like to test firmware? (y/n): ").lower() == "y":
            print "Testing firmware..."         
            zebraFirmwareTest.main()
        twoTests(zebraTool("/dev/ttyUSB0") )
        repeat = raw_input("Test another zebra? (y/n): ")