ci: use explicit trezor.log location

pull/796/head
matejcik 4 years ago
parent 32b269ad43
commit 6cf48bf485

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

@ -38,11 +38,13 @@ FIRMWARE_MAXSIZE = 1703936
GITREV=$(shell git describe --always --dirty | tr '-' '_') GITREV=$(shell git describe --always --dirty | tr '-' '_')
CFLAGS += -DGITREV=$(GITREV) CFLAGS += -DGITREV=$(GITREV)
TESTPATH = $(CURDIR)/../tests
EMU = $(CURDIR)/emu.py 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 EMU_TEST = $(EMU) $(EMU_TEST_ARGS) -c
TESTPATH = $(CURDIR)/../tests
JUNIT_XML ?= $(TESTPATH)/junit.xml JUNIT_XML ?= $(TESTPATH)/junit.xml
PYTEST = pytest --junitxml=$(JUNIT_XML) PYTEST = pytest --junitxml=$(JUNIT_XML)
TREZOR_FIDO2_UDP_PORT = 21326 TREZOR_FIDO2_UDP_PORT = 21326

@ -10,7 +10,11 @@ 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
../emu.py --disable-animation --temporary-profile --quiet --headless & ../emu.py \
--disable-animation \
--temporary-profile \
--headless \
--output=../../tests/trezor.log &
upy_pid=$! upy_pid=$!
trezorctl -v wait-for-emulator trezorctl -v wait-for-emulator
fi fi

@ -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 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 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 `/var/tmp/trezor.sdcard` for SD card.
communication log, the same as is in the emulator's stdout.
You can specify a different location for the storage and log files via the `-p` / You can specify a different location for the storage and log files via the `-p` /
`--profile` option: `--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 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. 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 ### Running subcommands with the emulator
In scripts, it is often necessary to start the emulator, run a commmand while it is In scripts, it is often necessary to start the emulator, run a commmand while it is

Loading…
Cancel
Save