Add tests for stdin interface and travis job
This commit is contained in:
parent
0185391c72
commit
49bc7fa5da
@ -55,6 +55,8 @@ jobs:
|
||||
script: cd test; poetry run ./run_tests.py --interface=library
|
||||
- name: With command line interface
|
||||
script: cd test; poetry run ./run_tests.py --interface=cli
|
||||
- name: With stdin interface
|
||||
script: cd test; ./run_tests.py --interface=stdin
|
||||
- name: With linux binary distribution command line interface
|
||||
services: docker
|
||||
before_script:
|
||||
|
||||
@ -32,7 +32,7 @@ dbb_group.add_argument('--no_bitbox', help='Do not run Digital Bitbox test with
|
||||
dbb_group.add_argument('--bitbox', help='Path to Digital bitbox simulator.', default='work/mcu/build/bin/simulator')
|
||||
|
||||
parser.add_argument('--bitcoind', help='Path to bitcoind.', default='work/bitcoin/src/bitcoind')
|
||||
parser.add_argument('--interface', help='Which interface to send commands over', choices=['library', 'cli', 'bindist'], default='library')
|
||||
parser.add_argument('--interface', help='Which interface to send commands over', choices=['library', 'cli', 'bindist', 'stdin'], default='library')
|
||||
args = parser.parse_args()
|
||||
|
||||
# Run tests
|
||||
|
||||
@ -87,6 +87,11 @@ class DeviceTestCase(unittest.TestCase):
|
||||
proc = subprocess.Popen(['../dist/hwi ' + ' '.join(args)], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, shell=True)
|
||||
result = proc.communicate()
|
||||
return json.loads(result[0].decode())
|
||||
elif self.interface == 'stdin':
|
||||
input_str = '\n'.join(args) + '\n'
|
||||
proc = subprocess.Popen(['hwi', '--stdin'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
|
||||
result = proc.communicate(input_str.encode())
|
||||
return json.loads(result[0].decode())
|
||||
else:
|
||||
return process_commands(args)
|
||||
|
||||
|
||||
@ -90,6 +90,11 @@ class KeepkeyTestCase(unittest.TestCase):
|
||||
proc = subprocess.Popen(['../dist/hwi ' + ' '.join(args)], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, shell=True)
|
||||
result = proc.communicate()
|
||||
return json.loads(result[0].decode())
|
||||
elif self.interface == 'stdin':
|
||||
input_str = '\n'.join(args) + '\n'
|
||||
proc = subprocess.Popen(['hwi', '--stdin'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
|
||||
result = proc.communicate(input_str.encode())
|
||||
return json.loads(result[0].decode())
|
||||
else:
|
||||
return process_commands(args)
|
||||
|
||||
|
||||
@ -90,6 +90,11 @@ class TrezorTestCase(unittest.TestCase):
|
||||
proc = subprocess.Popen(['../dist/hwi ' + ' '.join(args)], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, shell=True)
|
||||
result = proc.communicate()
|
||||
return json.loads(result[0].decode())
|
||||
elif self.interface == 'stdin':
|
||||
input_str = '\n'.join(args) + '\n'
|
||||
proc = subprocess.Popen(['hwi', '--stdin'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
|
||||
result = proc.communicate(input_str.encode())
|
||||
return json.loads(result[0].decode())
|
||||
else:
|
||||
return process_commands(args)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user