mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-27 01:48:17 +00:00
tests: support v2 emulator in tests
This commit is contained in:
parent
df338c4399
commit
35f789122b
@ -5,6 +5,15 @@ sys.path = ['../',] + sys.path
|
||||
|
||||
from trezorlib.transport_pipe import PipeTransport
|
||||
from trezorlib.transport_hid import HidTransport
|
||||
from trezorlib.transport_udp import UdpTransport
|
||||
|
||||
def pipe_exists(path):
|
||||
import os
|
||||
try:
|
||||
os.stat(path)
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
devices = HidTransport.enumerate()
|
||||
|
||||
@ -16,11 +25,21 @@ if len(devices) > 0:
|
||||
DEBUG_TRANSPORT = HidTransport
|
||||
DEBUG_TRANSPORT_ARGS = (devices[0],)
|
||||
DEBUG_TRANSPORT_KWARGS = {'debug_link': True}
|
||||
else:
|
||||
print('Using Emulator(v1)')
|
||||
|
||||
elif pipe_exists('/tmp/pipe.trezor.to'):
|
||||
print('Using Emulator (v1=pipe)')
|
||||
TRANSPORT = PipeTransport
|
||||
TRANSPORT_ARGS = ('/tmp/pipe.trezor', False)
|
||||
TRANSPORT_KWARGS = {}
|
||||
DEBUG_TRANSPORT = PipeTransport
|
||||
DEBUG_TRANSPORT_ARGS = ('/tmp/pipe.trezor_debug', False)
|
||||
DEBUG_TRANSPORT_KWARGS = {}
|
||||
|
||||
elif True:
|
||||
print('Using Emulator (v2=udp)')
|
||||
TRANSPORT = UdpTransport
|
||||
TRANSPORT_ARGS = ('127.0.0.1:21324')
|
||||
TRANSPORT_KWARGS = {}
|
||||
DEBUG_TRANSPORT = UdpTransport
|
||||
DEBUG_TRANSPORT_ARGS = ('127.0.0.1:21324')
|
||||
DEBUG_TRANSPORT_KWARGS = {}
|
||||
|
Loading…
Reference in New Issue
Block a user