run test for traceback module

This commit is contained in:
microDev 2021-12-02 11:11:11 +05:30
parent b83e09858f
commit 69faaa52b8
No known key found for this signature in database
GPG Key ID: 2C0867BE60967730
5 changed files with 46 additions and 12 deletions

View File

@ -36,6 +36,7 @@ SRC_BITMAP := \
shared-bindings/bitmaptools/__init__.c \
shared-bindings/displayio/Bitmap.c \
shared-bindings/rainbowio/__init__.c \
shared-bindings/traceback/__init__.c \
shared-bindings/util.c \
shared-module/aesio/aes.c \
shared-module/aesio/__init__.c \
@ -45,11 +46,18 @@ SRC_BITMAP := \
shared-module/displayio/ColorConverter.c \
shared-module/displayio/ColorConverter.c \
shared-module/rainbowio/__init__.c \
shared-module/traceback/__init__.c
$(info $(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_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) {
enum { ARG_etype, ARG_value, ARG_tb, ARG_limit, ARG_chain };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_etype, MP_ARG_OBJ | MP_ARG_REQUIRED },
{ MP_QSTR_value, MP_ARG_OBJ | MP_ARG_REQUIRED },
{ MP_QSTR_tb, 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, {.u_obj = MP_OBJ_NULL} },
{ 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_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) {
enum { ARG_etype, ARG_value, ARG_tb, ARG_limit, ARG_file, ARG_chain };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_etype, MP_ARG_OBJ | MP_ARG_REQUIRED },
{ MP_QSTR_value, MP_ARG_OBJ | MP_ARG_REQUIRED },
{ MP_QSTR_tb, 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, {.u_obj = MP_OBJ_NULL} },
{ 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_file, MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ 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/try_finally_return2.py") # requires raise_varargs
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_lock.py") # requires async with
skip_tests.add("extmod/uasyncio_micropython.py") # unknown issue

View File

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