tests: gadget-zero: run against all attached targets
Less command line arguments, more automatic "do what I mean"
This commit is contained in:
parent
ec1d2855b0
commit
f594ddb395
@ -27,9 +27,11 @@ broken, and are awaiting code fixes, or are long running performance tests
|
|||||||
|
|
||||||
## Running the tests
|
## Running the tests
|
||||||
Below is an example of running the full suite of tests from the command line.
|
Below is an example of running the full suite of tests from the command line.
|
||||||
The argument specifies the serial number to look for in the usb gadget.
|
The argument specifies the serial number to look for in the usb gadget, if
|
||||||
|
you have more than one. No argument will the tests against all
|
||||||
|
gadget-zero's found.
|
||||||
```
|
```
|
||||||
$ python test_gadget0.py stm32f072disco
|
$ python test_gadget0.py
|
||||||
Running tests for DUT: stm32f072disco
|
Running tests for DUT: stm32f072disco
|
||||||
.........ss................
|
.........ss................
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
@ -10,6 +10,8 @@ import unittest
|
|||||||
VENDOR_ID=0xcafe
|
VENDOR_ID=0xcafe
|
||||||
PRODUCT_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 = "stm32f429i-disco"
|
||||||
DUT_SERIAL = "stm32f4disco"
|
DUT_SERIAL = "stm32f4disco"
|
||||||
#DUT_SERIAL = "stm32f103-generic"
|
#DUT_SERIAL = "stm32f103-generic"
|
||||||
@ -385,5 +387,12 @@ class TestUnaligned(unittest.TestCase):
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
DUT_SERIAL = sys.argv.pop()
|
DUT_SERIAL = sys.argv.pop()
|
||||||
print("Running tests for DUT: ", DUT_SERIAL)
|
print("Running tests for DUT: ", DUT_SERIAL)
|
||||||
unittest.main()
|
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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user