1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 15:38:11 +00:00

core/prof: make sure coverage data is generated with absolute paths

This commit is contained in:
matejcik 2020-01-21 14:25:54 +01:00
parent 34332cc294
commit a3d309eca2
2 changed files with 5 additions and 1 deletions

View File

@ -217,6 +217,7 @@ def cli(
TREZOR_PROFILE_DIR=str(profile_dir.resolve()),
TREZOR_UDP_PORT=str(emulator.port),
TREZOR_FIDO2_UDP_PORT=str(emulator.port + 2),
TREZOR_SRC=str(SRC_DIR),
)
os.environ.update(emulator_env)
for k, v in emulator_env.items():

View File

@ -1,11 +1,14 @@
import sys
from uio import open
from uos import getenv
# We need to insert "" to sys.path so that the frozen build can import main from the
# frozen modules, and regular build can import it from current directory.
sys.path.insert(0, "")
PATH_PREFIX = (getenv("TREZOR_SRC") or ".") + "/"
class Coverage:
def __init__(self):
@ -22,7 +25,7 @@ class Coverage:
this_file = globals()["__file__"]
for filename in self.__files:
if not filename == this_file:
lines[filename] = list(self.__files[filename])
lines[PATH_PREFIX + filename] = list(self.__files[filename])
return lines_execution