mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 15:38:11 +00:00
ci: add u2f tests to CI
This commit is contained in:
parent
9414a2b2f5
commit
650db2a5c0
@ -68,6 +68,15 @@ core unix monero test:
|
|||||||
- cd core
|
- cd core
|
||||||
- pipenv run make test_emu_monero
|
- pipenv run make test_emu_monero
|
||||||
|
|
||||||
|
core unix u2f test:
|
||||||
|
stage: test
|
||||||
|
<<: *only_changes_core
|
||||||
|
dependencies:
|
||||||
|
- core unix frozen regular build
|
||||||
|
script:
|
||||||
|
- cd core
|
||||||
|
- pipenv run make test_emu_u2f
|
||||||
|
|
||||||
core unix upgrade test:
|
core unix upgrade test:
|
||||||
stage: test
|
stage: test
|
||||||
<<: *only_changes_core
|
<<: *only_changes_core
|
||||||
|
@ -70,6 +70,9 @@ test_emu: ## run selected device tests from python-trezor
|
|||||||
test_emu_monero: ## run selected monero device tests from monero-agent
|
test_emu_monero: ## run selected monero device tests from monero-agent
|
||||||
cd tests ; ./run_tests_device_emu_monero.sh $(TESTOPTS)
|
cd tests ; ./run_tests_device_emu_monero.sh $(TESTOPTS)
|
||||||
|
|
||||||
|
test_emu_u2f: ## run selected u2f device tests from u2f-tests-hid
|
||||||
|
cd tests ; ./run_tests_device_emu_u2f.sh $(TESTOPTS)
|
||||||
|
|
||||||
pylint: ## run pylint on application sources and tests
|
pylint: ## run pylint on application sources and tests
|
||||||
pylint -E $(shell find src tests -name *.py)
|
pylint -E $(shell find src tests -name *.py)
|
||||||
|
|
||||||
|
44
core/tests/run_tests_device_emu_u2f.sh
Executable file
44
core/tests/run_tests_device_emu_u2f.sh
Executable file
@ -0,0 +1,44 @@
|
|||||||
|
#!/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 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_DISABLE_FADE=$DISABLE_FADE \
|
||||||
|
$MICROPYTHON $ARGS "${MAIN}" &> "${TREZOR_LOGFILE}" &
|
||||||
|
upy_pid=$!
|
||||||
|
cd -
|
||||||
|
sleep 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# run tests
|
||||||
|
error=0
|
||||||
|
# missuse loaddevice test to initialize the device
|
||||||
|
if ! pytest ../../tests/device_tests -k "test_msg_loaddevice" "$@"; then
|
||||||
|
error=1
|
||||||
|
fi
|
||||||
|
if ! ../../tests/fido_tests/u2f-tests-hid/HIDTest 21328 "$@"; then
|
||||||
|
error=1
|
||||||
|
fi
|
||||||
|
if ! ../../tests/fido_tests/u2f-tests-hid/U2FTest 21328 "$@"; then
|
||||||
|
error=1
|
||||||
|
fi
|
||||||
|
kill $upy_pid
|
||||||
|
exit $error
|
Loading…
Reference in New Issue
Block a user