Skip to content

Commit

Permalink
Run tests using the binary distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
achow101 committed Mar 8, 2019
1 parent b810dbd commit 56674ab
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 6 deletions.
26 changes: 26 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,29 @@ 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 linux binary distribution command line interface
services: docker
before_script:
- docker build -t hwi-builder -f contrib/build.Dockerfile .
script:
- docker run -it --name hwi-builder -v $PWD:/opt/hwi --rm --workdir /opt/hwi hwi-builder /bin/bash -c "contrib/build_bin.sh && contrib/build_dist.sh"
- sudo chown -R `whoami`:`whoami` dist/
- cd test; poetry run ./run_tests.py --interface=bindist
- cd ..; sha256sum dist/*
- name: macOS binary distribution (no tests)
os: osx
osx_image: xcode7.3
language: generic
addons:
homebrew:
packages:
- libusb
- pyenv
artifacts:
working_dir: dist
install:
- brew update && brew upgrade pyenv
- cat contrib/reproducible-python.diff | PYTHON_CONFIGURE_OPTS="--enable-framework" BUILD_DATE="Jan 1 2019" BUILD_TIME="00:00:00" pyenv install -kp 3.6.8
script:
- contrib/build_bin.sh
- shasum -a 256 dist/*
2 changes: 1 addition & 1 deletion test/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
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'], default='library')
parser.add_argument('--interface', help='Which interface to send commands over', choices=['library', 'cli', 'bindist'], default='library')
args = parser.parse_args()

# Run tests
Expand Down
2 changes: 1 addition & 1 deletion test/test_coldcard.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_pin(self):
parser = argparse.ArgumentParser(description='Test Coldcard implementation')
parser.add_argument('simulator', help='Path to the Coldcard simulator')
parser.add_argument('bitcoind', help='Path to bitcoind binary')
parser.add_argument('--interface', help='Which interface to send commands over', choices=['library', 'cli'], default='library')
parser.add_argument('--interface', help='Which interface to send commands over', choices=['library', 'cli', 'bindist'], default='library')
args = parser.parse_args()

# Start bitcoind
Expand Down
4 changes: 4 additions & 0 deletions test/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ def do_command(self, args):
proc = subprocess.Popen(['hwi ' + ' '.join(args)], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, shell=True)
result = proc.communicate()
return json.loads(result[0].decode())
elif self.interface == 'bindist':
proc = subprocess.Popen(['../dist/hwi ' + ' '.join(args)], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, shell=True)
result = proc.communicate()
return json.loads(result[0].decode())
else:
return process_commands(args)

Expand Down
2 changes: 1 addition & 1 deletion test/test_digitalbitbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def test_backup(self):
parser = argparse.ArgumentParser(description='Test Digital Bitbox implementation')
parser.add_argument('simulator', help='Path to simulator binary')
parser.add_argument('bitcoind', help='Path to bitcoind binary')
parser.add_argument('--interface', help='Which interface to send commands over', choices=['library', 'cli'], default='library')
parser.add_argument('--interface', help='Which interface to send commands over', choices=['library', 'cli', 'bindist'], default='library')
args = parser.parse_args()

# Start bitcoind
Expand Down
6 changes: 5 additions & 1 deletion test/test_keepkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ def do_command(self, args):
proc = subprocess.Popen(['hwi ' + ' '.join(args)], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, shell=True)
result = proc.communicate()
return json.loads(result[0].decode())
elif self.interface == 'bindist':
proc = subprocess.Popen(['../dist/hwi ' + ' '.join(args)], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, shell=True)
result = proc.communicate()
return json.loads(result[0].decode())
else:
return process_commands(args)

Expand Down Expand Up @@ -233,7 +237,7 @@ def keepkey_test_suite(emulator, rpc, userpass, interface):
parser = argparse.ArgumentParser(description='Test Keepkey implementation')
parser.add_argument('emulator', help='Path to the Keepkey emulator')
parser.add_argument('bitcoind', help='Path to bitcoind binary')
parser.add_argument('--interface', help='Which interface to send commands over', choices=['library', 'cli'], default='library')
parser.add_argument('--interface', help='Which interface to send commands over', choices=['library', 'cli', 'bindist'], default='library')
args = parser.parse_args()

# Start bitcoind
Expand Down
2 changes: 1 addition & 1 deletion test/test_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_backup(self):
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Test Ledger implementation')
parser.add_argument('bitcoind', help='Path to bitcoind binary')
parser.add_argument('--interface', help='Which interface to send commands over', choices=['library', 'cli'], default='library')
parser.add_argument('--interface', help='Which interface to send commands over', choices=['library', 'cli', 'bindist'], default='library')
args = parser.parse_args()

# Start bitcoind
Expand Down
6 changes: 5 additions & 1 deletion test/test_trezor.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ def do_command(self, args):
proc = subprocess.Popen(['hwi ' + ' '.join(args)], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, shell=True)
result = proc.communicate()
return json.loads(result[0].decode())
elif self.interface == 'bindist':
proc = subprocess.Popen(['../dist/hwi ' + ' '.join(args)], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, shell=True)
result = proc.communicate()
return json.loads(result[0].decode())
else:
return process_commands(args)

Expand Down Expand Up @@ -233,7 +237,7 @@ def trezor_test_suite(emulator, rpc, userpass, interface):
parser = argparse.ArgumentParser(description='Test Trezor implementation')
parser.add_argument('emulator', help='Path to the Trezor emulator')
parser.add_argument('bitcoind', help='Path to bitcoind binary')
parser.add_argument('--interface', help='Which interface to send commands over', choices=['library', 'cli'], default='library')
parser.add_argument('--interface', help='Which interface to send commands over', choices=['library', 'cli', 'bindist'], default='library')
args = parser.parse_args()

# Start bitcoind
Expand Down

0 comments on commit 56674ab

Please sign in to comment.