tests: gadget0: allow specifying DUT on CLI
Easier than editing the file each time.
This commit is contained in:
parent
56bb7c295a
commit
16f3042fa8
@ -27,11 +27,13 @@ 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.
|
||||||
```
|
```
|
||||||
$ python -m unittest
|
$ python test_gadget0.py stm32f072disco
|
||||||
.........ss..............
|
Running tests for DUT: stm32f072disco
|
||||||
|
.........ss................
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
Ran 25 tests in 0.381s
|
Ran 27 tests in 0.388s
|
||||||
|
|
||||||
OK (skipped=2)
|
OK (skipped=2)
|
||||||
```
|
```
|
||||||
|
@ -3,6 +3,7 @@ import datetime
|
|||||||
import usb.core
|
import usb.core
|
||||||
import usb.util as uu
|
import usb.util as uu
|
||||||
import logging
|
import logging
|
||||||
|
import sys
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
@ -379,3 +380,10 @@ class TestUnaligned(unittest.TestCase):
|
|||||||
def test_unaligned(self):
|
def test_unaligned(self):
|
||||||
self.set_unaligned()
|
self.set_unaligned()
|
||||||
self.do_readwrite()
|
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()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user