Skip to content

Commit ff8c4e5

Browse files
jeplerdpgeorge
authored andcommitted
tests/misc: Improve test coverage of py/profile.c.
Signed-off-by: Jeff Epler <jepler@gmail.com>
1 parent fcfed6a commit ff8c4e5

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

tests/misc/sys_settrace_cov.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import sys
2+
3+
try:
4+
sys.settrace
5+
except AttributeError:
6+
print("SKIP")
7+
raise SystemExit
8+
9+
10+
def trace_tick_handler(frame, event, arg):
11+
print("FRAME", frame)
12+
print("LASTI", frame.f_lasti)
13+
return None
14+
15+
16+
def f():
17+
x = 3
18+
return x
19+
20+
21+
sys.settrace(trace_tick_handler)
22+
f()
23+
sys.settrace(None)

tests/misc/sys_settrace_cov.py.exp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FRAME <frame at 0x\[0-9a-f\]\+, file '\.\*/sys_settrace_cov.py', line \\d\+, code f>
2+
LASTI \\d\+

tests/run-tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ def run_script_on_remote_target(pyb, args, test_file, is_special):
354354
"micropython/meminfo.py",
355355
"basics/bytes_compare3.py",
356356
"basics/builtin_help.py",
357+
"misc/sys_settrace_cov.py",
357358
"thread/thread_exc2.py",
358359
"ports/esp32/partition_ota.py",
359360
)

0 commit comments

Comments
 (0)