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

pull/796/head
matejcik 4 years ago
parent 34332cc294
commit a3d309eca2

@ -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():

@ -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

Loading…
Cancel
Save