mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-21 23:18:13 +00:00
ci: add click and persistence tests
This commit is contained in:
parent
9ab1554e93
commit
c1f7239c2d
17
ci/test.yml
17
ci/test.yml
@ -89,6 +89,15 @@ core unix fido2 test:
|
||||
- cd core
|
||||
- pipenv run make test_emu_fido2
|
||||
|
||||
core unix click test:
|
||||
stage: test
|
||||
<<: *only_changes_core
|
||||
dependencies:
|
||||
- core unix frozen debug build
|
||||
script:
|
||||
- cd core
|
||||
- pipenv run make test_emu_click
|
||||
|
||||
core unix upgrade test:
|
||||
stage: test
|
||||
<<: *only_changes_core
|
||||
@ -100,6 +109,14 @@ core unix upgrade test:
|
||||
- tests/download_emulators.sh
|
||||
- pipenv run pytest tests/upgrade_tests
|
||||
|
||||
core unix persistence test:
|
||||
stage: test
|
||||
<<: *only_changes_core
|
||||
dependencies:
|
||||
- core unix frozen debug build
|
||||
script:
|
||||
- pipenv run pytest tests/persistence_tests
|
||||
|
||||
core mypy test:
|
||||
stage: test
|
||||
<<: *only_changes_core
|
||||
|
@ -76,6 +76,9 @@ test_emu_u2f: ## run selected u2f device tests from u2f-tests-hid
|
||||
test_emu_fido2: ## run fido2 device tests
|
||||
cd tests ; ./run_tests_device_emu_fido2.sh $(TESTOPTS)
|
||||
|
||||
test_emu_click: ## run click tests
|
||||
cd tests ; ./run_tests_click_emu.sh $(TESTOPTS)
|
||||
|
||||
pylint: ## run pylint on application sources and tests
|
||||
pylint -E $(shell find src tests -name *.py)
|
||||
|
||||
|
38
core/tests/run_tests_click_emu.sh
Executable file
38
core/tests/run_tests_click_emu.sh
Executable file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
: "${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_FADE=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_FADE=$DISABLE_FADE \
|
||||
$MICROPYTHON $ARGS "${MAIN}" &> "${TREZOR_LOGFILE}" &
|
||||
upy_pid=$!
|
||||
cd -
|
||||
sleep 30
|
||||
fi
|
||||
|
||||
# run tests
|
||||
error=0
|
||||
if ! pytest ../../tests/click_tests "$@"; then
|
||||
error=1
|
||||
fi
|
||||
kill $upy_pid
|
||||
exit $error
|
Loading…
Reference in New Issue
Block a user