tests/misc: Improve test coverage of py/profile.c.
Signed-off-by: Jeff Epler <jepler@gmail.com>
This commit is contained in:
committed by
Damien George
parent
fcfed6a0ea
commit
ff8c4e5943
23
tests/misc/sys_settrace_cov.py
Normal file
23
tests/misc/sys_settrace_cov.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
try:
|
||||||
|
sys.settrace
|
||||||
|
except AttributeError:
|
||||||
|
print("SKIP")
|
||||||
|
raise SystemExit
|
||||||
|
|
||||||
|
|
||||||
|
def trace_tick_handler(frame, event, arg):
|
||||||
|
print("FRAME", frame)
|
||||||
|
print("LASTI", frame.f_lasti)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def f():
|
||||||
|
x = 3
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
sys.settrace(trace_tick_handler)
|
||||||
|
f()
|
||||||
|
sys.settrace(None)
|
||||||
2
tests/misc/sys_settrace_cov.py.exp
Normal file
2
tests/misc/sys_settrace_cov.py.exp
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
FRAME <frame at 0x\[0-9a-f\]\+, file '\.\*/sys_settrace_cov.py', line \\d\+, code f>
|
||||||
|
LASTI \\d\+
|
||||||
@@ -354,6 +354,7 @@ special_tests = [
|
|||||||
"micropython/meminfo.py",
|
"micropython/meminfo.py",
|
||||||
"basics/bytes_compare3.py",
|
"basics/bytes_compare3.py",
|
||||||
"basics/builtin_help.py",
|
"basics/builtin_help.py",
|
||||||
|
"misc/sys_settrace_cov.py",
|
||||||
"thread/thread_exc2.py",
|
"thread/thread_exc2.py",
|
||||||
"ports/esp32/partition_ota.py",
|
"ports/esp32/partition_ota.py",
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user