aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
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
2017-10-10py/formatfloat: Don't print the negative sign of a NaN value.Damien George
NaN may have the sign bit set but it has no meaning, so don't print it out.
2017-10-10py/modmath: Add full checks for math domain errors.Damien George
This patch changes how most of the plain math functions are implemented: there are now two generic math wrapper functions that take a pointer to a math function (like sin, cos) and perform the necessary conversion to and from MicroPython types. This helps to reduce code size. The generic functions can also check for math domain errors in a generic way, by testing if the result is NaN or infinity combined with finite inputs. The result is that, with this patch, all math functions now have full domain error checking (even gamma and lgamma) and code size has decreased for most ports. Code size changes in bytes for those with the math module are: unix x64: -432 unix nanbox: -792 stm32: -88 esp8266: +12 Tests are also added to check domain errors are handled correctly.
2017-10-07tests/run-tests: Close device under test using "finally".Paul Sokolovsky
We want to close communication object even if there were exceptions somewhere in the code. This is important for --device exec:/execpty: which may otherwise leave processing running in the background.
2017-10-05tests/extmod: Add test for '-' in character class in regex.Damien George
2017-10-05py: Clean up unary and binary enum list to keep groups together.Damien George
2 non-bytecode binary ops (NOT_IN and IN_NOT) are moved out of the bytecode group, so this change will change the bytecode format.
2017-10-04py/objstr: Make empty bytes object have a null-terminating byte.Damien George
Because a lot of string processing functions assume there is a null terminating byte, so they can work in an efficient way. Fixes issue #3334.
2017-10-03py/objset: Include the failed key in a KeyError raised from set.remove.Damien George
2017-10-03py/objset: Check that RHS of a binary op is a set/frozenset.Damien George
CPython docs explicitly state that the RHS of a set/frozenset binary op must be a set to prevent user errors. It also preserves commutativity of the ops, eg: "abc" & set() is a TypeError, and so should be set() & "abc". This change actually decreases unix (x64) code by 160 bytes; it increases stm32 by 4 bytes and esp8266 by 28 bytes (but previous patch already introduced a much large saving).
2017-10-03tests/extmod: Add test for ure regexes leading to infinite recursion.Paul Sokolovsky
These now should be caught properly and lead to RuntimeError instead of crash.
2017-09-26py/objfloat: Support raising a negative number to a fractional power.Damien George
This returns a complex number, following CPython behaviour. For ports that don't have complex numbers enabled this will raise a ValueError which gives a fail-safe for scripts that were written assuming complex numbers exist.