mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-03-06 02:06:08 +00:00
core: simplify monero test use of emulator
This commit is contained in:
parent
ec192e9406
commit
22c8b2569b
@ -5,30 +5,14 @@
|
||||
: "${RUN_TEST_EMU:=1}"
|
||||
|
||||
CORE_DIR="$(SHELL_SESSION_FILE='' && cd "$( dirname "${BASH_SOURCE[0]}" )/.." >/dev/null 2>&1 && pwd )"
|
||||
MICROPYTHON="${MICROPYTHON:-$CORE_DIR/build/unix/micropython}"
|
||||
TREZOR_SRC="${CORE_DIR}/src"
|
||||
|
||||
DISABLE_ANIMATION=1
|
||||
PYOPT="${PYOPT:-0}"
|
||||
upy_pid=""
|
||||
|
||||
# run emulator if RUN_TEST_EMU
|
||||
if [[ $RUN_TEST_EMU > 0 ]]; then
|
||||
source ../trezor_cmd.sh
|
||||
|
||||
# remove flash and sdcard files before run to prevent inconsistent states
|
||||
mv "${TREZOR_PROFILE_DIR}/trezor.flash" "${TREZOR_PROFILE_DIR}/trezor.flash.bkp" 2>/dev/null
|
||||
mv "${TREZOR_PROFILE_DIR}/trezor.sdcard" "${TREZOR_PROFILE_DIR}/trezor.sdcard.bkp" 2>/dev/null
|
||||
|
||||
cd "${TREZOR_SRC}"
|
||||
echo "Starting emulator: $MICROPYTHON $ARGS ${MAIN}"
|
||||
|
||||
TREZOR_TEST=1 \
|
||||
TREZOR_DISABLE_ANIMATION=$DISABLE_ANIMATION \
|
||||
$MICROPYTHON $ARGS "${MAIN}" &> "${TREZOR_LOGFILE}" &
|
||||
../emu.py --disable-animation --temporary-profile --quiet --headless &
|
||||
upy_pid=$!
|
||||
cd -
|
||||
sleep 30
|
||||
trezorctl -v wait-for-emulator
|
||||
fi
|
||||
|
||||
DOCKER_ID=""
|
||||
@ -36,7 +20,7 @@ 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 "$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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user