diff --git a/docs/build.md b/docs/build.md index 46aafabd9..bdde2e3ac 100644 --- a/docs/build.md +++ b/docs/build.md @@ -16,36 +16,47 @@ make vendor ``` Install the required packages, depending on your operating system. + * __Debian/Ubuntu__: + ```sh - sudo apt-get update sudo apt-get install scons libsdl2-dev libsdl2-image-dev ``` + * __Fedora__: + ```sh sudo yum install scons SDL2-devel SDL2_image-devel ``` + * __OpenSUSE__: + ```sh sudo zypper install scons libSDL2-devel libSDL2_image-devel ``` + * __Arch__: + ```sh sudo pacman -S scons sdl2 sdl2_image ``` + * __Mac OS X__: + ```sh brew install scons sdl2 sdl2_image ``` + * __Windows__: not supported yet, sorry. - Run the build with: + ```sh make build_unix ``` Now you can start the emulator: + ```sh ./emu.sh ``` diff --git a/docs/hardware.md b/docs/hardware.md index 0c81e0d9b..f2667b5d2 100644 --- a/docs/hardware.md +++ b/docs/hardware.md @@ -101,6 +101,7 @@ * Integrated STMicroelectronics ST-LINK/V2.1 debugger Minimum MCU requirements: + * STM32F4 family [STM32F427VIT6](http://www.st.com/en/microcontrollers/stm32f427vi.html) * 168 MHz, 8 MHz HSE * 2048 KB Flash memory @@ -112,4 +113,3 @@ Minimum MCU requirements: #### Clock Tree ![Clock Tree](hardware/clock-tree.png) - diff --git a/docs/testing.md b/docs/testing.md index 776b593f6..531519809 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -7,14 +7,19 @@ Apart from the internal tests, Trezor core has a suite of integration tests in t ### 1. Running the suite with pipenv [`pipenv`](https://docs.pipenv.org/) is a tool for making reproducible Python environments. Install it with: + ```sh sudo pip3 install pipenv ``` + Inside `trezor-core` checkout, install the environment: + ```sh pipenv install ``` + And run the automated tests: + ```sh pipenv run make test_emu ``` @@ -22,37 +27,48 @@ pipenv run make test_emu ### 2. Developing new tests You will need a separate checkout of `python-trezor`. It's probably a good idea to do this outside the `trezor-core` directory: + ```sh git clone https://github.com/trezor/python-trezor ``` + Prepare a virtual environment with all the requirements, and switch into it. Again, it's easiest to do this with `pipenv`: + ```sh cd python-trezor pipenv install -r requirements-dev.txt pipenv install -e . pipenv shell ``` + Alternately, if you have an existing virtualenv, you can install python-trezor in "develop" mode: + ```sh python setup.py develop ``` If you want to test against the emulator, run it in a separate terminal from the `trezor-core` checkout directory: + ```sh PYOPT=0 ./emu.sh ``` Find the device address and export it as an environment variable. For the emulator, this is: + ```sh export TREZOR_PATH="udp:127.0.0.1:21324" ``` + (You can find other devices with `trezorctl list`.) Now you can run the test suite, either from `python-trezor` or `trezor-core` root directory: + ```sh pytest ``` + Or from anywhere else: + ```sh pytest --pyargs trezorlib.tests.device_tests # this works from other locations ``` @@ -60,6 +76,7 @@ pytest --pyargs trezorlib.tests.device_tests # this works from other locations You can place your own tests in `trezorlib/tests/device_tests`. See test style guide (TODO). If you only want to run a particular test, pick it with `-k ` or `-m `: + ```sh pytest -k nem # only runs tests that have "nem" in the name pytest -m stellar # only runs tests marked with @pytest.mark.stellar @@ -76,9 +93,12 @@ When you're happy with your tests, follow these steps: If you want to run that test as usual, run `pytest --runxfail` 3. Submit a PR to `python-trezor`, containing these tests. 4. Edit the file `trezor-core/pytest.ini`, and add your marker to the `run_xfail` item: - ``` + + ``` ini run_xfail = lisk nem ultracoin2000 ``` + This will cause your PR to re-enable the `xfail`ed tests. That way we will see whether your feature actually implements what it claims. + 5. Submit a PR to `trezor-core`. 6. Optionally, if you like to be extra nice: after both your PRs are accepted, submit a new one to `python-trezor` that removes the `xfail` markers, and one to `trezor-core` that removes the `run_xfail` entry.