Skip to content

Commit 790aa15

Browse files
committed
nrf: Enable source line on tracebacks. Improve run-tests.
Improve traceback debugging on nrf targets with enough flash, adding missing source line info and improve run-tests to properly handle opt_level and opt_level_lineno tests.
1 parent 0e6ef40 commit 790aa15

8 files changed

+28
-2
lines changed

ports/nrf/mpconfigdevice_nrf51822.h

+8
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,11 @@
5959
#define MICROPY_PY_UBINASCII (1)
6060
#endif
6161
#endif
62+
63+
#ifndef MICROPY_ENABLE_SOURCE_LINE
64+
#if defined(BLUETOOTH_SD)
65+
#define MICROPY_ENABLE_SOURCE_LINE (0)
66+
#else
67+
#define MICROPY_ENABLE_SOURCE_LINE (1)
68+
#endif
69+
#endif

ports/nrf/mpconfigdevice_nrf52832.h

+4
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@
4747
#ifndef MICROPY_PY_UBINASCII
4848
#define MICROPY_PY_UBINASCII (1)
4949
#endif
50+
51+
#ifndef MICROPY_ENABLE_SOURCE_LINE
52+
#define MICROPY_ENABLE_SOURCE_LINE (1)
53+
#endif

ports/nrf/mpconfigdevice_nrf52840.h

+4
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@
4747
#ifndef MICROPY_PY_UBINASCII
4848
#define MICROPY_PY_UBINASCII (1)
4949
#endif
50+
51+
#ifndef MICROPY_ENABLE_SOURCE_LINE
52+
#define MICROPY_ENABLE_SOURCE_LINE (1)
53+
#endif

ports/nrf/mpconfigdevice_nrf9160.h

+4
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@
4747
#ifndef MICROPY_PY_UBINASCII
4848
#define MICROPY_PY_UBINASCII (1)
4949
#endif
50+
51+
#ifndef MICROPY_ENABLE_SOURCE_LINE
52+
#define MICROPY_ENABLE_SOURCE_LINE (1)
53+
#endif

ports/nrf/mpconfigport.h

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
#define MICROPY_REPL_EMACS_KEYS (0)
6161
#define MICROPY_REPL_AUTO_INDENT (1)
6262
#define MICROPY_KBD_EXCEPTION (1)
63-
#define MICROPY_ENABLE_SOURCE_LINE (0)
6463
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
6564
#if NRF51
6665
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)

tests/feature_check/lineno.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
try:
2+
xyz
3+
except NameError as er:
4+
import sys
5+
sys.print_exception(er)

tests/feature_check/lineno.py.exp

Whitespace-only changes.

tests/run-tests

+3-1
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,9 @@ def run_tests(pyb, tests, args, result_dir):
405405
elif args.target == 'nrf':
406406
skip_tests.add('basics/memoryview1.py') # no item assignment for memoryview
407407
skip_tests.add('extmod/urandom_basic.py') # unimplemented: urandom.seed
408-
skip_tests.add('micropython/opt_level.py') # no support for line numbers
408+
if b'line' not in run_feature_check(pyb, args, base_path, 'lineno.py'):
409+
skip_tests.add('micropython/opt_level.py') # no support for line numbers
410+
skip_tests.add('micropython/opt_level_lineno.py')
409411
skip_tests.add('misc/non_compliant.py') # no item assignment for bytearray
410412
for t in tests:
411413
if t.startswith('basics/io_'):

0 commit comments

Comments
 (0)