1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00

core: improve stability of Monero test runner

This commit is contained in:
matejcik 2020-02-11 11:16:28 +01:00
parent 8a499b3067
commit 741c0c8888
2 changed files with 2 additions and 23 deletions

View File

@ -79,7 +79,7 @@ test_emu: ## run selected device tests from python-trezor
$(EMU_TEST) $(PYTEST) $(TESTPATH)/device_tests $(TESTOPTS)
test_emu_monero: ## run selected monero device tests from monero-agent
cd tests ; ./run_tests_device_emu_monero.sh $(TESTOPTS)
cd tests ; $(EMU_TEST) ./run_tests_device_emu_monero.sh $(TESTOPTS)
test_emu_u2f: ## run selected u2f device tests from u2f-tests-hid
$(EMU_TEST) --slip0014 $(TESTPATH)/fido_tests/u2f-tests-hid/HIDTest $(TREZOR_FIDO2_UDP_PORT) $(TESTOPTS)

View File

@ -2,39 +2,18 @@
: "${RUN_PYTHON_TESTS:=0}"
: "${FORCE_DOCKER_USE:=0}"
: "${RUN_TEST_EMU:=1}"
CORE_DIR="$(SHELL_SESSION_FILE='' && cd "$( dirname "${BASH_SOURCE[0]}" )/.." >/dev/null 2>&1 && pwd )"
upy_pid=""
# run emulator if RUN_TEST_EMU
if [[ $RUN_TEST_EMU > 0 ]]; then
t=$(mktemp)
../emu.py \
--disable-animation \
--temporary-profile \
--headless \
--output=../../tests/trezor.log \
> $t &
trezorctl wait-for-emulator
source $t
upy_pid=$(cat $TREZOR_PROFILE_DIR/trezor.pid)
rm $t
fi
DOCKER_ID=""
# Test termination trap
terminate_test() {
if [[ $# > 0 ]]; then error=$1; fi
if [ -n "$upy_pid" ]; then kill $upy_pid 2> /dev/null; fi
if [ -n "$DOCKER_ID" ]; then docker kill $DOCKER_ID 2>/dev/null >/dev/null; fi
exit $error
}
set -e
trap 'terminate_test $?' EXIT
trap terminate_test EXIT
# run tests
export EC_BACKEND_FORCE=1