mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-05-06 00:49:20 +00:00
core: enhance testing runners
This commit is contained in:
parent
f87d033345
commit
f962a18785
@ -1,25 +1,33 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
SDIR="$(SHELL_SESSION_FILE='' && cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
: "${RUN_TEST_EMU:=1}"
|
||||||
CORE_DIR="$SDIR/.."
|
|
||||||
|
CORE_DIR="$(SHELL_SESSION_FILE='' && cd "$( dirname "${BASH_SOURCE[0]}" )/.." >/dev/null 2>&1 && pwd )"
|
||||||
MICROPYTHON="${MICROPYTHON:-$CORE_DIR/build/unix/micropython}"
|
MICROPYTHON="${MICROPYTHON:-$CORE_DIR/build/unix/micropython}"
|
||||||
RUN_TEST_EMU=1
|
TREZOR_SRC="${CORE_DIR}/src"
|
||||||
|
|
||||||
DISABLE_FADE=1
|
DISABLE_FADE=1
|
||||||
PYOPT=0
|
PYOPT="${PYOPT:-0}"
|
||||||
|
upy_pid=""
|
||||||
|
|
||||||
# run emulator if RUN_TEST_EMU
|
# run emulator if RUN_TEST_EMU
|
||||||
if [[ $RUN_TEST_EMU > 0 ]]; then
|
if [[ $RUN_TEST_EMU > 0 ]]; then
|
||||||
cd "$CORE_DIR/src"
|
source ../trezor_cmd.sh
|
||||||
|
|
||||||
|
# remove flash before run to prevent inconsistent states
|
||||||
|
mv "${TREZOR_PROFILE_DIR}/trezor.flash" "${TREZOR_PROFILE_DIR}/trezor.flash.bkp" 2>/dev/null
|
||||||
|
|
||||||
|
cd "${TREZOR_SRC}"
|
||||||
|
echo "Starting emulator: $MICROPYTHON $ARGS ${MAIN}"
|
||||||
|
|
||||||
TREZOR_TEST=1 \
|
TREZOR_TEST=1 \
|
||||||
TREZOR_DISABLE_FADE=$DISABLE_FADE \
|
TREZOR_DISABLE_FADE=$DISABLE_FADE \
|
||||||
$MICROPYTHON -O$PYOPT main.py >/dev/null &
|
$MICROPYTHON $ARGS "${MAIN}" &> "${TREZOR_LOGFILE}" &
|
||||||
upy_pid=$!
|
upy_pid=$!
|
||||||
sleep 1
|
|
||||||
cd -
|
cd -
|
||||||
|
sleep 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export TREZOR_PATH=udp:127.0.0.1:21324
|
|
||||||
|
|
||||||
# run tests
|
# run tests
|
||||||
error=0
|
error=0
|
||||||
if ! pytest ../../tests/device_tests "$@"; then
|
if ! pytest ../../tests/device_tests "$@"; then
|
||||||
|
@ -4,25 +4,32 @@
|
|||||||
: "${FORCE_DOCKER_USE:=0}"
|
: "${FORCE_DOCKER_USE:=0}"
|
||||||
: "${RUN_TEST_EMU:=1}"
|
: "${RUN_TEST_EMU:=1}"
|
||||||
|
|
||||||
SDIR="$(SHELL_SESSION_FILE='' && cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
CORE_DIR="$(SHELL_SESSION_FILE='' && cd "$( dirname "${BASH_SOURCE[0]}" )/.." >/dev/null 2>&1 && pwd )"
|
||||||
CORE_DIR="$SDIR/.."
|
|
||||||
MICROPYTHON="${MICROPYTHON:-$CORE_DIR/build/unix/micropython}"
|
MICROPYTHON="${MICROPYTHON:-$CORE_DIR/build/unix/micropython}"
|
||||||
|
TREZOR_SRC="${CORE_DIR}/src"
|
||||||
|
|
||||||
DISABLE_FADE=1
|
DISABLE_FADE=1
|
||||||
PYOPT=0
|
PYOPT="${PYOPT:-0}"
|
||||||
upy_pid=""
|
upy_pid=""
|
||||||
|
|
||||||
# run emulator if RUN_TEST_EMU
|
# run emulator if RUN_TEST_EMU
|
||||||
if [[ $RUN_TEST_EMU > 0 ]]; then
|
if [[ $RUN_TEST_EMU > 0 ]]; then
|
||||||
cd "$CORE_DIR/src"
|
source ../trezor_cmd.sh
|
||||||
|
|
||||||
|
# remove flash before run to prevent inconsistent states
|
||||||
|
mv "${TREZOR_PROFILE_DIR}/trezor.flash" "${TREZOR_PROFILE_DIR}/trezor.flash.bkp" 2>/dev/null
|
||||||
|
|
||||||
|
cd "${TREZOR_SRC}"
|
||||||
|
echo "Starting emulator: $MICROPYTHON $ARGS ${MAIN}"
|
||||||
|
|
||||||
TREZOR_TEST=1 \
|
TREZOR_TEST=1 \
|
||||||
TREZOR_DISABLE_FADE=$DISABLE_FADE \
|
TREZOR_DISABLE_FADE=$DISABLE_FADE \
|
||||||
"$MICROPYTHON" -O$PYOPT main.py >/dev/null &
|
$MICROPYTHON $ARGS "${MAIN}" &> "${TREZOR_LOGFILE}" &
|
||||||
upy_pid=$!
|
upy_pid=$!
|
||||||
cd -
|
cd -
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export TREZOR_PATH=udp:127.0.0.1:21324
|
|
||||||
DOCKER_ID=""
|
DOCKER_ID=""
|
||||||
|
|
||||||
# Test termination trap
|
# Test termination trap
|
||||||
@ -102,4 +109,3 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
exit $error
|
exit $error
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user