summaryrefslogtreecommitdiff
path: root/ports/unix/coverage.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2020-02-06 20:26:29 +1100
committerDamien George <damien.p.george@gmail.com>2020-02-07 16:08:29 +1100
commiteaf30c516af87104b7fbba7fcd557d097a4951f9 (patch)
treeba46d4c97a37f8d72145930946c59fb1994deb8f /ports/unix/coverage.c
parent9efb36bfa66d5846c14f21778c25dff7dd733826 (diff)
tests/unix: Add coverage tests for kbd-intr and scheduler.
Diffstat (limited to 'ports/unix/coverage.c')
-rw-r--r--ports/unix/coverage.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/ports/unix/coverage.c b/ports/unix/coverage.c
index 0703d0a33..8978931ed 100644
--- a/ports/unix/coverage.c
+++ b/ports/unix/coverage.c
@@ -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