aboutsummaryrefslogtreecommitdiff
path: root/tests/micropython
AgeCommit message (Collapse)Author
2018-02-14tests: Automatically skip tests that require eval, exec or frozenset.Damien George
2017-12-11tests/heapalloc, heapalloc_super: Skip in strict stackless mode.Paul Sokolovsky
These tests involves testing allocation-free function calling, and in strict stackless mode, it's not possible to make a function call with heap locked (because function activation record aka frame is allocated on the heap).
2017-12-11tests/heapalloc_*: Refactor some tests to work in strict stackless mode.Paul Sokolovsky
In strict stackless mode, it's not possible to make a function call with heap locked (because function activation record aka frame is allocated on heap). So, if the only purpose of function is to introduce local variable scope, move heap lock/unlock calls inside the function.
2017-11-24py/runtime: Add MP_BINARY_OP_CONTAINS as reverse of MP_BINARY_OP_IN.Damien George
Before this patch MP_BINARY_OP_IN had two meanings: coming from bytecode it meant that the args needed to be swapped, but coming from within the runtime meant that the args were already in the correct order. This lead to some confusion in the code and comments stating how args were reversed. It also lead to 2 bugs: 1) containment for a subclass of a native type didn't work; 2) the expression "{True} in True" would illegally succeed and return True. In both of these cases it was because the args to MP_BINARY_OP_IN ended up being reversed twice. To fix these things this patch introduces MP_BINARY_OP_CONTAINS which corresponds exactly to the __contains__ special method, and this is the operator that built-in types should implement. MP_BINARY_OP_IN is now only emitted by the compiler and is converted to MP_BINARY_OP_CONTAINS by swapping the arguments.
2017-10-11py/emitnative: Implement floor-division and modulo for viper emitter.Damien George
2017-09-21py/objexcept: Prevent infinite recursion when allocating exceptions.Damien George
The aim of this patch is to rewrite the functions that create exception instances (mp_obj_exception_make_new and mp_obj_new_exception_msg_varg) so that they do not call any functions that may raise an exception. Otherwise it's possible to create infinite recursion with an exception being raised while trying to create an exception object. The two main things that are done to accomplish this are: 1. Change mp_obj_new_exception_msg_varg to just format the string, then call mp_obj_exception_make_new to actually create the exception object. 2. In mp_obj_exception_make_new and mp_obj_new_exception_msg_varg try to allocate all memory first using functions that don't raise exceptions If any of the memory allocations fail (return NULL) then degrade gracefully by trying other options for memory allocation, eg using the emergency exception buffer. 3. Use a custom printer backend to conservatively format strings: if it can't allocate memory then it just truncates the string. As part of this rewrite, raising an exception without a message, like KeyError(123), will now use the emergency buffer to store the arg and traceback data if there is no heap memory available. Memory use with this patch is unchanged. Code size is increased by: bare-arm: +136 minimal x86: +124 unix x64: +72 unix nanbox: +96 stm32: +88 esp8266: +92 cc3200: +80
2017-06-10tests: Convert remaining "sys.exit()" to "raise SystemExit".Paul Sokolovsky
2017-06-09py/objstringio: If created from immutable object, follow copy on write policy.Paul Sokolovsky
Don't create copy of immutable object's contents until .write() is called on BytesIO.
2017-05-06tests/micropython: Add test for int.from_bytes with many zero bytes.Damien George
2017-04-22tests: Add tests for calling super and loading a method directly.Damien George
2017-04-18tests/micropython: Add test for micropython.kbd_intr().Damien George
2017-04-03tests/micropython/heapalloc_iter: Improve skippability.Paul Sokolovsky
2017-03-22tests/heapalloc_str: Test no-replacement case for str.replace().Paul Sokolovsky
2017-03-20tests/micropython: Add tests for micropython.schedule().Damien George
2017-03-14tests/micropython/viper_error: Add more tests to improve coverage.Damien George
2017-03-09tests/micropython/opt_level: Clarify the expected output for opt_level == 3.Paul Sokolovsky
2017-03-09tests/micropython/heapalloc_traceback: Fix backtrace line # after refactor.Paul Sokolovsky
2017-03-09tests/micropython: Make uio-using tests skippable.Paul Sokolovsky
2017-03-07tests/micropython/: Split off intbig tests.Paul Sokolovsky
2017-02-24tests/micropython: Add test for consts that are bignums.Damien George
2017-02-20tests/heapalloc_exc_raise.py: Heap alloc test for raising/catching exc.Paul Sokolovsky
2017-02-16tests/micropython/heapalloc_iter: Add tests for contains and unpack.Damien George
2017-02-16tests/micropython: Add test for iterating with the heap locked.Damien George
2017-02-02tests/heapalloc_bytesio: Test for BytesIO with preallocates space.Paul Sokolovsky
2017-01-27tests/heapalloc_str: Test for alloc-free string operations.Paul Sokolovsky
Starts with concatenation with an empty string.
2017-01-21tests/heapalloc_int_from_bytes: Test that int.from_bytes() can work w/o alloc.Paul Sokolovsky
For a small number of bytes, it's expected to return a small int without allocation.
2017-01-19tests/micropython/opt_level: Add test for opt_level 3.Damien George
2016-12-28tests/micropython: Add test for micropython.stack_use() function.Rami Ali
2016-12-25tests/heapalloc_inst_call: Test for no alloc for simple object calls.Paul Sokolovsky
2016-12-15tests/micropython: Get heapalloc_traceback test running on baremetal.Damien George
When printing exceptions from files sent to a target by pyboard.py the filename in the exception is <stdin>, which differs to when running the script on the PC. So we strip out the filename to make the outputs the same on all targets (see also misc/print_exception.py test).
2016-11-21tests/micropython: Move alloc-less traceback test to separate test file.Damien George
The native emitter doesn't provide proper traceback info so this test should not be run in that case.
2016-11-21tests/micropython: Add test for creating traceback without allocation.Damien George
2016-11-10tests/micropython: Add test for import from within viper function.Damien George
2016-10-14tests/micropython: Add tests for heap_lock, and emergency exceptions.Damien George
2016-10-11tests: Improve test coverage of py/compile.c.Damien George
2016-10-11tests/micropython: Add test for micropython.opt_level() function.Damien George
2016-09-27py/modmicropython: Add micropython.const, alias for identity function.Damien George
Having a micropython.const identity function, and writing "from micropython import const" at the start of scripts that use the const feature, allows to write scripts which are compatible with CPython, and with uPy builds that don't include const optimisation. This patch adds such a function and updates the tests to do the import.
2016-09-27tests/micropython: Add tests for const names being replaced in parser.Damien George
2016-07-01tests/meminfo: Update for addition of "max free sz" output.Paul Sokolovsky
2016-06-06py/parse: Treat constants that start with underscore as private.Damien George
Assignments of the form "_id = const(value)" are treated as private (following a similar CPython convention) and code is no longer emitted for the assignment to a global variable. See issue #2111.
2016-02-09py/viper: Allow casting of Python integers to viper pointers.Damien George
This allows you to pass a number (being an address) to a viper function that expects a pointer, and also allows casting of integers to pointers within viper functions. This was actually the original behaviour, but it regressed due to native type identifiers being promoted to 4 bits in width.
2015-10-13tests: Add more tests for viper 16/32-bit load/store, and ellipsis.Damien George
2015-10-13py: Implement ptr32 load and store in viper emitter.Damien George
2015-10-08py/emitnative: Raise ViperTypeError for unsupported unary ops.Damien George
2015-08-30tests: Consolidate all feature check snippets under feature_check/.Paul Sokolovsky
2015-07-23py: Allow viper functions to take up to 4 arguments.Damien George
Addresses issue #1380.
2015-06-08py: Fallback to stack alloca for Python-stack if heap alloc fails.Damien George
If heap allocation for the Python-stack of a function fails then we may as well allocate the Python-stack on the C stack. This will allow to run more code without using the heap.
2015-06-04py: Implement native multiply operation in viper emitter.Damien George
2015-06-04py: Implement implicit cast to obj for viper load/store index/value.Damien George
This allows to do "ar[i]" and "ar[i] = val" in viper when ar is a Python object and i and/or val are native viper types (eg ints). Patch also includes tests for this feature.
2015-04-22tests: Add more tests for viper, including tests for ViperTypeError's.Damien George