mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-03-28 22:15:42 +00:00
test(core): allow saving verbose log into a file
[no changelog]
This commit is contained in:
parent
abcbb5c2ab
commit
b07ed98ba4
6
.github/workflows/core-hw.yml
vendored
6
.github/workflows/core-hw.yml
vendored
@ -55,13 +55,15 @@ jobs:
|
|||||||
- run: |
|
- run: |
|
||||||
# log serial console to file; sleep is used because tio needs stdin that is not /dev/null
|
# log serial console to file; sleep is used because tio needs stdin that is not /dev/null
|
||||||
nix-shell --arg hardwareTest true --run "sleep 8h | tio --timestamp --no-autoconnect /dev/ttyTREZOR &> trezor.log" &
|
nix-shell --arg hardwareTest true --run "sleep 8h | tio --timestamp --no-autoconnect /dev/ttyTREZOR &> trezor.log" &
|
||||||
nix-shell --run "poetry run pytest -v tests/device_tests $TESTOPTS"
|
nix-shell --run "poetry run pytest -v --verbose-log-file pytest.log tests/device_tests $TESTOPTS"
|
||||||
- run: tail -n50 trezor.log || true
|
- run: tail -n50 trezor.log || true
|
||||||
if: failure()
|
if: failure()
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: core-hardware-${{ matrix.model }}-${{ matrix.coins }}
|
name: core-hardware-${{ matrix.model }}-${{ matrix.coins }}
|
||||||
path: trezor.log
|
path: |
|
||||||
|
trezor.log
|
||||||
|
pytest.log
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
if: always()
|
if: always()
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
import typing as t
|
import typing as t
|
||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
@ -441,6 +442,12 @@ def pytest_addoption(parser: "Parser") -> None:
|
|||||||
choices=translations.LANGUAGES,
|
choices=translations.LANGUAGES,
|
||||||
help="Run tests with a specified language: 'en' is the default",
|
help="Run tests with a specified language: 'en' is the default",
|
||||||
)
|
)
|
||||||
|
parser.addoption(
|
||||||
|
"--verbose-log-file",
|
||||||
|
action="store",
|
||||||
|
default=None,
|
||||||
|
help="File path for verbose logging",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def pytest_configure(config: "Config") -> None:
|
def pytest_configure(config: "Config") -> None:
|
||||||
@ -469,6 +476,11 @@ def pytest_configure(config: "Config") -> None:
|
|||||||
if verbosity:
|
if verbosity:
|
||||||
log.enable_debug_output(verbosity)
|
log.enable_debug_output(verbosity)
|
||||||
|
|
||||||
|
verbose_log_file = config.getoption("verbose_log_file")
|
||||||
|
if verbose_log_file:
|
||||||
|
handler = logging.FileHandler(verbose_log_file)
|
||||||
|
log.enable_debug_output(verbosity, handler)
|
||||||
|
|
||||||
idval_orig = IdMaker._idval_from_value
|
idval_orig = IdMaker._idval_from_value
|
||||||
|
|
||||||
def idval_from_value(self: IdMaker, val: object) -> str | None:
|
def idval_from_value(self: IdMaker, val: object) -> str | None:
|
||||||
|
Loading…
Reference in New Issue
Block a user