aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2019-12-13tests/pyb: Refactor pyboard tests to work on PYBv1, PYBLITEv1 and PYBD.Damien George
2019-12-13tests/extmod/vfs_lfs_error: Use small ints in seek error test.Damien George
So accessing the seek offset (at the C level) doesn't cause an OverflowError on 32-bit targets.
2019-12-13tests/basics/memoryview_itemsize: Make portable to 32- and 64-bit archs.Damien George
2019-12-13tests/stress/qstr_limit: Tune params to run with stm32 port.Damien George
Because MICROPY_ALLOC_PATH_MAX is only 128 for this port.
2019-12-13tests: Add .exp files for basics/parser and import/import_override.Damien George
Because CPython 3.8.0 now produces different output: - basics/parser.py: CPython does not allow '\\\n' as input. - import/import_override: CPython imports _io.
2019-12-13examples/natmod: Add urandom native module example.Damien George
2019-12-12tests: Add script to run dynamic-native-module tests.Damien George
2019-12-12tests/import: Add test for importing viper code with additional flags.Damien George
2019-11-26tests/stress: Add test for maximum length limit of qstrs.Damien George
2019-11-26py/builtinimport: Raise exception on empty module name.Léa Saviot
To prevent a crash returning MP_OBJ_NULL. A test is added for this case.
2019-11-13py/objdict: Support ujson.dump() of OrderedDict objects.Andrew Leech
Following CPython, OrderedDict are dumped with the syntax of dict.
2019-11-04py/modsys: Report .mpy version in sys.implementation.Damien George
This commit adds a sys.implementation.mpy entry when the system supports importing .mpy files. This entry is a 16-bit integer which encodes two bytes of information from the header of .mpy files that are supported by the system being run: the second and third bytes, .mpy version, and flags and native architecture. This allows determining the supported .mpy file dynamically by code, and also for the user to find it out by inspecting this value. It's further possible to dynamically detect if the system supports importing .mpy files by `hasattr(sys.implementation, 'mpy')`.
2019-11-04py/objgenerator: Allow pend_throw to an unstarted generator.Jim Mussared
Replace the is_running field with a tri-state variable to indicate running/not-running/pending-exception. Update tests to cover the various cases. This allows cancellation in uasyncio even if the coroutine hasn't been executed yet. Fixes #5242
2019-10-31tests/extmod: Add test for ussl when passing in key/cert params.Damien George
2019-10-31extmod/modlwip: Make socket poll return POLLNVAL in case of bad file.Damien George
2019-10-31extmod/modlwip: Unconditionally return POLLHUP when polling new socket.Damien George
POSIX poll should always return POLLERR and POLLHUP in revents, regardless of whether they were requested in the input events flags. See issues #4290 and #5172.
2019-10-31stm32/timer: Fix Timer.freq() calc so mult doesn't overflow uint32_t.Damien George
Fixes issue #5280.
2019-10-29tests/basics: Split sys.exit test to separate file so it can be skipped.Damien George
2019-10-29tests: Add feature check for uio module and skip corresponding tests.Damien George
2019-10-29tests/basics: Automatically skip tests that use str/bytes modulo-format.Damien George
2019-10-29tests/run-tests: Add misc list of tests that use slice, to skip them.Damien George
2019-10-29tests/basics: Split out specific slice tests to separate files.Damien George
So they can be automatically skipped if slice is not enabled.
2019-10-29tests: Add feature check for slice and skip corresponding tests.Damien George
2019-10-29tests/basics: Use bytes not bytearray when checking user buffer proto.Damien George
Using bytes will test the same path for the buffer protocol in py/objtype.c.
2019-10-29tests/basics: Split out specific bytearray tests to separate files.Damien George
So they can be automatically skipped if bytearray is not enabled.
2019-10-29tests: Add feature check for bytearray and skip corresponding tests.Damien George
2019-10-29tests/basics/builtin_dir.py: Look for "version" in dir(sys).Damien George
Because "version" will always be there, but "exit" may not.
2019-10-29tests/basics: Use str.format instead of % for formatting messages.Damien George
Only use % formatting when testing % itself, because only str.format is guaranteed to be available on any port.
2019-10-29extmod/vfs: Rename BP_IOCTL_xxx constants to MP_BLOCKDEV_IOCTL_xxx.Damien George
Also rename SEC_COUNT to BLOCK_COUNT and SEC_SIZE to BLOCK_SIZE.
2019-10-29tests/extmod: Add test for blockdev with standard and extended protocol.Damien George
2019-10-29tests/extmod: Add littlefs tests.Damien George
2019-10-22tests: Rename "array" module to "uarray".Damien George
2019-10-21tests/cpydiff: Fix typo in types_bytes_keywords.py doc comments.clach04
2019-10-18py/objtype: Add type.__bases__ attribute.Josh Lloyd
Enabled as part of MICROPY_CPYTHON_COMPAT.
2019-10-18extmod/re1.5: Support escaping within RE classes.Jim Mussared
Fixes issues #3178 and #5220. Tests are added, including all the cases mentioned in both bugs.
2019-10-15py/persistentcode: Make .mpy more compact with qstr directly in prelude.Damien George
Instead of encoding 4 zero bytes as placeholders for the simple_name and source_file qstrs, and storing the qstrs after the bytecode, store the qstrs at the location of these 4 bytes. This saves 4 bytes per bytecode function stored in a .mpy file (for example lcd160cr.mpy drops by 232 bytes, 4x 58 functions). And resulting code size is slightly reduced on ports that use this feature.
2019-10-15tests/run-perfbench.py: Skip complex tests if target doesn't enable it.Damien George
2019-10-15tests/run-perfbench.py: Show error when truth check fails.Jim Mussared
2019-10-15tests/perf_bench: Add bm_fft test.Jim Mussared
This is mostly a test of complex number performance. The FFT implementation is from Project Nayuki and is MIT licensed.
2019-10-04tests/basics: Add test for throw into yield-from with normal return.Damien George
This test was found by missing coverage of a branch in py/nativeglue.c.
2019-10-04py/runtime: Fix PEP479 behaviour throwing StopIteration into yield from.Damien George
Commit 3f6ffe059f64b3ebc44dc0bbc63452cb8850702b implemented PEP479 but did not catch the case fixed in this commit. Found by coverage analysis, that the VM had uncovered code.
2019-10-04py/vm: Fix handling of unwind jump out of active finally.Damien George
Prior to this commit, when unwinding through an active finally the stack was not being correctly popped/folded, which resulting in the VM crashing for complicated unwinding of nested finallys. This should be fixed with this commit, and more tests for return/break/ continue within a finally have been added to exercise this.
2019-10-04py/compile: Disallow 'import *' outside module level.Petr Viktorin
This check follows CPython's behaviour, because 'import *' always populates the globals with the imported names, not locals. Since it's safe to do this (doesn't lead to a crash or undefined behaviour) the check is only enabled for MICROPY_CPYTHON_COMPAT. Fixes issue #5121.
2019-10-01tests/basics: Add test for getting name of func with closed over locals.Damien George
Tests correct decoding of the prelude to get the function name.
2019-10-01py: Rework and compress second part of bytecode prelude.Damien George
This patch compresses the second part of the bytecode prelude which contains the source file name, function name, source-line-number mapping and cell closure information. This part of the prelude now begins with a single varible length unsigned integer which encodes 2 numbers, being the byte-size of the following 2 sections in the header: the "source info section" and the "closure section". After decoding this variable unsigned integer it's possible to skip over one or both of these sections very easily. This scheme saves about 2 bytes for most functions compared to the original format: one in the case that there are no closure cells, and one because padding was eliminated.
2019-10-01py: Compress first part of bytecode prelude.Damien George
The start of the bytecode prelude contains 6 numbers telling the amount of stack needed for the Python values and exceptions, and the signature of the function. Prior to this patch these numbers were all encoded one after the other (2x variable unsigned integers, then 4x bytes), but using so many bytes is unnecessary. An entropy analysis of around 150,000 bytecode functions from the CPython standard library showed that the optimal Shannon coding would need about 7.1 bits on average to encode these 6 numbers, compared to the existing 48 bits. This patch attempts to get close to this optimal value by packing the 6 numbers into a single, varible-length unsigned integer via bit-wise interleaving. The interleaving scheme is chosen to minimise the average number of bytes needed, and at the same time keep the scheme simple enough so it can be implemented without too much overhead in code size or speed. The scheme requires about 10.5 bits on average to store the 6 numbers. As a result most functions which originally took 6 bytes to encode these 6 numbers now need only 1 byte (in 80% of cases).
2019-10-01unix/coverage: Add coverage tests for ringbuf.Jim Mussared
2019-09-26tests/micropython: Add test for native generators.Damien George
2019-09-26py/persistentcode: Bump .mpy version to 5.Damien George
The bytecode opcodes have changed (there are more, and they have been reordered).
2019-09-26py: Rename MP_QSTR_NULL to MP_QSTRnull to avoid intern collisions.Josh Lloyd
Fixes #5140.