1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-25 07:48:10 +00:00

ci: use explicit trezor.log location

This commit is contained in:
matejcik 2020-01-16 17:17:41 +01:00
parent 32b269ad43
commit 6cf48bf485
4 changed files with 23 additions and 19 deletions

View File

@ -46,16 +46,15 @@ core unix device ui test:
script:
- cd core
- pipenv run make test_emu_ui
- cp /var/tmp/trezor.log ${CI_PROJECT_DIR}
- cd ../ci
- pipenv run python prepare_ui_artifacts.py
artifacts:
name: core-unix-device-ui-test
paths:
- trezor.log
- ci/ui_test_records/
- tests/ui_tests/reports/
- tests/junit.xml
- tests/trezor.log
when: always
expire_in: 1 week
reports:
@ -71,14 +70,13 @@ core unix device test:
script:
- cd core
- pipenv run make test_emu
- cp /var/tmp/trezor.log ${CI_PROJECT_DIR}
- sync
- sleep 1
- mv ./src/.coverage .coverage.test_emu
artifacts:
name: core-unix-device-test
paths:
- trezor.log
- tests/trezor.log
- tests/junit.xml
- core/.coverage.*
expire_in: 1 week
@ -97,11 +95,10 @@ core unix btconly device test:
script:
- cd core
- pipenv run make test_emu
- cp /var/tmp/trezor.log ${CI_PROJECT_DIR}
artifacts:
name: core-unix-btconly-device-test
paths:
- trezor.log
- tests/trezor.log
- tests/junit.xml
expire_in: 1 week
when: always
@ -118,14 +115,13 @@ core unix monero test:
script:
- cd core
- pipenv run make test_emu_monero
- cp /var/tmp/trezor.log ${CI_PROJECT_DIR}
- sync
- sleep 1
- mv ./src/.coverage .coverage.test_emu_monero
artifacts:
name: core-unix-monero-test
paths:
- trezor.log
- tests/trezor.log
- core/.coverage.*
expire_in: 1 week
when: always
@ -141,14 +137,13 @@ core unix u2f test:
- make -C tests/fido_tests/u2f-tests-hid
- cd core
- pipenv run make test_emu_u2f
- cp /var/tmp/trezor.log ${CI_PROJECT_DIR}
- sync
- sleep 1
- mv ./src/.coverage .coverage.test_emu_u2f
artifacts:
name: core-unix-u2f-test
paths:
- trezor.log
- tests/trezor.log
- core/.coverage.*
expire_in: 1 week
when: always
@ -163,14 +158,13 @@ core unix fido2 test:
script:
- cd core
- pipenv run make test_emu_fido2
- cp /var/tmp/trezor.log ${CI_PROJECT_DIR}
- sync
- sleep 1
- mv ./src/.coverage .coverage.test_emu_fido2
artifacts:
name: core-unix-fido2-test
paths:
- trezor.log
- tests/trezor.log
- tests/junit.xml
- core/.coverage.*
expire_in: 1 week
@ -186,11 +180,10 @@ core unix click test:
script:
- cd core
- pipenv run make test_emu_click
- cp /var/tmp/trezor.log ${CI_PROJECT_DIR}
artifacts:
name: core-unix-click-test
paths:
- trezor.log
- tests/trezor.log
- tests/junit.xml
reports:
junit: tests/junit.xml

View File

@ -38,11 +38,13 @@ FIRMWARE_MAXSIZE = 1703936
GITREV=$(shell git describe --always --dirty | tr '-' '_')
CFLAGS += -DGITREV=$(GITREV)
TESTPATH = $(CURDIR)/../tests
EMU = $(CURDIR)/emu.py
EMU_TEST_ARGS = --disable-animation --headless --quiet --temporary-profile
EMU_LOG_FILE ?= $(TESTPATH)/trezor.log
EMU_TEST_ARGS = --disable-animation --headless --output=$(EMU_LOG_FILE) --temporary-profile
EMU_TEST = $(EMU) $(EMU_TEST_ARGS) -c
TESTPATH = $(CURDIR)/../tests
JUNIT_XML ?= $(TESTPATH)/junit.xml
PYTEST = pytest --junitxml=$(JUNIT_XML)
TREZOR_FIDO2_UDP_PORT = 21326

View File

@ -10,7 +10,11 @@ upy_pid=""
# run emulator if RUN_TEST_EMU
if [[ $RUN_TEST_EMU > 0 ]]; then
../emu.py --disable-animation --temporary-profile --quiet --headless &
../emu.py \
--disable-animation \
--temporary-profile \
--headless \
--output=../../tests/trezor.log &
upy_pid=$!
trezorctl -v wait-for-emulator
fi

View File

@ -59,8 +59,7 @@ To use the "all all all" seed defined in [SLIP-14](https://github.com/satoshilab
Internal Trezor's storage is emulated and stored in the `/var/tmp/trezor.flash` file on
default. Deleting this file is similar to calling _wipe device_. You can also find
`/var/tmp/trezor.sdcard` for SD card and `/var/tmp/trezor.log`, which contains the
communication log, the same as is in the emulator's stdout.
`/var/tmp/trezor.sdcard` for SD card.
You can specify a different location for the storage and log files via the `-p` /
`--profile` option:
@ -81,6 +80,12 @@ You can also set a full profile path to `TREZOR_PROFILE_DIR` environment variabl
Specifying `-t` / `--temporary-profile` will start the emulator in a clean temporary
profile that will be erased when the emulator stops. This is useful, e.g., for tests.
### Logging
By default, emulator output goes to stdout. When silenced with `--quiet`, it is
redirected to `${TREZOR_PROFILE_DIR}/trezor.log`. You can specify an alternate output
file with `--output`.
### Running subcommands with the emulator
In scripts, it is often necessary to start the emulator, run a commmand while it is