-
Notifications
You must be signed in to change notification settings - Fork 233
Tests for Trezor and Coldcard implementations and enable Travis CI #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b98654b to
48a8758
Compare
|
I've updated |
67a3930 to
8e998f5
Compare
Sjors
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! I wasn't able to get the Trezor simulator to work on macOS. Maybe it's better to (also) support the more modern Trezor Core emulator?
Can you replace #!/usr/bin/python3 with #! /usr/bin/env python3 in the bech32 test?
Trezor test throws ModuleNotFoundError: No module named 'bitcoinrpc', so maybe that's missing from the installer? I had to run pip3 install python-bitcoinrpc.
| It also tests usage with `bitcoind`, so the [patched Bitcoin Core](../docs/bitcoin-core-usage.md#bitcoin-core) is required. | ||
| - `test_coldcard.py` tests the command line interface and Coldcard implementation. | ||
| It uses the [Coldcard simulator](https://github.com/Coldcard/firmware/tree/master/unix#coldcard-desktop-simulator). | ||
| It also tests usage with `bitcoind`, so the [patched Bitcoin Core](../docs/bitcoin-core-usage.md#bitcoin-core) is required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet!
test/README.md
Outdated
| In order to build the Trezor emulator, the following packages will need to be installed: | ||
|
|
||
| ``` | ||
| build-essential curl git python3 python3-pip libsdl2-dev libsdl2-image-dev gcc-arm-none-eabi libnewlib-arm-none-eabi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which Homebrew equivalents?
So far I have:
brew install curl git python3 sdl2 sdl2_image`
brew tap ArmMbed/homebrew-formulae
brew install brew install arm-none-eabi-gccI forget how I installed pip. I think build-essential is covered by the Xcode dev tools, which should be present if bitcoind is compiled from source.
However that still ended with compiler errors for pipenv run script/cibuild.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the packages defined in their .travis.yml: build-essential gcc-arm-none-eabi gcc-multilib libnewlib-arm-none-eabi python3.6 python3.6-venv python3.6-dev. I think you are missing gcc-multilib? I'll add that to the README.
| ``` | ||
| pipenv | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./build.sh EMU builds the emulator. Point out that you need Docker. (or do you, I'm confused)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can build it without docker, unless you want to use ./build.sh. AFAIK, build.sh does not build the emulator in headless mode, so there's a GUI and such. For automated testing on Travis, we need headless mode so we build it through the pipenv commands rather than build.sh.
|
I can add another test that uses the Trezor Core emulator. I've updated the README significantly with more detailed instructions for building. I've also updated the shebang for
|
|
@achow101 might as well add those Trezor Core tests in a next PR. I can always look at Travis logs to see if I broke a test. |
Using the trezor emulator, test the enumerate, getxpub, getmasterxpub, getkeypool, and signtx commands. Also tests fingerprint autodetect and device type only specified.
Using the coldcard simulator, test the enumerate, getxpub, getmasterxpub, and getkeypool commands. Signtx is tested if the simulator is in non-headless mode as it requires user input. Also tests fingerprint autodetect and device type only specified.
Sort items before serializing so that the same psbt will always be serialized the same way.
Add a run_tests.py script which runs all of the tests. Add a setup_environment.sh script which will download and build the Trezor emulator, Coldcard simulator, and bitcoind.
Adds an extra_requires for the tests which has the dependencies needed for running the tests (besides emulator/simulator deps).
…ravis CI fd19704 Travis config (Andrew Chow) ced3087 Document tests and how to run them (Andrew Chow) ddcf842 extra for tests dependencies (Andrew Chow) 8aa0471 Add scripts to run tests and prepare test environments (Andrew Chow) 993b6e8 Update test_bech32.py shebang (Andrew Chow) a277ac2 Fix psbt serializations to always be consistent (Andrew Chow) d01cbae Add tests for Coldcard using Coldcard simulator (Andrew Chow) 2272428 Add tests for trezor using the emulator (Andrew Chow) ccd5f2a Use the DebugLink for the Trezor emulator in order to have tests (Andrew Chow) 64816cb Remove unneeded BIP 32 test (Andrew Chow) Pull request description: This PR is based on top of #66. It adds two test cases for the Trezor and Coldcard implementations by using their respective emulators/simulators. `test_bip32.py` was removed as the BIP 32 implementation was removed and no longer needed. Additionally a test running (`run_tests.py`), a script for building the Trezor emulator, Coldcard simulator, and bitcoind, and instructions for running the tests were all added. Lastly a Travis config has been added and travis builds for this branch are available at https://travis-ci.org/achow101/HWI Tree-SHA512: 71da24ee39bd845a822d48e83d4c6980cda741544e6cdf04d257db116bc1f7133b3370e235100a66b4fe7c69ecbd0298a4df7879733b75cebeb6a88467f4bf5f
This PR is based on top of #66. It adds two test cases for the Trezor and Coldcard implementations by using their respective emulators/simulators.
test_bip32.pywas removed as the BIP 32 implementation was removed and no longer needed. Additionally a test running (run_tests.py), a script for building the Trezor emulator, Coldcard simulator, and bitcoind, and instructions for running the tests were all added. Lastly a Travis config has been added and travis builds for this branch are available at https://travis-ci.org/achow101/HWI