esp-open-rtos/tests/README.md

73 lines
2.2 KiB
Markdown
Raw Normal View History

2016-10-25 11:22:48 +00:00
# esp-open-rtos tests
2016-10-25 14:52:15 +00:00
Testing is based on [Unity](https://github.com/ThrowTheSwitch/Unity)
2016-10-25 11:27:03 +00:00
C testing framework.
2016-10-25 11:22:48 +00:00
## Features
* Single device test case.
* Dual devices test cases. Run test case on two ESP8266 modules simultaneously.
* Run only specified test cases.
* List available test cases on a device.
## Usage
There's a test runner script `test_runner.py` written in Python3 that runs
test cases on ESP8266 connected to a host.
2016-10-26 14:26:38 +00:00
### Requirements and dependencies
* Python3 version > 3.4 `sudo apt-get install python3 python3-pip`
* pyserial `sudo pip3 install pyserial`
* ESP8266 board with reset to boot mode support
* Two ESP8266 for dual mode test cases
2016-10-25 11:27:03 +00:00
Test runner is heavily relying on device reset using DTR and RTS signals.
Popular ESP8266 boards such as **NodeMcu** and **Wemos D1** support device
reset into flash mode.
2016-10-25 11:22:48 +00:00
### Options
`--type` or `-t` - Type of test case to run. Can be 'solo' or 'dual'.
If not specified 'solo' test will be run.
2016-10-25 14:52:15 +00:00
`--aport` or `-a` - Serial port for device A.
2016-10-25 11:27:03 +00:00
If not specified device `/dev/ttyUSB0` is used.
2016-10-25 11:22:48 +00:00
2016-10-25 14:52:15 +00:00
`--bport` or `-b` - Serial port for device B.
2016-10-25 11:27:03 +00:00
If not specified device `/dev/ttyUSB1` is used.
2016-10-25 11:22:48 +00:00
`--no-flash` or `-n` - Do not flash the test firmware before running tests.
`--flash` or `-f` - Flash device directly with esptool instead of using
`make flash` command. Can be used to flash binaries without esp-open-rtos
environment.
`--flash-cmd` or `-c` - Flash command for esptool. Used together with `--flash`.
2016-10-25 11:22:48 +00:00
`--list` or `-l` - Display list of the available test cases on the device.
### Example
Build test firmware, flash it using serial device `/dev/tty.wchusbserial1410`
and run only *solo* test cases:
2016-10-25 11:27:03 +00:00
2016-10-25 11:22:48 +00:00
`./test_runner.py -a /dev/tty.wchusbserial1410`
2016-10-25 11:27:03 +00:00
Build test firmware. Flash both devices as `-t dual` is specified. And run both
2016-10-25 11:22:48 +00:00
*solo* and *dual* test cases:
2016-10-25 11:27:03 +00:00
2016-10-25 11:22:48 +00:00
`./test_runner.py -a /dev/tty.wchusbserial1410 -b /dev/tty.wchusbserial1420 -t dual`
Do not flash the firmware, only display available test cases on the device:
2016-10-25 11:27:03 +00:00
2016-10-25 11:22:48 +00:00
`./test_runner.py -a /dev/tty.wchusbserial1410 -n -l`
Do not flash the firmware and run only 2 and 4 test cases:
2016-10-25 11:27:03 +00:00
2016-10-25 11:22:48 +00:00
`./test_runner.py -a /dev/tty.wchusbserial1410 -n 2 4`
## References
[Unity](https://github.com/ThrowTheSwitch/Unity) - Simple Unit Testing for C