libopencm3/tests/gadget-zero
Karl Palsson e652121931 tests: gadget0: stm32l0: use new clock helpers.
Doesn't actually change the test results, but gets more coverage from
the same test case.
2017-06-08 23:01:45 +00:00
..
.gitignore tests: extract serials to optional local config 2016-02-28 17:47:28 +00:00
Makefile.stm32f4disco tests: usb: gadget0 compatible interface (stm32f4) 2015-10-03 00:58:43 +00:00
Makefile.stm32f072disco usb: Add st_usbfs_v2 for f0/l0 devices 2015-10-03 02:03:58 +00:00
Makefile.stm32f103-generic tests: gadget0: add stm32f103 target 2015-10-03 01:18:17 +00:00
Makefile.stm32f429i-disco tests: usb gadget0: Add stm32f429i-disco support 2016-01-05 18:11:59 +00:00
Makefile.stm32l1-generic tests: gadget0: add stm32l1 target 2015-10-03 01:29:49 +00:00
Makefile.stm32l053disco tests: gadget0: Add stm32l053 disco support 2015-10-06 00:54:53 +00:00
README.md tests: gadget-zero: run against all attached targets 2017-06-08 23:01:45 +00:00
main-stm32f4disco.c style: fix some of the easier style bugs 2017-03-30 21:48:07 +00:00
main-stm32f072disco.c style: fix some of the easier style bugs 2017-03-30 21:48:07 +00:00
main-stm32f103-generic.c style: fix some of the easier style bugs 2017-03-30 21:48:07 +00:00
main-stm32f429i-disco.c style: fix some of the easier style bugs 2017-03-30 21:48:07 +00:00
main-stm32l1-generic.c style: fix some of the easier style bugs 2017-03-30 21:48:07 +00:00
main-stm32l053disco.c tests: gadget0: stm32l0: use new clock helpers. 2017-06-08 23:01:45 +00:00
openocd.common.cfg tests: extract serials to optional local config 2016-02-28 17:47:28 +00:00
openocd.stm32f4disco.cfg tests: extract serials to optional local config 2016-02-28 17:47:28 +00:00
openocd.stm32f072disco.cfg tests: extract serials to optional local config 2016-02-28 17:47:28 +00:00
openocd.stm32f103-generic.cfg tests: extract serials to optional local config 2016-02-28 17:47:28 +00:00
openocd.stm32f429i-disco.cfg tests: extract serials to optional local config 2016-02-28 17:47:28 +00:00
openocd.stm32l1-generic.cfg tests: extract serials to optional local config 2016-02-28 17:47:28 +00:00
openocd.stm32l053disco.cfg tests: extract serials to optional local config 2016-02-28 17:47:28 +00:00
stub.py tests: usb: gadget0 compatible interface (stm32f4) 2015-10-03 00:58:43 +00:00
test_gadget0.py tests: gadget-zero: run against all attached targets 2017-06-08 23:01:45 +00:00
usb-gadget0.c tests: gadget0: test for unaligned buffer read/writes. 2016-10-01 15:46:33 +00:00
usb-gadget0.h [Style] Stylefix sweep over the whole codebase. 2015-12-14 22:57:15 +01:00

README.md

This project, inspired by usbtest and the linux usb gadget zero driver is used for regression testing changes to the libopencm3 usb stack.

The firmware itself is meant to be portable to any supported hardware, and then identical unit test code is run against all platforms. This project can and should be built for multiple devices.

Requirements:

  • pyusb for running the tests.
  • openocd >= 0.9 for automated flashing of specific boards
  • python3 for running the tests at the command line.

Example using virtual environments

pyvenv .env  # ensures a python3 virtual env
. .env/bin/activate
pip install pyusb

You will need to modify the openocd config files, as they contain specific serial numbers of programming hardware. You should set these up for the set of available boards at your disposal.

Tests marked as @unittest.skip are either for functionality that is known to be 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, if you have more than one. No argument will the tests against all gadget-zero's found.

$ python test_gadget0.py
Running tests for DUT:  stm32f072disco
.........ss................
----------------------------------------------------------------------
Ran 27 tests in 0.388s

OK (skipped=2)

You can also run individual tests, or individual sets of tests, see the unittest documentation for more information.

Many development environments, such as PyCharm can also be used to edit and run the tests, in whole or individually, with a nice visual test runner.