Skip to content

Commit 562fa57

Browse files
committed
qemu-arm: Handle sys.exit() to allow skip tests in testsuite.
1 parent 992284b commit 562fa57

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

qemu-arm/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#define MICROPY_PY_BUILTINS_FROZENSET (1)
1919
#define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
2020
#define MICROPY_PY_IO (0)
21+
#define MICROPY_PY_SYS_EXIT (1)
2122

2223
// type definitions for the specific machine
2324

qemu-arm/test_main.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,15 @@ inline void do_str(const char *src) {
3131
mp_call_function_0(module_fun);
3232
nlr_pop();
3333
} else {
34-
mp_obj_print_exception(printf_wrapper, NULL, (mp_obj_t)nlr.ret_val);
34+
mp_obj_t exc = (mp_obj_t)nlr.ret_val;
35+
if (mp_obj_is_subclass_fast(mp_obj_get_type(exc), &mp_type_SystemExit)) {
36+
// Assume that sys.exit() is called to skip the test.
37+
// TODO: That can be always true, we should set up convention to
38+
// use specific exit code as skip indicator.
39+
tinytest_set_test_skipped_();
40+
return;
41+
}
42+
mp_obj_print_exception(printf_wrapper, NULL, exc);
3543
tt_abort_msg("Uncaught exception");
3644
}
3745
end:

0 commit comments

Comments
 (0)