Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/thirdpin/libopencm3.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKarl Palsson <karlp@tweak.net.au>2017-05-09 02:20:04 +0300
committerKarl Palsson <karlp@tweak.net.au>2017-06-09 02:01:45 +0300
commitf594ddb39520e6bce4716120c419a9350686472d (patch)
tree41e27e1dc275909e6f32b5330682d8708416f64c /tests
parentec1d2855b0a54f29f8581afbbf956716d3026259 (diff)
tests: gadget-zero: run against all attached targets
Less command line arguments, more automatic "do what I mean"
Diffstat (limited to 'tests')
-rw-r--r--tests/gadget-zero/README.md6
-rw-r--r--tests/gadget-zero/test_gadget0.py13
2 files changed, 15 insertions, 4 deletions
diff --git a/tests/gadget-zero/README.md b/tests/gadget-zero/README.md
index 8586de10..b22cc627 100644
--- a/tests/gadget-zero/README.md
+++ b/tests/gadget-zero/README.md
@@ -27,9 +27,11 @@ broken, and are awaiting code fixes, or are long running performance tests
## Running the tests
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
.........ss................
----------------------------------------------------------------------
diff --git a/tests/gadget-zero/test_gadget0.py b/tests/gadget-zero/test_gadget0.py
index ec16f278..25e2fa2b 100644
--- a/tests/gadget-zero/test_gadget0.py
+++ b/tests/gadget-zero/test_gadget0.py
@@ -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)