Commit Graph

1353 Commits

Author SHA1 Message Date
Damien George
e711e2d44a tests/basics: Add memoryview test for big ints. 2017-05-09 10:49:19 +10:00
Damien George
2e9e14980d tests/basics: Update array test for big-int with lL typecodes. 2017-05-09 10:46:43 +10:00
Paul Sokolovsky
4a4490ffcc py/modio: resource_stream: Implement "package" param handling. 2017-05-06 18:42:35 +03:00
Damien George
084824f866 tests: Move super-as-local test from cpydiff to basic tests.
It's now possible to use the name "super" as a local variable.
2017-05-06 11:01:57 +10:00
Damien George
dce7dd4259 tests/micropython: Add test for int.from_bytes with many zero bytes. 2017-05-06 10:29:09 +10:00
Damien George
1b3e372418 tests/extmod: Add some more VFS tests. 2017-05-05 20:15:10 +10:00
Damien George
6c8b57a902 tests/extmod: Add more tests for VFS FAT. 2017-05-05 20:15:10 +10:00
Paul Sokolovsky
12ea06567c tests/cpydiff/core_function_unpacking: Fill in workaround. 2017-05-04 00:48:48 +03:00
Paul Sokolovsky
92657c671f tests/cpydiff/core_import_split_ns_pkgs: Test for split namespace packages. 2017-05-03 17:16:19 +03:00
Paul Sokolovsky
3923f96dc6 tests/cpydiff/core_import_path: Test showing difference in package.__path__. 2017-05-03 12:22:53 +03:00
Paul Sokolovsky
7d4ba9d257 tests/io/resource_stream: Add test for uio.resource_stream(). 2017-05-03 01:47:14 +03:00
Paul Sokolovsky
c1b19115e5 tests/cpydiff/core_import_prereg: Fill in cause and workaround. 2017-05-02 14:12:52 +03:00
Paul Sokolovsky
8bb84cc627 tests/cpydiff/core_function_userattr: Clarify, fill in cause and workaround. 2017-05-02 03:43:21 +03:00
Paul Sokolovsky
58ecbc7752 tests/cpydiff/core_arguments: Fill in cause/workaround. 2017-05-02 03:36:47 +03:00
Damien George
810133d97d tests/basics: Add tests for int.from_bytes when src has trailing zeros.
The trailing zeros should be truncated from the converted value.
2017-04-25 12:07:02 +10:00
Damien George
30badd1ce1 tests: Add tests for calling super and loading a method directly. 2017-04-22 23:39:38 +10:00
Damien George
5335942b59 py/compile: Refactor handling of special super() call.
This patch refactors the handling of the special super() call within the
compiler.  It removes the need for a global (to the compiler) state variable
which keeps track of whether the subject of an expression is super.  The
handling of super() is now done entirely within one function, which makes
the compiler a bit cleaner and allows to easily add more optimisations to
super calls.

Changes to the code size are:

   bare-arm: +12
    minimal:  +0
   unix x64: +48
unix nanbox: -16
     stmhal:  +4
     cc3200:  +0
    esp8266: -56
2017-04-22 21:46:32 +10:00
Paul Sokolovsky
9e8f316392 extmod/moductypes: Fix bigint handling for 32-bit ports. 2017-04-21 16:43:21 +03:00
Damien George
c7c14f1634 tests/micropython: Add test for micropython.kbd_intr(). 2017-04-18 17:24:30 +10:00
Paul Sokolovsky
57b5ee2fcf tests/run-tests: Don't post-process CRASH result in any way.
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-16 17:59:11 +03:00
Damien George
61616e84ce extmod/machine_signal: Rename "inverted" arg to "invert", it's shorter.
A shorter name takes less code size, less room in scripts and is faster to
type at the REPL.

Tests and HW-API examples are updated to reflect the change.
2017-04-15 21:01:47 +03:00
Paul Sokolovsky
5b8122f2bb tests/run-tests: Search feature checks wrt to main script location.
If run-tests script is run from another dir, we still want to look up
feature checks in run-tests' dir.
2017-04-14 17:07:13 +03:00
Damien George
967cad7434 tests/extmod/utimeq1: Improve coverage of utimeq module. 2017-04-13 23:34:28 +10:00
Damien George
b6fff4186d tests/basics: Add test for tuple inplace add. 2017-04-05 12:38:18 +10:00
Damien George
dcd8f52766 tests/basics: Add tests for raising ValueError when range() gets 0 step. 2017-04-05 10:52:29 +10:00
Peter Hinch
468c6f9da1 extmod/modframebuf: Make monochrome bitmap formats start with MONO_.
MONO_xxx is much easier to read if you're not familiar with the code.
MVLSB is deprecated but kept for backwards compatibility, for the time
being.

This patch also updates the associated docs and tests.
2017-04-04 17:38:33 +10:00
Damien George
805b1c8bc3 tests/run-tests: Update names of tests that may need skipping. 2017-04-04 12:26:43 +10:00
Damien George
677fb31015 tests/float: Add tests for hashing float and complex numbers. 2017-04-04 12:14:34 +10:00
Paul Sokolovsky
831e157226 tests/run-tests: Introduce generic "minimal" target.
Used e.g. by Zephyr port.
2017-04-03 10:20:48 +03:00
Paul Sokolovsky
806c07c898 tests/micropython/heapalloc_iter: Improve skippability. 2017-04-03 00:27:01 +03:00
Paul Sokolovsky
28876d3902 tests/float/byte*_construct: Skip on missing array module. 2017-04-03 00:17:43 +03:00
Paul Sokolovsky
499ea8b253 tests/extmod/vfs_fat_fileio*: Improve skippability.
Should be skipped on missing uso, uerrno modules.
2017-04-03 00:14:57 +03:00
Paul Sokolovsky
b099aeb3ca run-tests: Add feature check for "const" keyword and skip related tests. 2017-04-02 22:52:18 +03:00
Paul Sokolovsky
b9e9cfcfc1 tests: vfs_fat_fileio.py is too big to be parsed in 16K heap, split in 2.
This restores ability to run testsuite with 16K heap.
2017-04-02 22:02:11 +03:00
Paul Sokolovsky
5b2db4bb51 tests/run-tests: Be sure to close Pyboard object on completion.
So underlying device was properly closed too.
2017-04-02 20:49:16 +03:00
Damien George
bf51e2ff98 tests/basics: Add tests for list and bytearray growing using themselves. 2017-04-02 17:31:32 +10:00
Damien George
734775524e tests/basics: Add test for super() when self is closed over. 2017-03-27 11:29:11 +11:00
Damien George
bfb48c1620 tests/float: Add tests for round() of inf, nan and large number. 2017-03-24 11:00:45 +11:00
Damien George
bacb52aa2d tests/float: Add tests for math funcs that return ints.
One should test bigint, inf and nan to make sure all cases are covered.
2017-03-23 23:54:10 +11:00
Paul Sokolovsky
4a4bb84e92 tests/heapalloc_str: Test no-replacement case for str.replace(). 2017-03-22 22:17:52 +03:00
Peter Hinch
231cfc84a7 extmod/modframebuf: Add support for monochrome horizontal format.
MHLSB and MHMSB formats are added to the framebuf module, which have 8
adjacent horizontal pixels represented in a single byte.
2017-03-20 16:21:47 +11:00
Damien George
74faf4c5fc unix/coverage: Enable scheduler and add tests for it. 2017-03-20 15:20:26 +11:00
Damien George
c772817dee tests/micropython: Add tests for micropython.schedule(). 2017-03-20 15:20:26 +11:00
Damien George
eeff0c3528 tests/basics/bytes_add: Add tests for optimised bytes addition. 2017-03-16 14:31:03 +11:00
Damien George
ecb4357fe1 tests/basics: Move string-modulo-format int tests to dedicated file. 2017-03-15 17:34:47 +11:00
Damien George
b154468b08 tests/basics: Add test for string module formatting with int argument. 2017-03-15 17:31:17 +11:00
Damien George
3a0b2be6e2 tests/basics/string_format2: Adjust comment now that tests succeed. 2017-03-15 17:25:46 +11:00
Damien George
e29f704b67 tests/micropython/viper_error: Add more tests to improve coverage. 2017-03-14 23:05:41 +11:00
Rami Ali
8a57cacd78 tests/extmod: Improve tinfgzip.c test coverage. 2017-03-14 22:13:36 +11:00
Damien George
a49a96bb5d tests/extmod/vfs_basic: Unmount all existing devices before doing test.
This is so the test can run successfully on targets that already have
something mounted.
2017-03-14 22:08:37 +11:00
Damien George
923ec1169f tests/run-tests: Re-instate skipping of doubleprec test on pyboard. 2017-03-14 22:07:52 +11:00
Damien George
05fec17d9b tests/basics/struct_micropython: Add test for 'S' typecode in ustruct.
The 'S' typecode is a uPy extension so it should be grouped with the other
extension (namely 'O' typecode).  Testing 'S' needs uctypes which is an
extmod module and not always available, so this test is made optional and
will only be run on ports that have (u)struct and uctypes.  Otherwise it
will be silently skipped.
2017-03-14 18:27:43 +11:00
Rami Ali
77cbd173df tests: Improve binary.c test coverage. 2017-03-14 18:27:29 +11:00
Rami Ali
4e86ca398f tests/extmod: Improve re1.5/recursiveloop.c test coverage. 2017-03-14 17:17:45 +11:00
Damien George
773b0bac41 tests/extmod/vfs_basic: Add more tests for basic VFS functionality. 2017-03-14 16:07:30 +11:00
Damien George
8891b2e700 tests/extmod: Add a test for core VFS functionality, sans any filesystem. 2017-03-13 21:42:02 +11:00
Paul Sokolovsky
3e321f1724 tests/misc/: Make few tests skippable. 2017-03-11 01:17:02 +01:00
Damien George
f07a56fa3b tests/extmod: Rename websocket test to websocket_basic.
This is so that the filename of the test doesn't clash with the module name
itself (being "websocket"), and lead to potential problems executing the
test.
2017-03-10 15:05:08 +11:00
Paul Sokolovsky
c9705cff68 tests/basics/fun_error: Split out skippable test. 2017-03-10 02:22:56 +01:00
Paul Sokolovsky
854bb322bf tests/feature_check/int_big: Rework "big int" detection.
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-10 02:11:43 +01:00
Paul Sokolovsky
bc5bffbf65 tests/micropython/opt_level: Clarify the expected output for opt_level == 3. 2017-03-09 23:22:31 +01:00
Paul Sokolovsky
53018d5ad2 tests/micropython/heapalloc_traceback: Fix backtrace line # after refactor. 2017-03-09 12:51:45 +01:00
Paul Sokolovsky
1a71d30fb8 tests/micropython: Make uio-using tests skippable. 2017-03-09 10:26:31 +01:00
Paul Sokolovsky
ce63a95a85 tests/dict_fromkeys: Split out skippable part. 2017-03-09 08:31:35 +01:00
Alex March
ce0b5e078b tests/extmod: Add websocket tests.
These short unit tests test the base uPy methods as well as parts of the
websocket protocol, as implemented by uPy.

@dpgeorge converted the original socket based tests by @hosaka to ones
that only require io.BytesIO.
2017-03-09 16:47:41 +11:00
Damien George
38f063ea72 tests/extmod: Add very basic feature test for ussl module.
This test just tests that the basic functions/methods can be called with
the appropriate arguments.  There is no real test of underlying
functionality.

Thanks to @hosaka for the initial implementation of this test.
2017-03-09 13:42:34 +11:00
Paul Sokolovsky
a0cbc108ba tests/float: Make various tests skippable. 2017-03-09 00:11:05 +01:00
Paul Sokolovsky
983144404b tests/basic: Make various tests skippable. 2017-03-09 00:07:19 +01:00
Paul Sokolovsky
bdd48e67ee tests/uctypes_array_assign_native_le: Split off intbig part. 2017-03-07 08:40:03 +01:00
Paul Sokolovsky
c98d7461a1 tests/micropython/: Split off intbig tests. 2017-03-07 07:12:58 +01:00
Krzysztof Blazewicz
1bd17de4b7 tests/basics/unpack1.py: Test if *a, = b copies b when b is a list. 2017-03-07 16:48:16 +11:00
Krzysztof Blazewicz
38c3778b27 tests/basics/string_join.py: Add test case where argument is not iterable. 2017-03-07 16:48:16 +11:00
Paul Sokolovsky
88ffe0d5cc tests/string_format_modulo2: Split off intbig test. 2017-03-07 00:13:36 +01:00
Paul Sokolovsky
4b03941f5e tests/float2int*: Suffix with _intbig, don't run on any other int type.
I.e. they don't run successfully with MICROPY_LONGINT_IMPL_NONE
and MICROPY_LONGINT_IMPL_LONGLONG (the problem is that they generate
different output than CPython, TODO to fix that).
2017-03-06 16:30:12 +01:00
Paul Sokolovsky
121fb88988 float/float2int*: Make actually be parsable for MICROPY_LONGINT_IMPL_NONE.
The use of large literal numbers is a big no-no when it comes to writing
programs which work with different int representations. Also, some checks
are pretty adhoc (e.g using struct module to check for 64-bitness). This
change bases entire detection on sys.maxsize and integer operarions, and
thus more correct, even if longer.

Note that this change doesn't mean that any of these tests can pass with
anything but MPZ - even despite checking for various int representations,
the tests aren't written to be portable among them.
2017-03-06 16:23:09 +01:00
Paul Sokolovsky
325c4473a5 tests/float/complex1: Split out intbig test. 2017-03-06 15:46:01 +01:00
Paul Sokolovsky
3ab6aa3a6d tests/basic: Split tests into working with small ints and not working.
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-04 00:13:27 +03:00
Paul Sokolovsky
89e570a5b4 tests/run-tests: Check for big int availability and skip related tests.
Big aka arbitrary-precision integers (implemented by MPZ module) are used
in tests starting with "int_big_" or ending with "_intbig".
2017-03-03 20:16:59 +03:00
Damien George
3d91c12d33 tests/basics: Add further tests for OrderedDict. 2017-03-03 11:23:54 +11:00
Damien George
ecc635d551 tests/extmod: Add test for machine.Signal class. 2017-03-02 16:09:16 +11:00
Damien George
f4a12dca58 py/objarray: Disallow slice-assignment to read-only memoryview.
Also comes with a test for this.  Fixes issue #2904.
2017-02-27 16:09:57 +11:00
Damien George
5255255fb9 py: Create str/bytes objects in the parser, not the compiler.
Previous to this patch any non-interned str/bytes objects would create a
special parse node that held a copy of the str/bytes data.  Then in the
compiler this data would be turned into a str/bytes object.  This actually
lead to 2 copies of the data, one in the parse node and one in the object.
The parse node's copy of the data would be freed at the end of the compile
stage but nevertheless it meant that the peak memory usage of the
parse/compile stage was higher than it needed to be (by an amount equal to
the number of bytes in all the non-interned str/bytes objects).

This patch changes the behaviour so that str/bytes objects are created
directly in the parser and the object stored in a const-object parse node
(which already exists for bignum, float and complex const objects).  This
reduces peak RAM usage of the parse/compile stage, simplifies the parser
and compiler, and reduces code size by about 170 bytes on Thumb2 archs,
and by about 300 bytes on Xtensa archs.
2017-02-24 13:43:43 +11:00
Damien George
f62503dc47 tests/micropython: Add test for consts that are bignums. 2017-02-24 13:08:18 +11:00
Damien George
465a604547 tests/cpydiff: Add a test for storing iterable to a list slice. 2017-02-20 17:22:12 +11:00
Rami Ali
86c7507233 tests/cpydiff: Add initial set of tests for uPy-CPython differences.
These tests are intended to fail, as they provide a programatic record of
differences between uPy and CPython.  They also contain a special comment
at the start of the file which has meta-data describing the difference,
including known causes and known workarounds.
2017-02-20 16:50:34 +11:00
Damien George
89267886cc py/objlist: For list slice assignment, allow RHS to be a tuple or list.
Before this patch, assigning anything other than a list would lead to a
crash.  Fixes issue #2886.
2017-02-20 15:09:59 +11:00
Paul Sokolovsky
6fc6f10b1e tests/heapalloc_exc_raise.py: Heap alloc test for raising/catching exc. 2017-02-20 04:22:32 +03:00
Damien George
d87c6b6768 tests/basics/string_join: Add more tests for string concatenation. 2017-02-17 12:30:27 +11:00
Damien George
c889f01b8d tests/cmdline/cmd_parsetree: Update to work with changes to grammar. 2017-02-17 12:29:51 +11:00
Damien George
0ec957d7c5 tests/cmdline: Update cmd_parsetree test for changes to grammar order. 2017-02-16 19:45:07 +11:00
Damien George
7839b8b827 tests/micropython/heapalloc_iter: Add tests for contains and unpack. 2017-02-16 19:11:34 +11:00
Damien George
019048a6dc tests/micropython: Add test for iterating with the heap locked. 2017-02-16 19:11:34 +11:00
Damien George
86b3db9cd0 tests/cmdline/cmd_showbc: Update to work with recent changes. 2017-02-16 18:38:07 +11:00
Damien George
861b001783 tests/cmdline: Update tests to pass with latest changes to bytecode. 2017-02-16 18:38:07 +11:00
Damien George
f4df3aaa72 py: Allow bytecode/native to put iter_buf on stack for simple for loops.
So that the "for x in it: ..." statement can now work without using the
heap (so long as the iterator argument fits in an iter_buf structure).
2017-02-16 18:38:06 +11:00
Paul Sokolovsky
f980c70997 tests/basic/: Make various tests skippable.
To run the testsuite on small ports.
2017-02-15 18:11:16 +03:00
Paul Sokolovsky
b737c9cbc8 tests/gen_yield_from_close: Use range() instead of reversed().
As a "more basic" builtin iterator, present even in smaller ports.
2017-02-15 17:05:27 +03:00
Damien George
06a12ada48 tests/thread: Add stress-test for creating many threads. 2017-02-15 11:12:37 +11:00
Damien George
2847d7431d tests/thread: Replace busy waiting loops with a loop that sleeps.
Depending on the thread scheduler, a busy-wait loop can hog the CPU and
make the tests very slow.  So convert such loops to loops that have an
explicit sleep, allowing the worker threads to do their job.
2017-02-15 11:12:37 +11:00
Paul Sokolovsky
f2d732f459 tests/extmod: Make tests skippable. 2017-02-15 01:56:22 +03:00