1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-26 16:18:22 +00:00

tests: make testpy tries running selected tests from python-trezor

apps.ethereum: fix get address call
This commit is contained in:
Pavol Rusnak 2016-11-24 14:27:30 +01:00
parent 1cd0609ac2
commit 918150a3f1
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
4 changed files with 47 additions and 3 deletions

View File

@ -61,6 +61,9 @@ clean_cross: ## clean mpy-cross build
test: ## run unit tests
cd tests ; ./run_tests.sh
testpy: ## run selected unit tests from python-trezor
cd tests ; ./run_tests_python_trezor.sh
flash: ## flash firmware using st-flash
st-flash write $(STMHAL_BUILD_DIR)/firmware0.bin 0x8000000
sleep 0.1

View File

@ -9,8 +9,7 @@ async def layout_ethereum_get_address(msg, session_id):
from trezor.crypto.hashlib import sha3_256
from ..common.seed import get_node
address_n = getattr(msg, 'address_n', ())
show_display = getattr(msg, 'show_display', False)
address_n = msg.address_n or ()
node = await get_node(session_id, address_n)
@ -18,7 +17,7 @@ async def layout_ethereum_get_address(msg, session_id):
public_key = secp256k1.publickey(seckey, False) # uncompressed
address = sha3_256(public_key[1:]).digest(True)[12:] # Keccak
if show_display:
if msg.show_display:
await _show_address(session_id, address)
return EthereumAddress(address=address)

1
tests/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
python-trezor/

View File

@ -0,0 +1,41 @@
#!/bin/bash
if [ -d python-trezor ]; then
cd python-trezor ; git pull ; cd ..
else
git clone https://github.com/trezor/python-trezor.git
fi
# run emulator
cd ../src
../vendor/micropython/unix/micropython -O0 main.py &
UPY_PID=$!
sleep 1
cd ../tests/python-trezor/tests
export PYTHONPATH=".."
error=0
for i in \
test_msg_cipherkeyvalue.py \
test_msg_estimatetxsize.py \
test_msg_ethereum_getaddress.py \
test_msg_getaddress.py \
test_msg_getpublickey.py \
test_msg_signmessage.py \
test_msg_signtx.py \
test_msg_verifymessage.py \
; do
if ! python2 $i ; then
error=1
break
fi
done
# kill emulator
kill $UPY_PID
exit $error