kopia lustrzana https://github.com/micropython/micropython
tests/unix: Add coverage tests for kbd-intr and scheduler.
rodzic
9efb36bfa6
commit
eaf30c516a
|
@ -476,6 +476,32 @@ STATIC mp_obj_t extra_coverage(void) {
|
|||
while (mp_sched_num_pending()) {
|
||||
mp_handle_pending(true);
|
||||
}
|
||||
|
||||
// setting the keyboard interrupt and raising it during mp_handle_pending
|
||||
mp_keyboard_interrupt();
|
||||
nlr_buf_t nlr;
|
||||
if (nlr_push(&nlr) == 0) {
|
||||
mp_handle_pending(true);
|
||||
nlr_pop();
|
||||
} else {
|
||||
mp_obj_print_exception(&mp_plat_print, MP_OBJ_FROM_PTR(nlr.ret_val));
|
||||
}
|
||||
|
||||
// setting the keyboard interrupt (twice) and cancelling it during mp_handle_pending
|
||||
mp_keyboard_interrupt();
|
||||
mp_keyboard_interrupt();
|
||||
mp_handle_pending(false);
|
||||
|
||||
// setting keyboard interrupt and a pending event (intr should be handled first)
|
||||
mp_sched_schedule(MP_OBJ_FROM_PTR(&mp_builtin_print_obj), MP_OBJ_NEW_SMALL_INT(10));
|
||||
mp_keyboard_interrupt();
|
||||
if (nlr_push(&nlr) == 0) {
|
||||
mp_handle_pending(true);
|
||||
nlr_pop();
|
||||
} else {
|
||||
mp_obj_print_exception(&mp_plat_print, MP_OBJ_FROM_PTR(nlr.ret_val));
|
||||
}
|
||||
mp_handle_pending(true);
|
||||
}
|
||||
|
||||
// ringbuf
|
||||
|
|
|
@ -80,6 +80,9 @@ unlocked
|
|||
1
|
||||
2
|
||||
3
|
||||
KeyboardInterrupt:
|
||||
KeyboardInterrupt:
|
||||
10
|
||||
# ringbuf
|
||||
99 0
|
||||
98 1
|
||||
|
|
Ładowanie…
Reference in New Issue