1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-10-15 20:39:06 +00:00
Commit Graph

6 Commits

Author SHA1 Message Date
matejcik
1d41141a1f core/emulator: properly ignore inotify problems (fixes #854) 2020-02-17 12:33:38 +01:00
matejcik
4c8c96272c emu: fix flag options with defaults
Click REALLY INSISTS you provide on/off switches for your options.
You can use is_flag, but then the presence of the option changes based
on the default value.

Which makes sense, really:
@option("-f", "foobar", is_flag=True, default=False)
you would expect `./cli -f` to have `foobar is True`

whereas with
@option("-f", "foobar", is_flag=True, default=True)
you would expect `./cli -f` to have `foobar is False`, otherwise it's a
no-op

this becomes fun with `default=os.environ.get("SOMETHING")`, because
then the effect of the option CHANGES with a value of environment
variable!

there's two ways around this:
a) don't use defaults, update the flag explicitly, like:
   foobar = foobar or os.environ.get("FOOBAR") == "1"
b) forget about is_flag and specify an on/off switch, where the default
   value works as intended

since the latter is also technically speaking more correct, i'm doing it
2020-02-12 13:32:05 +01:00
matejcik
271da3fa39 python: add detailed logging to emulator runner 2020-02-12 13:31:58 +01:00
Tomas Susanka
4850eaf534 emu.py: remove frozen variable 2020-01-30 14:47:11 +00:00
matejcik
a3d309eca2 core/prof: make sure coverage data is generated with absolute paths 2020-01-23 18:43:20 +01:00
matejcik
8dce2cf98c core: introduce emulator runner (fixes #466) 2020-01-23 18:43:20 +01:00