diff options
author | Karl Palsson <karlp@tweak.net.au> | 2017-03-26 00:15:59 +0300 |
---|---|---|
committer | Karl Palsson <karlp@tweak.net.au> | 2017-03-31 00:48:07 +0300 |
commit | 16f3042fa8d6d45edc367916b399de29e4e76dc0 (patch) | |
tree | 396c9f362ba2d7cc6e509a2ca4c0a7481a9c5917 /tests | |
parent | 56bb7c295aa231f73e768f177aba7c0ee995eb91 (diff) |
tests: gadget0: allow specifying DUT on CLI
Easier than editing the file each time.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gadget-zero/README.md | 8 | ||||
-rw-r--r-- | tests/gadget-zero/test_gadget0.py | 8 |
2 files changed, 13 insertions, 3 deletions
diff --git a/tests/gadget-zero/README.md b/tests/gadget-zero/README.md index 2e86ad6f..8586de10 100644 --- a/tests/gadget-zero/README.md +++ b/tests/gadget-zero/README.md @@ -27,11 +27,13 @@ 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. ``` -$ python -m unittest -.........ss.............. +$ python test_gadget0.py stm32f072disco +Running tests for DUT: stm32f072disco +.........ss................ ---------------------------------------------------------------------- -Ran 25 tests in 0.381s +Ran 27 tests in 0.388s OK (skipped=2) ``` diff --git a/tests/gadget-zero/test_gadget0.py b/tests/gadget-zero/test_gadget0.py index 3565dd08..ec16f278 100644 --- a/tests/gadget-zero/test_gadget0.py +++ b/tests/gadget-zero/test_gadget0.py @@ -3,6 +3,7 @@ import datetime import usb.core import usb.util as uu import logging +import sys import unittest @@ -379,3 +380,10 @@ class TestUnaligned(unittest.TestCase): def test_unaligned(self): self.set_unaligned() self.do_readwrite() + + +if __name__ == "__main__": + if len(sys.argv) > 1: + DUT_SERIAL = sys.argv.pop() + print("Running tests for DUT: ", DUT_SERIAL) + unittest.main() |