diff --git a/core/emu.py b/core/emu.py index a227bf374..95432b8be 100755 --- a/core/emu.py +++ b/core/emu.py @@ -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(): diff --git a/core/prof/prof.py b/core/prof/prof.py index 6839fe000..75703ed05 100644 --- a/core/prof/prof.py +++ b/core/prof/prof.py @@ -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