firmware/testing
2022-07-20 11:03:37 -04:00
..
data Now with descriptors 2022-07-20 11:03:37 -04:00
debug New feature: press 4 to show QR for address shown via USB protocol (mk3) 2020-02-25 09:39:08 -05:00
devtest bitcoin regtest 2022-05-23 15:19:48 +02:00
.gitignore Validate TRNG using dieharder test suite 2021-03-16 14:06:36 -04:00
api.py allow missing UTXO(s) for foreign inputs 2022-06-16 16:29:31 +02:00
authproxy.py bitcoin regtest 2022-05-23 15:19:48 +02:00
bech32.py Support for P2TR cases 2022-05-03 11:37:22 -04:00
bip39-vectors.json BIP39 passphrase additions, no UX yet 2019-03-27 11:00:43 -04:00
ckcc_protocol Making whole firmware public with single, signed commit. 2018-07-24 14:07:33 -04:00
conftest.py allow missing UTXO(s) for foreign inputs 2022-06-16 16:29:31 +02:00
constants.py bitcoin regtest 2022-05-23 15:19:48 +02:00
helpers.py bitcoin regtest 2022-05-23 15:19:48 +02:00
Makefile dev squashed 2020-11-18 14:19:14 -05:00
objstruct.py dev squashed 2020-11-18 14:19:14 -05:00
psbt.py fix BasicPSBT parsing 2022-05-24 10:37:29 +02:00
pytest.ini review comments; importstyle; dissolve complex expression; ad test_ms_sign_simple to veryslow tests 2022-05-24 22:50:04 +02:00
README.md initial test fixing 2022-05-13 14:05:54 +02:00
requirements.txt remove ndef dependency -> ndeflib is part of nfcpy 2022-05-24 22:57:00 +02:00
run_sim_tests.py Multisig descriptors (#124) 2022-07-14 09:39:05 -04:00
sigheader.py Support firmware limiting itself to specific hardware revs 2020-01-21 09:53:56 -05:00
test_addr.py allow missing UTXO(s) for foreign inputs 2022-06-16 16:29:31 +02:00
test_address_explorer.py More test updates and cleanup 2022-04-18 14:56:12 -04:00
test_attended.py note 2021-12-14 10:16:06 -05:00
test_bip39pw.py menu text change 2022-04-18 10:25:03 -04:00
test_change_pins.py verify duress wallet math correct 2022-03-04 13:19:06 -05:00
test_drv_entro.py testcase for bip-85 menu 2022-07-20 10:59:37 -04:00
test_export.py bitcoin regtest 2022-05-23 15:19:48 +02:00
test_hsm.py allow unknown scripts in HSM; add support for OP_RETURN 2022-07-14 09:23:36 -04:00
test_msg.py fix test_sign_msg_microsd_fails 2022-05-16 16:27:18 +02:00
test_multisig.py Multisig descriptors (#124) 2022-07-14 09:39:05 -04:00
test_nfc.py allow missing UTXO(s) for foreign inputs 2022-06-16 16:29:31 +02:00
test_paper.py bitcoin regtest 2022-05-23 15:19:48 +02:00
test_pincodes.py mk4 se1 cases 2022-03-02 12:40:19 -05:00
test_pwsave.py Bugfix: dup entries in pw restore menu not rendered right 2021-09-02 10:08:39 -04:00
test_rng.py initial test fixing 2022-05-13 14:05:54 +02:00
test_se2.py updates for new menu text 2022-04-18 12:12:38 -04:00
test_seed_xor.py simulator use constant; seed xor remove semicolons and unused imports 2022-05-17 10:15:51 +02:00
test_sign.py BIP-85 Passwords & Keyboard emulation 2022-07-14 09:34:19 -04:00
test_unit.py split test_unit.py::test_backups to two tests 2022-05-17 18:52:15 +02:00
test_upgrades.py hacky upgrades ?fixed? 2022-05-17 22:51:52 +02:00
test_usb.py unconditional skip for usb fuzz test (ckcc enforces msg length) 2022-05-17 22:33:56 +02:00
test_ux.py More test updates and cleanup 2022-04-18 14:56:12 -04:00
test_vdisk.py allow missing UTXO(s) for foreign inputs 2022-06-16 16:29:31 +02:00
txn.py allow missing UTXO(s) for foreign inputs 2022-06-16 16:29:31 +02:00
xfp-miner.py dev squashed 2020-11-18 14:19:14 -05:00
xpub.py Useful helper 2020-12-10 10:35:58 -05:00

Testing Code

None of this code ships on the product itself, but it does get used for testing purposes.

Dependencies

  • 7z

Background

  • pytest is used to track test cases and fixtures, etc
  • most test code is desktop (simulator), but it can also validate stuff from/to the device
  • some tests might only be possible in 'devmode': a unit that has booted w/ non-standard bootrom
  • some tests may be destructive for funds/seeds/wallets
  • most unit tests will work only on simulator because the useful hooks are too dangerous in product
  • you need a testnet bitcoind running for some tests (will be skipped if not present)

Command line args

  • pass argument "--sim" or "--dev" to select simulator or real device

  • will skip tests that are inappropriate

  • and/or use "marker" for bitcoind interaction: "-m bitcoind"

  • with "--dev" include "--manual" to require operator to press X/OK at times (also needs -s), so:

    --dev --manual -s

Marked Test Cases

  • test all QR code related cases with:

    py.test -m qrcode

  • txn signing where an unfinalized PSBT is created (low-R tests)

    py.test -m unfinalized

  • "bitcoind" which means test would be skipped if you don't have bitcoin core running locally (on testnet)

PSBT reference files

  • examples with IN_REDEEM_SCRIPT:

    data/2-of-2.psbt data/failed-ex.psbt data/filled_scriptsig.psbt data/multisig-single.psbt data/p2pkh+p2sh+outs.psbt data/p2pkh-p2sh-p2wpkh.psbt data/p2sh_p2wpkh.psbt data/worked-*.psbt