aboutsummaryrefslogtreecommitdiff
path: root/tests/run-tests
AgeCommit message (Collapse)Author
2018-07-20tests/run-tests: Improve crash reporting when running on remote targets.Ayke van Laethem
It is very useful to know the actual error when debugging why a test fails.
2018-07-20tests/run-tests: Add nrf target.Ayke van Laethem
2018-07-10py/objgenerator: Implement __name__ with normal fun attr accessor code.Damien George
With the recent change b488a4a8480533a6a3c9468c2f8bd359c94d4d02, a generating function now has the same layout in memory as a normal bytecode function, and so can reuse the latter's attribute accessor code to implement __name__.
2018-06-27py/compile: Handle return/break/continue correctly in async with.Damien George
Before this patch the context manager's __aexit__() method would not be executed if a return/break/continue statement was used to exit an async with block. async with now has the same semantics as normal with. The fix here applies purely to the compiler, and does not modify the runtime at all. It might (eventually) be better to define new bytecode(s) to handle async with (and maybe other async constructs) in a cleaner, more efficient way. One minor drawback with addressing this issue purely in the compiler is that it wasn't possible to get 100% CPython semantics. The thing that is different here to CPython is that the __aexit__ method is not looked up in the context manager until it is needed, which is after the body of the async with statement has executed. So if a context manager doesn't have __aexit__ then CPython raises an exception before the async with is executed, whereas uPy will raise it after it is executed. Note that __aenter__ is looked up at the beginning in uPy because it needs to be called straightaway, so if the context manager isn't a context manager then it'll still raise an exception at the same location as CPython. The only difference is if the context manager has the __aenter__ method but not the __aexit__ method, then in that case uPy has different behaviour. But this is a very minor, and acceptable, difference.
2018-06-12tests/extmod: Add test for VFS and user-defined filesystem and files.Damien George
2018-05-22py/objgenerator: Protect against reentering a generator.Damien George
Generators that are already executing cannot be reexecuted. This patch puts in a check for such a case. Thanks to @jepler for finding the bug.
2018-05-11tests/float/float_parse: Allow test to run on 32-bit archs.Damien George
Printing of uPy floats can differ by the floating-point precision on different architectures (eg 64-bit vs 32-bit x86), so it's not possible to using printing of floats in some parts of this test. Instead we can just check for equivalence with what is known to be the correct answer.
2018-05-02tests/run-tests: Support esp32 as a target for running the test suite.Ayke van Laethem
2018-04-10tests: Move recursive tests to the tests/stress/ subdir.Damien George
Keeping all the stress related tests in one place makes it easier to stress-test a given port, and to also not run such tests on ports that can't handle them.
2018-04-10py/objgenerator: Check stack before resuming a generator.Jeff Epler
This turns a hard crash in a recursive generator into a 'maximum recursion depth exceeded' exception.
2018-04-04tests/stress: Add test to verify the GC can trace nested objects.Damien George
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.
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-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-05tests/run-tests: Wrap long lists to facilitate adding more items.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-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-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-09-26py: Add config option to print warnings/errors to stderr.David Lechner
This adds a new configuration option to print runtime warnings and errors to stderr. On Unix, CPython prints warnings and unhandled exceptions to stderr, so the unix port here is configured to use this option. The unix port already printed unhandled exceptions on the main thread to stderr. This patch fixes unhandled exceptions on other threads and warnings (issue #2838) not printing on stderr. Additionally, a couple tests needed to be fixed to handle this new behavior. This is done by also capturing stderr when running tests.
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-09-10tests/run-tests: Fix copy-paste mistake in var name.Paul Sokolovsky
2017-09-10tests/run-tests: Skip class_inplace_op for minimal profile.Paul Sokolovsky
Don't assume that MICROPY_PY_ALL_SPECIAL_METHODS is defined, as required for inplace special methods. Fixes Zephyr tests.
2017-09-10tests/class_reverse_op: Test for reverse arith ops special methods.Paul Sokolovsky
This test should be run only if support for reverse ops is enabled, so the corresponding feature_check is added to run-tests.
2017-09-06all: Update Makefiles and others to build with new ports/ dir layout.Damien George
Also renames "stmhal" to "stm32" in documentation and everywhere else.
2017-07-31all: Use the name MicroPython consistently in commentsAlexander Steffen
There were several different spellings of MicroPython present in comments, when there should be only one.
2017-07-07py/objgenerator: Allow to hash generators and generator instances.Damien George
Adds nothing to the code size, since it uses existing empty slots in the type structures.
2017-06-26tests: Auto detect floating point capabilites of the target.Damien George
The floating-point precision of the target is detected (0, 30, 32 or 64) and only those tests which can run on the target will be run.
2017-04-16tests/run-tests: Don't post-process CRASH result in any way.Paul Sokolovsky
If we got a CRASH result, return early, similar to SKIP. This is important because previous refactor changed branching logic a bit, so CRASH now gets post-processed into CRASH\n, which broke remote hardware tests.
2017-04-14tests/run-tests: Search feature checks wrt to main script location.Paul Sokolovsky
If run-tests script is run from another dir, we still want to look up feature checks in run-tests' dir.
2017-04-04tests/run-tests: Update names of tests that may need skipping.Damien George
2017-04-03tests/run-tests: Introduce generic "minimal" target.Paul Sokolovsky
Used e.g. by Zephyr port.
2017-04-02run-tests: Add feature check for "const" keyword and skip related tests.Paul Sokolovsky
2017-04-02tests/run-tests: Be sure to close Pyboard object on completion.Paul Sokolovsky
So underlying device was properly closed too.
2017-03-20tests/micropython: Add tests for micropython.schedule().Damien George
2017-03-14tests/run-tests: Re-instate skipping of doubleprec test on pyboard.Damien George
2017-03-10tests/feature_check/int_big: Rework "big int" detection.Paul Sokolovsky
MICROPY_LONGINT_IMPL_LONGLONG doesn't have overflow detection, so just parsing a large number won't give an error, we need to print it out to check that the whole number was parsed.
2017-03-04tests/basic: Split tests into working with small ints and not working.Paul Sokolovsky
Tests which don't work with small ints are suffixed with _intbig.py. Some of these may still work with long long ints and need to be reclassified later.
2017-03-03tests/run-tests: Check for big int availability and skip related tests.Paul Sokolovsky
Big aka arbitrary-precision integers (implemented by MPZ module) are used in tests starting with "int_big_" or ending with "_intbig".
2017-02-16tests/micropython: Add test for iterating with the heap locked.Damien George
2017-02-14tests/run-tests: Allow to skip tests using async/await keywords.Paul Sokolovsky
2017-02-14tests: Add option to not clear MICROPYPATH when running testsstijn
This allows using the test runner for other scenarios than just testing uPy itself. The principle of comparing either to CPython or else to a .exp file is really handy but to be able to test custom modules not built into micropython.exe one needs to be able to specify the module search path a.k.a MICROPYPATH.
2017-01-31tests/run-tests: Skip frozenset tests if set literal syntax is not available.Paul Sokolovsky
2017-01-24tests: Make sure special tests can be skipped as well.stijn
Fixes #2806.
2017-01-22tests: Add test for builtin help function.Damien George
2017-01-17tests: Update tests, and add new ones, for recent generator tweaks.Damien George