tests: gadget-zero: run against all attached targets

Less command line arguments, more automatic "do what I mean"
This commit is contained in:
Karl Palsson
2017-05-08 23:20:04 +00:00
parent ec1d2855b0
commit f594ddb395
2 changed files with 15 additions and 4 deletions

View File

@@ -10,6 +10,8 @@ import unittest
VENDOR_ID=0xcafe
PRODUCT_ID=0xcafe
# you only need to worry about these if you are trying to explicitly test
# a single target. Normally, the test will autofind the attached target
#DUT_SERIAL = "stm32f429i-disco"
DUT_SERIAL = "stm32f4disco"
#DUT_SERIAL = "stm32f103-generic"
@@ -385,5 +387,12 @@ class TestUnaligned(unittest.TestCase):
if __name__ == "__main__":
if len(sys.argv) > 1:
DUT_SERIAL = sys.argv.pop()
print("Running tests for DUT: ", DUT_SERIAL)
unittest.main()
print("Running tests for DUT: ", DUT_SERIAL)
unittest.main()
else:
# scan for available and try them all!
devs = usb.core.find(idVendor=VENDOR_ID, idProduct=PRODUCT_ID, find_all=True)
for dev in devs:
DUT_SERIAL = dev.serial_number
print("Running tests for DUT: ", DUT_SERIAL)
unittest.main(exit=False)