aboutsummaryrefslogtreecommitdiff
path: root/tests/run-tests
AgeCommit message (Collapse)Author
2021-03-12tests: Rename run-tests to run-tests.py for consistency.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-02tests/run-tests: Change default Python command used on Windows.stijn
Default to just calling python since that is most commonly available: the official installer or zipfiles from python.org, anaconda, nupkg all result in python being available but not python3. In other words: the default used so far is wrong. Note that os.name is 'posix' when running the python version which comes with Cygwin or MSys2 so they are not affected by this. However of all possible ways to get Python on Windows, only Cygwin provides no python command so update the default way for running tests in the README.
2020-12-02extmod/uasyncio: Fix cancellation handling of wait_for.Damien George
This commit switches the roles of the helper task from a cancellation task to a runner task, to get the correct semantics for cancellation of wait_for. Some uasyncio tests are now disabled for the native emitter due to issues with native code generation of generators and yield-from. Fixes #5797. Signed-off-by: Damien George <damien@micropython.org>
2020-11-30tests/run-tests: Update skipped tests on CI for GitHub Actions.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2020-09-25tests/run-tests: Use -BS flags when running CPython.Damien George
The use of -S ensures that only the CPython standard library is accessible, which makes tests run the same regardless of any site-packages that are installed. It also improves start-up time of CPython, reducing the overall time spent running the test suite. tests/basics/containment.py is updated to work around issue with old Python versions not being able to str-format a dict-keys object, which becomes apparent when -S is used. Signed-off-by: Damien George <damien@micropython.org>
2020-08-29tests: Split out complex reverse-op tests to separate test file.Damien George
So they can be skipped if __rOP__'s are not supported on the target. Also fix the typo in the complex_special_methods.py filename. Signed-off-by: Damien George <damien@micropython.org>
2020-08-27tests/run-tests: Make test output directory configurable.stijn
A configurable result directory is advantageous because it enables using a dedicated location, eventually outside of the source tree, instead of forcing the output files into a fixed directory which might also contain other files already. For that reason the default output directory also has been changed to tests/results/.
2020-08-27tests/run-tests: Use absolute paths where possible.stijn
Replace some usages of paths relative to the current working directory with absolute paths relative to the tests directory. Fixes and resulting changes: - default values of MICROPYTHON and MPYCROSS are absolute paths and always correct - likewise, the correct full paths for tools and extmod directories are appended to sys.path - printing/cleaning failures works properly since it expects the .exp and .out files in the tests directory which is also where they are written to now, plus no more need for changing directories This fixes #5872 and allows running custom tests which use run-tests without having to cd to the tests directory first, and the test output still is in the tests/ directory instead of the current working directory. Discovery of tests and all skip test logic based on paths relative to the current working directory remains unchanged which essentially means that for running most of MicroPython's own tests, run-tests must still be ran from within it's directory, so document that.
2020-06-27py/objcomplex: Add mp_obj_get_complex_maybe for use in complex bin-op.Damien George
This allows complex binary operations to fail gracefully with unsupported operation rather than raising an exception, so that special methods work correctly. Signed-off-by: Damien George <damien@micropython.org>
2020-06-16tests/basics: Add tests for variable annotations.Damien George
2020-05-09tests/run-tests: Skip REPL feature checks when running via pyboard.py.Damien George
2020-05-03esp32: Improve support for OTA updates.Thorsten von Eicken
This commit adds several small items to improve the support for OTA updates on an esp32: - a partition table for 4MB flash modules that has two OTA partitions ready to go to do updates - a GENERIC_OTA board that uses that partition table and that enables automatic roll-back in the bootloader - a new esp32.Partition.mark_app_valid_cancel_rollback() class-method to signal that the boot is successful and should not be rolled back at the next reset - an automated test for doing an OTA update - documentation updates
2020-04-13tests/run-tests: Make diff tool user configurable.stijn
2020-03-30tests/run-tests: Add commands to print and clean *.exp,out files.David Lechner
This adds a couple of commands to the run-tests script to print the diffs of failed tests and also to clean up the .exp and .out files after failed tests. (And a spelling error is fixed while we are touching nearby code.) Travis is also updated to use these new commands, including using it for more builds.
2020-03-26tests: Make default MICROPYPATH include extmod to find uasyncio.Damien George
2020-03-26tests/run-tests: Skip uasyncio if no async, and skip one test on native.Damien George
2020-03-11tests/run-tests: Consider all tests as native when emit=native is used.Damien George
So that they are skipped when running on a target that doesn't support the native emitter, eg a nanbox build.
2020-02-11tests/run-tests: Auto-skip extmod/ticks_diff, extmod/time_ms_us tests.Yonatan Goldschmidt
2020-01-22tests: Make run-tests help and README be more descriptive of behaviour.Thorsten von Eicken
2020-01-12lib/mp-readline: Add word-based move/delete EMACS key sequences.Yonatan Goldschmidt
This commit adds backward-word, backward-kill-word, forward-word, forward-kill-word sequences for the REPL, with bindings to Alt+F, Alt+B, Alt+D and Alt+Backspace respectively. It is disabled by default and can be enabled via MICROPY_REPL_EMACS_WORDS_MOVE. Further enabling MICROPY_REPL_EMACS_EXTRA_WORDS_MOVE adds extra bindings for these new sequences: Ctrl+Right, Ctrl+Left and Ctrl+W. The features are enabled on unix micropython-coverage and micropython-dev.
2020-01-06tests/run-tests: Handle 'CRASH' return by float.py feature test.David Lechner
It is possile for `run_feature_check(pyb, args, base_path, 'float.py')` to return `b'CRASH'`. This causes an unhandled exception in `int()`. This commit fixes the problem by first testing for `b'CRASH'` before trying to convert the return value to an integer.
2019-12-27tests/run-tests: Add "--mpy-cross-flags" arg to specify mpy-cross flags.Damien George
2019-10-29tests: Add feature check for uio module and skip corresponding tests.Damien George
2019-10-29tests/run-tests: Add misc list of tests that use slice, to skip them.Damien George
2019-10-29tests: Add feature check for slice and skip corresponding tests.Damien George
2019-10-29tests: Add feature check for bytearray and skip corresponding tests.Damien George
2019-08-28tests: Split out test for optimisation level and line-no printing.Damien George
2019-08-20qemu-arm: Add testing of frozen native modules.Jim Mussared
- Split 'qemu-arm' from 'unix' for generating tests. - Add frozen module to the qemu-arm test build. - Add test that reproduces the requirement to half-word align native function data.
2019-04-04tests/run-tests: Ignore exception in process kill when ending repl test.stijn
When running Linux on WSL, Popen.kill() can raise a ProcessLookupError if the process does not exist anymore, which can happen here since the previous statement already tries to close the process by sending Ctrl-D to the running repl. This doesn't seem to be a problem on other OSes, so just swallow the exception silently since it indicates the process has been closed already, which after all is what we want.
2019-03-08tests/run-tests: Support running native tests via mpy.Damien George
2018-10-28py/compile: Fix case of eager implicit conversion of local to nonlocal.Damien George
This ensures that implicit variables are only converted to implicit closed-over variables (nonlocals) at the very end of the function scope. If variables are closed-over when first used (read from, as was done prior to this commit) then this can be incorrect because the variable may be assigned to later on in the function which means they are just a plain local, not closed over. Fixes issue #4272.
2018-10-01tests/run-tests: Enabled native tests that pass now that yield works.Damien George
2018-09-28tests/basics: Split out gen throw tests from yield-from-throw tests.Damien George
2018-09-20py/objgenerator: Implement PEP479, StopIteration convs to RuntimeError.Damien George
This commit implements PEP479 which disallows raising StopIteration inside a generator to signal that it should be finished. Instead, the generator should simply return when it is complete. See https://www.python.org/dev/peps/pep-0479/ for details.
2018-09-13py: Fix native functions so they run with their correct globals context.Damien George
Prior to this commit a function compiled with the native decorator @micropython.native would not work correctly when accessing global variables, because the globals dict was not being set upon function entry. This commit fixes this problem by, upon function entry, setting as the current globals dict the globals dict context the function was defined within, as per normal Python semantics, and as bytecode does. Upon function exit the original globals dict is restored. In order to restore the globals dict when an exception is raised the native function must guard its internals with an nlr_push/nlr_pop pair. Because this push/pop is relatively expensive, in both C stack usage for the nlr_buf_t and CPU execution time, the implementation here optimises things as much as possible. First, the compiler keeps track of whether a function even needs to access global variables. Using this information the native emitter then generates three different kinds of code: 1. no globals used, no exception handlers: no nlr handling code and no setting of the globals dict. 2. globals used, no exception handlers: an nlr_buf_t is allocated on the C stack but it is not used if the globals dict is unchanged, saving execution time because nlr_push/nlr_pop don't need to run. 3. function has exception handlers, may use globals: an nlr_buf_t is allocated and nlr_push/nlr_pop are always called. In the end, native functions that don't access globals and don't have exception handlers will run more efficiently than those that do. Fixes issue #1573.
2018-09-05tests: Remove pyboard.py symlink and instead import from ../tools.Damien George
To eliminate the need for symlinks which don't work on systems like Windows.
2018-09-04tests/run-tests: Enable native tests for unwinding jumps.Damien George
2018-09-03py/vm: Fix handling of finally-return with complex nested finallys.Damien George
Back in 8047340d7532ec32bc9f2d603bffc0bc9544297f basic support was added in the VM to handle return statements within a finally block. But it didn't cover all cases, in particular when some finally's were active and others inactive when the "return" was executed. This patch adds further support for return-within-finally by correctly managing the currently_in_except_block flag, and should fix all cases. The main point is that finally handlers remain on the exception stack even if they are active (currently being executed), and the unwind return code should only execute those finally's which are inactive. New tests are added for the cases which now pass.
2018-08-10run-tests: Make .exp and .out file names unique by prefixing with dir.stijn
Input files like basics/string_format.py and float/string_format.py have the same basename so using that name for writing the output (.exp and .out files) when both tests fail, results in the output of the first one being overwritten. Avoid this by using unique names for the output, replacing path characters with underscores.
2018-08-04tests/run-tests: Enable bool1.py test with native emitter.Damien George
It should work reliably now.
2018-08-04tests: Make tests work on targets without float support.Ayke van Laethem
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.