Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

Commit

Permalink
xmr: adding agent tests to travis
Browse files Browse the repository at this point in the history
  • Loading branch information
ph4r05 committed Oct 3, 2018
1 parent c752866 commit 23522ac
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ addons:
- python3.6-dev
- python3.6-venv

cache:
directories:
- $HOME/libsodium

before_install:
- python3.6 -m ensurepip --user
- python3.6 -m pip install --user pipenv
Expand All @@ -42,6 +46,9 @@ install:
- curl -LO "https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip"
- unzip "protoc-${PROTOBUF_VERSION}-linux-x86_64.zip" -d protoc
- export PATH="$(pwd)/protoc/bin:$PATH"
- ./travis-install-libsodium.sh
- export PKG_CONFIG_PATH=$HOME/libsodium/lib/pkgconfig:$PKG_CONFIG_PATH
- export LD_LIBRARY_PATH=$HOME/libsodium/lib:$LD_LIBRARY_PATH
- pipenv install

before_script:
Expand All @@ -63,6 +70,7 @@ script:
- test "$GOAL" != "unix" || pipenv run make build_unix_noui
- test "$GOAL" != "unix" || pipenv run make test
- test "$GOAL" != "unix" || pipenv run make test_emu
- test "$GOAL" != "unix" || pipenv run make test_emu_monero

notifications:
webhooks:
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ test: ## run unit tests
test_emu: ## run selected device tests from python-trezor
cd tests ; ./run_tests_device_emu.sh $(TESTOPTS)

test_emu_monero: ## run selected monero device tests from monero-agent
cd tests ; ./run_tests_device_emu_monero.sh $(TESTOPTS)

pylint: ## run pylint on application sources and tests
pylint -E $(shell find src tests -name *.py)

Expand Down
3 changes: 3 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@ termcolor = ">=0.1.2"
Pillow = ">=5.2.0"
Mako = ">=1.0.7"

# monero
monero_agent = {version = ">=1.6.3", extras = ["tcry", "dev"]}

[pipenv]
allow_prereleases = true
22 changes: 22 additions & 0 deletions tests/run_tests_device_emu_monero.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

MICROPYTHON=../build/unix/micropython
PYOPT=0

# run emulator
cd ../src
$MICROPYTHON -O$PYOPT main.py >/dev/null &
upy_pid=$!
sleep 1

export TREZOR_PATH=udp:127.0.0.1:21324

# run tests
cd ..

export EC_BACKEND_FORCE=1
export EC_BACKEND=1
python3 -m unittest trezor_monero_test.test_trezor
error=$?
kill $upy_pid
exit $error
21 changes: 21 additions & 0 deletions travis-install-libsodium.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh
# libsodium-dev replacement
#
# The purpose of this file is to install libsodium in
# the Travis CI environment. Outside this environment,
# you would probably not want to install it like this.

set -e
export LIBSODIUM_VER="1.0.16"

# check if libsodium is already installed
if [ ! -d "$HOME/libsodium/lib" ]; then
wget "https://github.com/jedisct1/libsodium/releases/download/${LIBSODIUM_VER}/libsodium-${LIBSODIUM_VER}.tar.gz"
tar xvfz "libsodium-${LIBSODIUM_VER}.tar.gz"
cd "libsodium-${LIBSODIUM_VER}"
./configure --prefix=$HOME/libsodium
make
make install
else
echo 'Using cached directory.'
fi

0 comments on commit 23522ac

Please sign in to comment.