aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2018-02-14py/objrange: Implement (in)equality comparison between range objects.Damien George
This feature is not often used so is guarded by the config option MICROPY_PY_BUILTINS_RANGE_BINOP which is disabled by default. With this option disabled MicroPython will always return false when comparing two range objects for equality (unless they are exactly the same object instance). This does not match CPython so if (in)equality between range objects is needed then this option should be enabled. Enabling this option costs between 100 and 200 bytes of code space depending on the machine architecture.
2018-02-14tests/run-tests: Capture any output from a crashed uPy execution.Damien George
Instead of putting just 'CRASH' in the .py.out file, this patch makes it so any output from uPy that led to the crash is stored in the .py.out file, as well as the 'CRASH' message at the end.
2018-02-14tests: Rewrite some tests so they can run without needing eval/exec.Damien George
For builds without the compiler enabled (and hence without eval/exec) it is useful to still be able to run as many tests as possible.
2018-02-14tests: Automatically skip tests that require eval, exec or frozenset.Damien George
2018-02-08py/objfloat: Fix case of raising 0 to -infinity.Damien George
It was raising an exception but it should return infinity.
2018-02-08py/parsenum: Fix parsing of floats that are close to subnormal.Damien George
Prior to this patch, a float literal that was close to subnormal would have a loss of precision when parsed. The worst case was something like float('10000000000000000000e-326') which returned 0.0.
2018-02-08tests/unix: Add coverage test for calling mp_obj_new_bytearray.Damien George
2018-02-07tests/basics: Rename remaining tests that are for built-in functions.Damien George
For consistency with all of the other tests that are named builtin_XXX.py.
2018-02-07py/objtype: Check and prevent delete/store on a fixed locals map.Damien George
Note that the check for elem!=NULL is removed for the MP_MAP_LOOKUP_ADD_IF_NOT_FOUND case because mp_map_lookup will always return non-NULL for such a case.
2018-01-31extmod/vfs_fat_file: Implement SEEK_CUR for non-zero offset.Ayke van Laethem
CPython doesn't allow SEEK_CUR with non-zero offset for files in text mode, and uPy inherited this behaviour for both text and binary files. It makes sense to provide full support for SEEK_CUR of binary-mode files in uPy, and to do this in a minimal way means also allowing to use SEEK_CUR with non-zero offsets on text-mode files. That seems to be a fair compromise.
2017-12-20tests/basics/memoryerror: Add test for out-of-memory using realloc.Damien George
2017-12-19tests/extmod: Add some uctypes tests to improve coverage of that module.Damien George
2017-12-19tests: Add some more tests to improve coverage of py/parse.c.Damien George
2017-12-19tests/basics/builtin_pow3: Add tests for edge cases of pow3.Damien George
2017-12-19tests/basics/generator_pend_throw: Add test for just-started generator.Damien George
2017-12-19tests/unix: Add test for printf with %lx format.Damien George
2017-12-19tests/float/builtin_float_hash: Add test to improve objfloat.c coverage.Damien George
2017-12-19tests/extmod/uhashlib_sha256: Add test for hashing 56 bytes of data.Damien George
2017-12-19tests/basics: Add more set tests to improve coverage of py/objset.c.Damien George
2017-12-15py/objgenerator: Allow to pend an exception for next execution.Paul Sokolovsky
This implements .pend_throw(exc) method, which sets up an exception to be triggered on the next call to generator's .__next__() or .send() method. This is unlike .throw(), which immediately starts to execute the generator to process the exception. This effectively adds Future-like capabilities to generator protocol (exception will be raised in the future). The need for such a method arised to implement uasyncio wait_for() function efficiently (its behavior is clearly "Future" like, and normally would require to introduce an expensive Future wrapper around all native couroutines, like upstream asyncio does). py/objgenerator: pend_throw: Return previous pended value. This effectively allows to store an additional value (not necessary an exception) in a coroutine while it's not being executed. uasyncio has exactly this usecase: to mark a coro waiting in I/O queue (and thus not executed in the normal scheduling queue), for the purpose of implementing wait_for() function (cancellation of such waiting coro by a timeout).
2017-12-15tests/run-tests: Skip running feature checks for --list-tests/--write-exp.Paul Sokolovsky
The whole idea of --list-tests is that we prepare a list of tests to run later, and currently don't have a connection to target board. Similarly for --write-exp - only "python3" binary would be required for this operation, not "micropython".
2017-12-14tests/run-tests: Don't test for --target=unix with "pyb is None".Paul Sokolovsky
If we test for unix target, do that explicitly. pyb var will be None for commands like --list-tests too.
2017-12-14tests/run-tests: Add composable --include and --exclude options.Paul Sokolovsky
The idea that --list-tests would be enough to produce list of tests for tinytest-codegen didn't work, because normal run-tests processing heavily relies on dynamic target capabilities discovery, and test filtering happens as the result of that. So, approach the issue from different end - allow to specify arbitrary filtering criteria as run-tests arguments. This way, specific filters will be still hardcoded, but at least on a particular target's side, instead of constant patching tinytest-codegen and/or run-tests.
2017-12-14tests/run-tests: Fix handling of --list-tests wrt skipped tests.Paul Sokolovsky
"skip <test>" message could leak before.
2017-12-14tests/run-tests: minimal: Exclude recently added subclass_native_init.py.Paul Sokolovsky
It relies on MICROPY_CPYTHON_COMPAT being defined.
2017-12-14extmod/modframebuf: Add 8-bit greyscale format (GS8).Damien George
2017-12-14extmod/modframebuf: Add 2-bit color format (GS2_HMSB).Petr Viktorin
This format is used in 2-color LED matrices and in e-ink displays like SSD1606.
2017-12-14tests: Add tests to improve coverage of py/objtype.c.Damien George
2017-12-13tests/run-tests: Add --list-tests switch.Paul Sokolovsky
Lists tests to be executed, subject to all other filters requested. This options would be useful e.g. for scripts like tools/tinytest-codegen.py, which currently contains hardcoded filters for particular a particular target and can't work for multiple targets.
2017-12-12tests: Fix few test for proper "skipped" detection with qemu-arm's tinytest.Paul Sokolovsky
"Builtin" tinytest-based testsuite as employed by qemu-arm (and now generalized by me to be reusable for other targets) performs simplified detection of skipped tests, it treats as such tests which raised SystemExit (instead of checking got "SKIP" output). Consequently, each "SKIP" must be accompanied by SystemExit (and conversely, SystemExit should not be used if test is not skipped, which so far seems to be true).
2017-12-12tests/cpydiff: Update subclassing Exception case and give work-around.Damien George
2017-12-12tests/extmod: Add test which subclasses framebuf.FrameBuffer.Damien George
2017-12-12tests/basics: Add test for overriding a native base-class's init method.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-12-05tests/run-tests: Wrap long lists to facilitate adding more items.Paul Sokolovsky
2017-12-03tests/cpydiff: Fix markup where "`" (xref) was used instead of "``" (code).Paul Sokolovsky
2017-11-28tests/run-tests: "minimal": Skip recently added float/float_parse.py.Paul Sokolovsky
Fails for Zephyr qemu_x86 with: -9e-36 +9.000001e-36
2017-11-28tests/cpydiff: Add difference-test for second arg of builtin next().Damien George
2017-11-27tests/basics/builtin_locals: Add test for using locals() in class body.Damien George
2017-11-27py/parsenum: Improve parsing of floating point numbers.Damien George
This patch improves parsing of floating point numbers by converting all the digits (integer and fractional) together into a number 1 or greater, and then applying the correct power of 10 at the very end. In particular the multiple "multiply by 0.1" operations to build a fraction are now combined together and applied at the same time as the exponent, at the very end. This helps to retain precision during parsing of floats, and also includes a check that the number doesn't overflow during the parsing. One benefit is that a float will have the same value no matter where the decimal point is located, eg 1.23 == 123e-2.
2017-11-24tests/basics/builtin_range: Add test for corner case of range slicing.Damien George
2017-11-24tests/basics: Add test for containment of a subclass of a native type.Damien George
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-11-23tests/net_hosted: Add test for socket connect() and poll() behaviour.Damien George
2017-11-21py/objfloat: Allow float() to parse anything with the buffer protocol.Damien George
This generalises and simplifies the code and follows CPython behaviour.
2017-11-12py/objnamedtuple: Add _asdict function if OrderedDict is supportedstijn
2017-10-27py/objtype: Define all special methods if requested.Paul Sokolovsky
If MICROPY_PY_ALL_SPECIAL_METHODS is defined, actually define all special methods (still subject to gating by e.g. MICROPY_PY_REVERSE_SPECIAL_METHODS). This adds quite a number of qstr's, so should be used sparingly.
2017-10-26tests/net_inet: Update tls test to work with CPython and incl new site.Damien George
CPython only supports the server_hostname keyword arg via the SSLContext object, so use that instead of the top-level ssl.wrap_socket. This allows the test to run on CPython the same as uPy. Also add the "Host:" header to correctly make a GET request (for URLs that are hosted on other servers). This is not strictly needed to test the SSL connection but helps to debug things when printing the response.
2017-10-11py/emitnative: Implement floor-division and modulo for viper emitter.Damien George