From a28f29708fb0c19663bf9d3faceb2e48d76b929b Mon Sep 17 00:00:00 2001 From: Tomas Susanka Date: Thu, 2 Jan 2020 17:55:37 +0000 Subject: [PATCH] ci: add junit for a nice tests overview --- ci/test.yml | 82 +++++++++++++++++++++--- core/tests/run_tests_click_emu.sh | 2 +- core/tests/run_tests_device_emu.sh | 2 +- core/tests/run_tests_device_emu_fido2.sh | 2 +- legacy/script/test | 2 +- storage/tests/Makefile | 4 +- tests/.gitignore | 1 + 7 files changed, 79 insertions(+), 16 deletions(-) create mode 100644 tests/.gitignore diff --git a/ci/test.yml b/ci/test.yml index 10265d870..f15f1b9d8 100644 --- a/ci/test.yml +++ b/ci/test.yml @@ -48,10 +48,13 @@ core unix device test: - pipenv run make test_emu - cp /var/tmp/trezor.log ${CI_PROJECT_DIR} artifacts: - name: core-unix-device-test.log + name: core-unix-device-test paths: - trezor.log + - tests/junit.xml expire_in: 1 week + reports: + junit: tests/junit.xml core unix btconly device test: stage: test @@ -66,10 +69,13 @@ core unix btconly device test: - pipenv run make test_emu - cp /var/tmp/trezor.log ${CI_PROJECT_DIR} artifacts: - name: core-unix-btconly-device-test.log + name: core-unix-btconly-device-test paths: - trezor.log + - tests/junit.xml expire_in: 1 week + reports: + junit: tests/junit.xml core unix monero test: stage: test @@ -81,7 +87,7 @@ core unix monero test: - pipenv run make test_emu_monero - cp /var/tmp/trezor.log ${CI_PROJECT_DIR} artifacts: - name: core-unix-monero-test.log + name: core-unix-monero-test paths: - trezor.log expire_in: 1 week @@ -98,7 +104,7 @@ core unix u2f test: - pipenv run make test_emu_u2f - cp /var/tmp/trezor.log ${CI_PROJECT_DIR} artifacts: - name: core-unix-u2f-test.log + name: core-unix-u2f-test paths: - trezor.log expire_in: 1 week @@ -113,10 +119,13 @@ core unix fido2 test: - pipenv run make test_emu_fido2 - cp /var/tmp/trezor.log ${CI_PROJECT_DIR} artifacts: - name: core-unix-fido2-test.log + name: core-unix-fido2-test paths: - trezor.log + - tests/junit.xml expire_in: 1 week + reports: + junit: tests/junit.xml core unix click test: stage: test @@ -128,9 +137,12 @@ core unix click test: - pipenv run make test_emu_click - cp /var/tmp/trezor.log ${CI_PROJECT_DIR} artifacts: - name: core-unix-click-test.log + name: core-unix-click-test paths: - trezor.log + - tests/junit.xml + reports: + junit: tests/junit.xml expire_in: 1 week core unix upgrade test: @@ -142,7 +154,14 @@ core unix upgrade test: TREZOR_UPGRADE_TEST: "core" script: - tests/download_emulators.sh - - pipenv run pytest tests/upgrade_tests + - pipenv run pytest --junitxml=tests/junit.xml tests/upgrade_tests + artifacts: + name: core-unix-upgrade-test + paths: + - tests/junit.xml + reports: + junit: tests/junit.xml + expire_in: 1 week core unix persistence test: stage: test @@ -150,7 +169,14 @@ core unix persistence test: dependencies: - core unix frozen debug build script: - - pipenv run pytest tests/persistence_tests + - pipenv run pytest --junitxml=tests/junit.xml tests/persistence_tests + artifacts: + name: core-unix-persistence-test + paths: + - tests/junit.xml + reports: + junit: tests/junit.xml + expire_in: 1 week core mypy test: stage: test @@ -178,8 +204,15 @@ crypto test: - ./tests/aestst - ./tests/test_check - ./tests/test_openssl 1000 - - ITERS=10 pipenv run pytest tests + - ITERS=10 pipenv run pytest --junitxml=tests/junit.xml tests - CK_TIMEOUT_MULTIPLIER=20 valgrind -q --error-exitcode=1 ./tests/test_check + artifacts: + name: crypto-test + paths: + - tests/junit.xml + reports: + junit: tests/junit.xml + expire_in: 1 week # Legacy @@ -194,6 +227,13 @@ legacy emu test: script: - cd legacy - pipenv run script/test + artifacts: + name: legacy-emu-test + paths: + - tests/junit.xml + reports: + junit: tests/junit.xml + expire_in: 1 week legacy emu btconly test: stage: test @@ -207,6 +247,14 @@ legacy emu btconly test: script: - cd legacy - pipenv run script/test + artifacts: + name: legacy-emu-btconly-test + paths: + - tests/junit.xml + reports: + junit: tests/junit.xml + expire_in: 1 week + legacy emu upgrade test: stage: test @@ -217,7 +265,14 @@ legacy emu upgrade test: TREZOR_UPGRADE_TEST: "legacy" script: - tests/download_emulators.sh - - pipenv run pytest tests/upgrade_tests + - pipenv run pytest --junitxml=tests/junit.xml tests/upgrade_tests + artifacts: + name: legacy-emu-upgrade-test + paths: + - tests/junit.xml + reports: + junit: tests/junit.xml + expire_in: 1 week # Python @@ -247,3 +302,10 @@ storage test: - cd storage/tests - pipenv run make build - pipenv run make tests_all + artifacts: + name: storage-test + paths: + - tests/junit.xml + reports: + junit: tests/junit.xml + expire_in: 1 week diff --git a/core/tests/run_tests_click_emu.sh b/core/tests/run_tests_click_emu.sh index 5a2d2294a..80e9e52b9 100755 --- a/core/tests/run_tests_click_emu.sh +++ b/core/tests/run_tests_click_emu.sh @@ -31,7 +31,7 @@ fi # run tests error=0 -if ! pytest ../../tests/click_tests "$@"; then +if ! pytest --junitxml=../../tests/junit.xml ../../tests/click_tests "$@"; then error=1 fi kill $upy_pid diff --git a/core/tests/run_tests_device_emu.sh b/core/tests/run_tests_device_emu.sh index 9a21365c9..ad0b072de 100755 --- a/core/tests/run_tests_device_emu.sh +++ b/core/tests/run_tests_device_emu.sh @@ -31,7 +31,7 @@ fi # run tests error=0 -if ! pytest ../../tests/device_tests "$@"; then +if ! pytest --junitxml=../../tests/junit.xml ../../tests/device_tests "$@"; then error=1 fi kill $upy_pid diff --git a/core/tests/run_tests_device_emu_fido2.sh b/core/tests/run_tests_device_emu_fido2.sh index 24cfeee78..e06a650f7 100755 --- a/core/tests/run_tests_device_emu_fido2.sh +++ b/core/tests/run_tests_device_emu_fido2.sh @@ -33,7 +33,7 @@ cd ../../tests/fido_tests/fido2 # run tests error=0 export TREZOR_FIDO2_UDP_PORT=21326 -if ! pytest --sim tests/standard/ --vendor trezor "$@"; then +if ! pytest --junitxml=../../tests/junit.xml --sim tests/standard/ --vendor trezor "$@"; then error=1 fi kill $upy_pid diff --git a/legacy/script/test b/legacy/script/test index 03a0427b5..ee45326d2 100755 --- a/legacy/script/test +++ b/legacy/script/test @@ -16,4 +16,4 @@ if [ "$EMULATOR" = 1 ]; then "${PYTHON:-python}" script/wait_for_emulator.py fi -"${PYTHON:-python}" -m pytest ../tests/device_tests "$@" +"${PYTHON:-python}" -m pytest --junitxml=../tests/junit.xml ../tests/device_tests "$@" diff --git a/storage/tests/Makefile b/storage/tests/Makefile index 16cc25552..e9d8ac17c 100644 --- a/storage/tests/Makefile +++ b/storage/tests/Makefile @@ -6,7 +6,7 @@ build: ## tests commands: tests: - pytest -k "not hypothesis" + pytest --junitxml=../../tests/junit.xml -k "not hypothesis" tests_all: - pytest + pytest --junitxml=../../tests/junit.xml diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 000000000..9d6ffe384 --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1 @@ +junit.xml