mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
core/ci: add coverage target, introduce posttest stage
This commit is contained in:
parent
62e9ff0ad2
commit
33b7e378c2
@ -26,6 +26,7 @@ stages:
|
|||||||
- prebuild
|
- prebuild
|
||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
|
- posttest
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
@ -36,4 +37,5 @@ include:
|
|||||||
- ci/prebuild.yml
|
- ci/prebuild.yml
|
||||||
- ci/build.yml
|
- ci/build.yml
|
||||||
- ci/test.yml
|
- ci/test.yml
|
||||||
|
- ci/posttest.yml
|
||||||
- ci/deploy.yml
|
- ci/deploy.yml
|
||||||
|
21
ci/posttest.yml
Normal file
21
ci/posttest.yml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
image: registry.gitlab.com/satoshilabs/trezor/trezor-firmware/environment
|
||||||
|
|
||||||
|
core unix coverage posttest:
|
||||||
|
stage: posttest
|
||||||
|
dependencies:
|
||||||
|
- core unix device test
|
||||||
|
- core unix monero test
|
||||||
|
- core unix u2f test
|
||||||
|
- core unix fido2 test
|
||||||
|
script:
|
||||||
|
- cd core
|
||||||
|
- pipenv run make res # we need to regenerate resources.py
|
||||||
|
- pipenv run make coverage
|
||||||
|
coverage: '/>\d+%</'
|
||||||
|
artifacts:
|
||||||
|
name: core-unix-coverage-posttest
|
||||||
|
paths:
|
||||||
|
- core/.coverage.*
|
||||||
|
- core/htmlcov
|
||||||
|
expire_in: 1 week
|
||||||
|
|
24
ci/test.yml
24
ci/test.yml
@ -43,15 +43,21 @@ core unix device test:
|
|||||||
<<: *only_changes_core
|
<<: *only_changes_core
|
||||||
dependencies:
|
dependencies:
|
||||||
- core unix frozen regular build
|
- core unix frozen regular build
|
||||||
|
variables:
|
||||||
|
TREZOR_PROFILING: 1
|
||||||
script:
|
script:
|
||||||
- cd core
|
- cd core
|
||||||
- pipenv run make test_emu
|
- pipenv run make test_emu
|
||||||
- cp /var/tmp/trezor.log ${CI_PROJECT_DIR}
|
- cp /var/tmp/trezor.log ${CI_PROJECT_DIR}
|
||||||
|
- sync
|
||||||
|
- sleep 1
|
||||||
|
- mv ./src/.coverage .coverage.test_emu
|
||||||
artifacts:
|
artifacts:
|
||||||
name: core-unix-device-test
|
name: core-unix-device-test
|
||||||
paths:
|
paths:
|
||||||
- trezor.log
|
- trezor.log
|
||||||
- tests/junit.xml
|
- tests/junit.xml
|
||||||
|
- core/.coverage.*
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
when: always
|
when: always
|
||||||
reports:
|
reports:
|
||||||
@ -84,14 +90,20 @@ core unix monero test:
|
|||||||
<<: *only_changes_core
|
<<: *only_changes_core
|
||||||
dependencies:
|
dependencies:
|
||||||
- core unix frozen regular build
|
- core unix frozen regular build
|
||||||
|
variables:
|
||||||
|
TREZOR_PROFILING: 1
|
||||||
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}
|
- cp /var/tmp/trezor.log ${CI_PROJECT_DIR}
|
||||||
|
- sync
|
||||||
|
- sleep 1
|
||||||
|
- mv ./src/.coverage .coverage.test_emu_monero
|
||||||
artifacts:
|
artifacts:
|
||||||
name: core-unix-monero-test
|
name: core-unix-monero-test
|
||||||
paths:
|
paths:
|
||||||
- trezor.log
|
- trezor.log
|
||||||
|
- core/.coverage.*
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
when: always
|
when: always
|
||||||
|
|
||||||
@ -101,15 +113,21 @@ core unix u2f test:
|
|||||||
retry: 2 # see https://github.com/trezor/trezor-firmware/issues/596
|
retry: 2 # see https://github.com/trezor/trezor-firmware/issues/596
|
||||||
dependencies:
|
dependencies:
|
||||||
- core unix frozen regular build
|
- core unix frozen regular build
|
||||||
|
variables:
|
||||||
|
TREZOR_PROFILING: 1
|
||||||
script:
|
script:
|
||||||
- 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}
|
- cp /var/tmp/trezor.log ${CI_PROJECT_DIR}
|
||||||
|
- sync
|
||||||
|
- sleep 1
|
||||||
|
- mv ./src/.coverage .coverage.test_emu_u2f
|
||||||
artifacts:
|
artifacts:
|
||||||
name: core-unix-u2f-test
|
name: core-unix-u2f-test
|
||||||
paths:
|
paths:
|
||||||
- trezor.log
|
- trezor.log
|
||||||
|
- core/.coverage.*
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
when: always
|
when: always
|
||||||
|
|
||||||
@ -118,15 +136,21 @@ core unix fido2 test:
|
|||||||
<<: *only_changes_core
|
<<: *only_changes_core
|
||||||
dependencies:
|
dependencies:
|
||||||
- core unix frozen regular build
|
- core unix frozen regular build
|
||||||
|
variables:
|
||||||
|
TREZOR_PROFILING: 1
|
||||||
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}
|
- cp /var/tmp/trezor.log ${CI_PROJECT_DIR}
|
||||||
|
- sync
|
||||||
|
- sleep 1
|
||||||
|
- mv ./src/.coverage .coverage.test_emu_fido2
|
||||||
artifacts:
|
artifacts:
|
||||||
name: core-unix-fido2-test
|
name: core-unix-fido2-test
|
||||||
paths:
|
paths:
|
||||||
- trezor.log
|
- trezor.log
|
||||||
- tests/junit.xml
|
- tests/junit.xml
|
||||||
|
- core/.coverage.*
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
reports:
|
reports:
|
||||||
junit: tests/junit.xml
|
junit: tests/junit.xml
|
||||||
|
@ -234,3 +234,10 @@ upload: ## upload firmware using trezorctl
|
|||||||
|
|
||||||
upload_prodtest: ## upload prodtest using trezorctl
|
upload_prodtest: ## upload prodtest using trezorctl
|
||||||
trezorctl firmware_update -f $(PRODTEST_BUILD_DIR)/prodtest.bin
|
trezorctl firmware_update -f $(PRODTEST_BUILD_DIR)/prodtest.bin
|
||||||
|
|
||||||
|
coverage: # generate coverage report
|
||||||
|
coverage run --source=./src /dev/null 2>/dev/null && \
|
||||||
|
mv .coverage .coverage.empty && \
|
||||||
|
coverage combine .coverage.* && \
|
||||||
|
coverage html
|
||||||
|
grep pc_cov htmlcov/index.html
|
||||||
|
@ -265,6 +265,7 @@ SOURCE_MICROPYTHON = [
|
|||||||
'vendor/micropython/py/parsenum.c',
|
'vendor/micropython/py/parsenum.c',
|
||||||
'vendor/micropython/py/parsenumbase.c',
|
'vendor/micropython/py/parsenumbase.c',
|
||||||
'vendor/micropython/py/persistentcode.c',
|
'vendor/micropython/py/persistentcode.c',
|
||||||
|
'vendor/micropython/py/profile.c',
|
||||||
'vendor/micropython/py/pystack.c',
|
'vendor/micropython/py/pystack.c',
|
||||||
'vendor/micropython/py/qstr.c',
|
'vendor/micropython/py/qstr.c',
|
||||||
'vendor/micropython/py/reader.c',
|
'vendor/micropython/py/reader.c',
|
||||||
@ -295,6 +296,7 @@ SOURCE_UNIX = [
|
|||||||
'embed/unix/touch.c',
|
'embed/unix/touch.c',
|
||||||
'embed/unix/usb.c',
|
'embed/unix/usb.c',
|
||||||
'vendor/micropython/ports/unix/alloc.c',
|
'vendor/micropython/ports/unix/alloc.c',
|
||||||
|
'vendor/micropython/ports/unix/file.c',
|
||||||
'vendor/micropython/ports/unix/gccollect.c',
|
'vendor/micropython/ports/unix/gccollect.c',
|
||||||
'vendor/micropython/ports/unix/input.c',
|
'vendor/micropython/ports/unix/input.c',
|
||||||
'vendor/micropython/ports/unix/unix_mphal.c',
|
'vendor/micropython/ports/unix/unix_mphal.c',
|
||||||
|
@ -91,3 +91,19 @@ If you wan't to catch some memory errors use this.
|
|||||||
```sh
|
```sh
|
||||||
time ASAN_OPTIONS=verbosity=1:detect_invalid_pointer_pairs=1:strict_init_order=true:strict_string_checks=true TREZOR_PROFILE="" pipenv run make test_emu
|
time ASAN_OPTIONS=verbosity=1:detect_invalid_pointer_pairs=1:strict_init_order=true:strict_string_checks=true TREZOR_PROFILE="" pipenv run make test_emu
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Coverage (Emulator only)
|
||||||
|
|
||||||
|
Get the Python code coverage report.
|
||||||
|
|
||||||
|
If you want to get HTML/console summary output you need to install the __coverage.py__ tool.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
pip3 install coverage
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the tests with coverage output.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make build_unix && make coverage
|
||||||
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user