Merge pull request #5649 from microDev1/traceback

Run test for traceback module
This commit is contained in:
Jeff Epler 2021-12-02 08:51:53 -06:00 committed by GitHub
commit 5797b68153
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 46 additions and 12 deletions

View File

@ -36,6 +36,7 @@ SRC_BITMAP := \
shared-bindings/bitmaptools/__init__.c \ shared-bindings/bitmaptools/__init__.c \
shared-bindings/displayio/Bitmap.c \ shared-bindings/displayio/Bitmap.c \
shared-bindings/rainbowio/__init__.c \ shared-bindings/rainbowio/__init__.c \
shared-bindings/traceback/__init__.c \
shared-bindings/util.c \ shared-bindings/util.c \
shared-module/aesio/aes.c \ shared-module/aesio/aes.c \
shared-module/aesio/__init__.c \ shared-module/aesio/__init__.c \
@ -45,11 +46,18 @@ SRC_BITMAP := \
shared-module/displayio/ColorConverter.c \ shared-module/displayio/ColorConverter.c \
shared-module/displayio/ColorConverter.c \ shared-module/displayio/ColorConverter.c \
shared-module/rainbowio/__init__.c \ shared-module/rainbowio/__init__.c \
shared-module/traceback/__init__.c
$(info $(SRC_BITMAP)) $(info $(SRC_BITMAP))
SRC_C += $(SRC_BITMAP) SRC_C += $(SRC_BITMAP)
CFLAGS += -DCIRCUITPY_GIFIO=1 -DCIRCUITPY_DISPLAYIO_UNIX=1 -DCIRCUITPY_BITMAPTOOLS=1 -DCIRCUITPY_RAINBOWIO=1 -DCIRCUITPY_AESIO=1 CFLAGS += \
-DCIRCUITPY_AESIO=1 \
-DCIRCUITPY_BITMAPTOOLS=1 \
-DCIRCUITPY_DISPLAYIO_UNIX=1 \
-DCIRCUITPY_GIFIO=1 \
-DCIRCUITPY_RAINBOWIO=1 \
-DCIRCUITPY_TRACEBACK=1
SRC_C += coverage.c SRC_C += coverage.c
SRC_CXX += coveragecpp.cpp SRC_CXX += coveragecpp.cpp

View File

@ -85,9 +85,9 @@ STATIC void traceback_exception_common(mp_print_t *print, mp_obj_t value, mp_obj
STATIC mp_obj_t traceback_format_exception(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { STATIC mp_obj_t traceback_format_exception(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_etype, ARG_value, ARG_tb, ARG_limit, ARG_chain }; enum { ARG_etype, ARG_value, ARG_tb, ARG_limit, ARG_chain };
static const mp_arg_t allowed_args[] = { static const mp_arg_t allowed_args[] = {
{ MP_QSTR_etype, MP_ARG_OBJ | MP_ARG_REQUIRED }, { MP_QSTR_etype, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_value, MP_ARG_OBJ | MP_ARG_REQUIRED }, { MP_QSTR_value, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_tb, MP_ARG_OBJ | MP_ARG_REQUIRED }, { MP_QSTR_tb, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_limit, MP_ARG_OBJ, {.u_obj = mp_const_none} }, { MP_QSTR_limit, MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_chain, MP_ARG_BOOL, {.u_bool = true} }, { MP_QSTR_chain, MP_ARG_BOOL, {.u_bool = true} },
}; };
@ -127,9 +127,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(traceback_format_exception_obj, 0, traceback_f
STATIC mp_obj_t traceback_print_exception(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { STATIC mp_obj_t traceback_print_exception(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_etype, ARG_value, ARG_tb, ARG_limit, ARG_file, ARG_chain }; enum { ARG_etype, ARG_value, ARG_tb, ARG_limit, ARG_file, ARG_chain };
static const mp_arg_t allowed_args[] = { static const mp_arg_t allowed_args[] = {
{ MP_QSTR_etype, MP_ARG_OBJ | MP_ARG_REQUIRED }, { MP_QSTR_etype, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_value, MP_ARG_OBJ | MP_ARG_REQUIRED }, { MP_QSTR_value, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_tb, MP_ARG_OBJ | MP_ARG_REQUIRED }, { MP_QSTR_tb, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_limit, MP_ARG_OBJ, {.u_obj = mp_const_none} }, { MP_QSTR_limit, MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_file, MP_ARG_OBJ, {.u_obj = mp_const_none} }, { MP_QSTR_file, MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_chain, MP_ARG_BOOL, {.u_bool = true} }, { MP_QSTR_chain, MP_ARG_BOOL, {.u_bool = true} },

View File

@ -0,0 +1,23 @@
No Trace:
Exception: test
Default Trace:
Traceback (most recent call last):
File "circuitpython/traceback_test.py", line 13, in <module>
File "circuitpython/traceback_test.py", line 9, in fun
Exception: test
Limit=1 Trace:
Traceback (most recent call last):
File "circuitpython/traceback_test.py", line 13, in <module>
Exception: test
Limit=0 Trace:
Exception: test
Limit=-1 Trace:
Traceback (most recent call last):
File "circuitpython/traceback_test.py", line 9, in fun
Exception: test

View File

@ -511,6 +511,9 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
skip_tests.add("basics/scope_implicit.py") # requires checking for unbound local skip_tests.add("basics/scope_implicit.py") # requires checking for unbound local
skip_tests.add("basics/try_finally_return2.py") # requires raise_varargs skip_tests.add("basics/try_finally_return2.py") # requires raise_varargs
skip_tests.add("basics/unboundlocal.py") # requires checking for unbound local skip_tests.add("basics/unboundlocal.py") # requires checking for unbound local
skip_tests.add(
"circuitpython/traceback_test.py"
) # because native doesn't have proper traceback info
skip_tests.add("extmod/uasyncio_event.py") # unknown issue skip_tests.add("extmod/uasyncio_event.py") # unknown issue
skip_tests.add("extmod/uasyncio_lock.py") # requires async with skip_tests.add("extmod/uasyncio_lock.py") # requires async with
skip_tests.add("extmod/uasyncio_micropython.py") # unknown issue skip_tests.add("extmod/uasyncio_micropython.py") # unknown issue

View File

@ -35,11 +35,11 @@ cexample cmath collections cppexample
displayio errno ffi framebuf displayio errno ffi framebuf
gc gifio hashlib json gc gifio hashlib json
math qrio rainbowio re math qrio rainbowio re
sys termios ubinascii uctypes sys termios traceback ubinascii
uerrno uheapq uio ujson uctypes uerrno uheapq uio
ulab uos urandom ure ujson ulab uos urandom
uselect ustruct utime utimeq ure uselect ustruct utime
uzlib utimeq uzlib
ime ime
utime utimeq utime utimeq