Commit Graph

239 Commits

Author SHA1 Message Date
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
Damien George
967cad7434 tests/extmod/utimeq1: Improve coverage of utimeq module. 2017-04-13 23:34:28 +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
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
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
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
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
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
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
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
bdd48e67ee tests/uctypes_array_assign_native_le: Split off intbig part. 2017-03-07 08:40:03 +01:00
Damien George
ecc635d551 tests/extmod: Add test for machine.Signal class. 2017-03-02 16:09:16 +11:00
Paul Sokolovsky
f2d732f459 tests/extmod: Make tests skippable. 2017-02-15 01:56:22 +03:00
Paul Sokolovsky
d5e9ab6e61 extmod/machine_pulse: Make time_pulse_us() not throw exceptions.
machine.time_pulse_us() is intended to provide very fine timing, including
while working with signal bursts, where each transition is tracked in row.
Throwing and handling an exception may take too much time and "signal loss".
So instead, in case of a timeout, just return negative value. Cases of
timeout while waiting for initial signal stabilization, and during actual
timing, are recognized.

The documentation is updated accordingly, and rewritten somewhat to clarify
the function behavior.
2017-02-05 14:20:17 +03:00
Damien George
a0c729681f tests/extmod/vfs_fat_ramdisk: Make it work on pyboard. 2017-01-27 23:22:15 +11:00
Damien George
b9bfaa349a tests/extmod/vfs_fat: Update tests to work with new VFS sub-system.
The vfs_fat_fsusermount test is no longer relevant so has been removed.
2017-01-27 17:21:45 +11:00
Damien George
94d87fbb30 test/extmod: Update vfs_fat tests for new OO FatFs library.
The new version of FatFs requires a minimum of 50 blocks on the device.
Also, some tests no longer make sense with an OO vfs.
2017-01-27 13:19:10 +11:00
Damien George
221f88d1f3 tests/extmod: Add test for ure debug printing when compiling a regex. 2017-01-26 23:45:51 +11:00
Damien George
bf51200bc1 tests/extmod/framebuf1: Fix test for framebuf invalid constructor. 2017-01-25 23:23:50 +11:00
Oleg Korsak
406fb3cb60 tests/extmod/framebuf4: Add tests for GS4_HMSB framebuf format. 2017-01-25 23:20:19 +11:00
Oleg Korsak
fd99690f18 extmod/modframebuf: Add GS4_HMSB format. 2017-01-25 23:19:28 +11:00
Damien George
4c4f586e2c tests/extmod/framebuf1: Add test for no-op fill_rect. 2017-01-19 23:37:44 +11:00
Rami Ali
5e80c53c11 tests/extmod: Improve test coverage of ure module. 2017-01-17 17:42:37 +11:00
Rami Ali
c15ebf7c8c tests/extmod: Improve ubinascii.c test coverage. 2016-12-29 13:22:19 +11:00
Paul Sokolovsky
492c612f9d tests/utimeq_stable: Test for partial stability of utimeq queuing. 2016-12-24 00:25:15 +03:00
Paul Sokolovsky
ffe807f349 extmod/moduheapq: Revert change for adhoc relative-time queue support.
Now that specialized utimeq module has been implenented, revert previous
adhoc changes to uheapq.

This reverts commit 0cbc07227c.
2016-12-22 06:37:49 +03:00
Paul Sokolovsky
5d9025a76e tests/extmod: Add test for utimeq module. 2016-12-22 00:31:38 +03:00
Rami Ali
9112b0b62b tests/extmod: Improve modframebuf test coverage. 2016-12-13 16:29:21 +11:00
Rami Ali
d22762017e tests/extmod: Improve moductypes test coverage. 2016-12-12 17:09:14 +11:00
Paul Sokolovsky
aee13ef3f2 tests: Update for required byteorder arg for int.from_bytes()/to_bytes(). 2016-12-09 22:53:30 +03:00
Damien George
898d4c1217 extmod/modframebuf: Make framebuf implement the buffer protocol.
So that one can easily access the underlying data of the frame buffer, eg
to write the data out to a display.
2016-12-08 15:17:47 +11:00
Damien George
042d5f24d6 tests/extmod/framebuf1: Add basics tests for hline, vline, rect, line. 2016-12-05 11:55:43 +11:00
Paul Sokolovsky
e44b236ce2 tests/extmod/btree1: Exercise btree.flush(). 2016-12-05 01:55:05 +03:00
Damien George
6194336d81 tests/extmod/vfs_fat_fileio: Add test for constructor of FileIO type. 2016-12-02 15:37:58 +11:00
Damien George
b7df3e541a extmod/vfs_fat: Implement POSIX behaviour of rename, allow to overwrite.
If the destination of os.rename() exists then it will be overwritten if it
is a file.  This is the POSIX behaviour, which is also the CPython
behaviour, and so we follow suit.

See issue #2598 for discussion.
2016-12-02 15:06:09 +11:00
Damien George
81e171b7bb extmod/modframebuf: Add back legacy FrameBuffer1 "class".
For backwards compatibility.  It simple creates a frame buffer with the
MVLSB format.
2016-12-01 16:43:25 +11:00
Radomir Dopieralski
225e22b287 extmod/modframebuf: Make FrameBuffer handle 16bit depth.
Rename FrameBuffer1 into FrameBuffer and make it handle different bit
depths via a method table that has getpixel and setpixel.  Currently
supported formats are MVLSB (monochrome, vertical, LSB) and RGB565.

Also add blit() and fill_rect() methods.
2016-12-01 16:43:25 +11:00
Rami Ali
1b41cacac7 tests/extmod: Improve ujson coverage. 2016-11-22 15:48:42 +11:00
Paul Sokolovsky
0cbc07227c extmod/moduheapq: Adhoc changes to support ordering by utime.ticks_ms().
As required for further elaboration of uasyncio, like supporting baremetal
systems with wraparound timesources. This is not intended to be public
interface, and likely will be further refactored in the future.
2016-11-12 02:33:17 +03:00
Paul Sokolovsky
fa3a108ed7 tests/vfs_fat_oldproto: Skip for ports not supporting "oldproto".
Otherwise this broke esp8266 testsuite.
2016-11-06 01:47:44 +03:00
Alex March
94aeba0427 tests/extmod/framebuf1: Test framebuffer pixel clear, and text function. 2016-11-03 00:10:17 +11:00
Paul Sokolovsky
be6a765c69 tests/extmod/ticks_diff: Test for new semantics of ticks_diff(). 2016-10-30 21:33:12 +03:00
Paul Sokolovsky
1ba4db5685 tests/btree1: Fix out of memory error running on esp8266. 2016-10-29 19:53:31 +03:00
Alex March
cc0cc67815 tests/extmod/uhashlib_sha256: Rename sha256.py test. 2016-10-28 19:51:54 +03:00
Alex March
b83ac44e82 tests/extmod/uhashlib_sha1: Coverage for SHA1 algorithm. 2016-10-28 19:51:46 +03:00
Alex March
fbca4f94b3 tests/extmod/vfs_fat_oldproto: Test old block device protocol. 2016-10-27 12:22:43 +11:00
Alex March
38a9359339 tests/extmod/vfs_fat_fsusermount: Improve fsusermount test coverage. 2016-10-27 12:22:42 +11:00
Damien George
5694201930 extmod/vfs_fat_file: Make file.close() a no-op if file already closed.
As per CPython semantics.  In particular, file.__del__() should not raise
an exception if the file is already closed.
2016-10-24 12:59:20 +11:00
Alex March
cb20d999bc tests/extmod/vfs_fat: Improve VFS test coverage.
Covered case:
- Stat cases
- Invalid read/write/flush/close
- Invalid mkdir/rmdir/remove/getcwd
- File seek/tell, modes a/x/+, t/b
- Writing to a full disk
- Full path rename, slash trim
- Rename cases
- Bytestring listdir
- File object printing
2016-10-24 12:49:19 +11:00
Alex March
e42186d356 tests/extmod/vfs_fat: Replace asserts with prints and expected outputs. 2016-10-13 14:56:47 +03:00
Damien George
11ab807d76 tests/extmod: Add test for ujson.load(). 2016-10-13 11:46:49 +11:00
Alex March
f274561e16 tests/extmod/vfs_fat: Test coverage for remove() and rmdir(). 2016-10-11 16:03:52 +11:00
Alex March
9fdba0e09c tests/extmod/uzlib: Test adaptive huffman tree for tinflate coverage. 2016-10-07 01:02:11 +11:00
Alex March
addd1d3db1 tests/extmod/btree1: Checks for put, seq, string print and unsupported binary op. 2016-10-05 00:17:22 +11:00
Alex March
670376c5cb tests/extmod/vfs_fat_ramdisk: Add test for VFS.statvfs(). 2016-09-27 13:48:58 +10:00
Paul Sokolovsky
d46de80162 tests/uzlib_decompio_gz: Test for DecompIO with gzip bitstream. 2016-09-24 15:43:23 +03:00
Damien George
b9672bcbe8 tests/extmod: Add test for machine.time_pulse_us(). 2016-09-16 23:31:02 +10:00
Damien George
67a4813601 tests/extmod/urandom: Add urandom tests for error cases. 2016-09-16 12:49:15 +10:00
Damien George
cac8dc3414 tests/extmod/framebuf1: Add tests for scrolling in the x-direction. 2016-09-05 12:08:25 +10:00
Paul Sokolovsky
61e2dfd97d tests/extmod/uzlib_decompio: Add zlib bitstream testcases. 2016-09-04 14:45:27 +03:00
Damien George
2d8740a4d1 tests/extmod: Add a test for framebuf module, tested by coverage build. 2016-09-04 16:40:40 +10:00
Paul Sokolovsky
fafd587514 tests/extmod: Add test for uzlib.DecompIO. 2016-09-03 00:20:30 +03:00
Radomir Dopieralski
fea7fe45ea tests/extmod/vfs_fat_ramdisk: Add tests for VFS.umount()
Try to un-mount a file system and re-mount it again.
2016-08-26 23:24:32 +03:00
Paul Sokolovsky
c428367543 extmod/modubinascii: Make crc32() support configurable.
Disable by default, enable in unix port.
2016-08-24 18:28:43 +03:00
Pavol Rusnak
39799f7564
extmod/modubinascii: implement binascii.crc32 2016-08-24 10:42:46 +02:00
Paul Sokolovsky
a6fc90f92a tests/uzlib_decompress: Actually test raw DEFLATE stream. 2016-08-17 06:10:16 +03:00
Paul Sokolovsky
0be4a7712d tests: Rename zlibd_decompress.py -> uzlib_decompress.py.
To use the actual current name.
2016-08-12 22:50:45 +03:00
Paul Sokolovsky
3eb532e974 extmod/modbtree: Implement __contains__ operation. 2016-08-02 00:24:59 +03:00
Paul Sokolovsky
bc3912980a tests/machine1: Revamp to work with unix port (which has "umachine"). 2016-07-31 04:30:48 +03:00
Paul Sokolovsky
eb0e3bab1e tests/machine_mem.py: Too non-portable, rework as an example for unix port. 2016-07-31 04:22:09 +03:00
Paul Sokolovsky
617bda27e9 tests/extmod/btree1: Tests against in-memory DB (using io.BytesIO). 2016-07-31 02:29:05 +03:00
Paul Sokolovsky
5a38694f55 tests/extmod/btree1: Close database at the end of test. 2016-07-24 00:30:32 +03:00
Paul Sokolovsky
c3f519adfe tests/extmod/machine_pinbase: Skip if machine.PinBase is not available. 2016-07-17 16:30:24 +03:00
Paul Sokolovsky
0fb7a7a7ce tests/btree1: Add testcase for iterating btree object directly. 2016-06-24 23:43:20 +03:00
Paul Sokolovsky
d5835261af tests/extmod: Add "btree" module test. 2016-06-21 10:00:02 +03:00
Paul Sokolovsky
119b3dabf7 tests: Add a testcase for machine.PinBase class. 2016-06-19 19:45:29 +03:00
Paul Sokolovsky
f0eea1fdf9 tests/extmod/vfs_fat_ramdisk: Add testcases for chdir(), getcwd(). 2016-05-29 18:54:14 +03:00
Damien George
07615d9f7e tests/extmod: Move split-on-empty-match tests to a separate test file.
And provide an expected-output file because these tests have a different
behaviour under CPython.
2016-04-26 10:19:04 +01:00
Damien George
da161fd9f0 extmod/uctypes: Finish support for FLOAT32 and FLOAT64 types. 2016-03-19 21:59:42 +00:00
Paul Sokolovsky
2740dd85f2 tests/vfs_fat_ramdisk: Add testcase for .rename(). 2016-02-29 01:24:18 +02:00
Paul Sokolovsky
9fb36af9af tests/vfs_fat_ramdisk: Allow to run in native mode (don't use "with"). 2016-02-29 01:03:32 +02:00
Paul Sokolovsky
eaa96a7610 tests/vfs_fat_ramdisk: Add testcase for .mkdir(). 2016-02-29 00:06:44 +02:00
Paul Sokolovsky
57425b648f tests/vfs_fat_ramdisk: Add testcase for .remove(). 2016-02-28 20:30:59 +02:00
Paul Sokolovsky
9c081b740b tests/vfs_fat_ramdisk: Add .listdir() testcase. 2016-02-28 17:19:12 +02:00
Paul Sokolovsky
dfc35afba1 tests/vfs_fat_ramdisk: Skip test if can't allocate ramdisk. 2016-02-15 17:27:57 +02:00
Paul Sokolovsky
9fdac9144d tests/vfs_fat_ramdisk: Allow to override sector size. 2016-02-14 20:52:38 +02:00
Paul Sokolovsky
9d0525182d tests/vfs_fat_ramdisk: Switch to ioctl-based blockdev API. 2016-02-14 20:45:08 +02:00
Paul Sokolovsky
0ee1d0f407 tests/vfs_fat_ramdisk: Add test for VfsFat. 2016-02-14 19:15:22 +02:00
Damien George
ac11e89fa3 tests: For urandom test, use sys.exit() instead of sys.exit(1). 2016-01-26 21:57:02 +00:00
Damien George
0ae97f531d tests: Add some tests for urandom module. 2016-01-26 15:27:00 +00:00
Dave Hylands
66d0c1052a extmod: Fix uctypes size calculation for bitfields 2016-01-10 23:31:26 +02:00
Antonin ENFRUN
b50030b1d0 tests/uctypes: Test item assignment for scalar arrays. 2016-01-03 20:32:51 +02:00
Dave Hylands
5a4a2b1db3 extmod: Add test which demonstrates LITTLE_ENDIAN packing failure 2015-12-09 21:43:28 +02:00
Paul Sokolovsky
aee704ebe1 extmod/modure: Make sure that errors in regexps are caught early. 2015-11-01 00:38:22 +03:00
Paul Sokolovsky
acea9352a9 tests/extmod: Add tests for sleep_ms/us(), ticks_ms/us/diff().
Simple smoke tests, mostly for coverage. Added to extmod based on the fact
that they're extensions to standard modules.
2015-10-20 01:54:20 +03:00
Damien George
25afc7da0d tests: Add tests to improve coverage of objstr.c. 2015-09-03 23:06:18 +01:00
Paul Sokolovsky
354d17523f modmachine: Implement physical memory access using /dev/mem (Linux, etc).
This requires root access. And on recent Linux kernels, with
CONFIG_STRICT_DEVMEM option enabled, only address ranges listed in
/proc/iomem can be accessed. The above compiled-time option can be
however overriden with boot-time option "iomem=relaxed".

This also removed separate read/write paths - there unlikely would
be a case when they're different.
2015-07-08 11:37:23 +03:00
Damien George
68e8b595de tests: Catch ValueError instead of any exception to properly test error. 2015-07-06 11:35:08 +00:00
Galen Hazelwood
616986a5f3 extmod: Add a2b_base64 and b2a_base64 functions to ubinascii. 2015-07-04 12:26:52 +03:00
Damien George
e44c1d3ace tests: Split out json float tests to separate files. 2015-06-25 10:50:00 +01:00
Damien George
f6518a7bd5 tests: Check that machine module exists and print SKIP if it doesn't. 2015-06-15 23:35:15 +01:00
Paul Sokolovsky
1679696612 moductypes: Swap address and descriptor args in constructor.
Now address comes first, and args related to struct type are groupped next.
Besides clear groupping, should help catch errors eagerly (e.g. forgetting
to pass address will error out).

Also, improve args number checking/reporting overall.
2015-06-06 22:57:54 +03:00
Dave Hylands
3ad94d6072 extmod: Add ubinascii.unhexlify
This also pulls out hex_digit from py/lexer.c and makes unichar_hex_digit
2015-05-20 09:29:22 +01:00
Damien George
0589c19d52 tests: Add test for machine module (mem* functions). 2015-05-08 00:18:28 +01:00
Damien George
e5c4362a98 tests: Add some more tests to improve code coverage of corner cases. 2015-04-05 00:03:43 +01:00
Damien George
f256cfef4f tests: Add some more tests for complex numbers and ure module. 2015-03-14 22:56:02 +00:00
Damien George
26a9975fba tests: Add some more tests for bytes, bignum, string and ujson. 2015-03-14 21:20:58 +00:00
Damien George
c832bde05f tests: Add zlib test for decompressing uncompressed data. 2015-03-12 00:17:04 +00:00
Damien George
55278dcc76 tests: Add test for modure when regex has errors. 2015-03-10 17:47:43 +00:00
Damien George
6cb6947b99 extmod/ure: Correctly return None when a group has no match.
See issue #1122.
2015-03-04 13:51:32 +00:00
Damien George
2af921fb51 tests: Add tests for op special meths, ubinascii, complex. 2015-03-02 12:47:44 +00:00
Damien George
4e3906d6b5 tests: Add tests for ure groups and named char classes.
Issue #1122 should now be fixed.
2015-02-21 10:39:41 +00:00
Damien George
5f64dc55d8 extmod: Make ujson.loads raise exception if given empty string.
Addresses issue #1097.
2015-02-02 21:52:19 +00:00
Paul Sokolovsky
2324f3ef29 moduzlib: Implement raw DEFLATE decoding support. 2015-01-28 02:21:49 +02:00
Paul Sokolovsky
444331c07f modujson: .loads(): Handle more whitespace characters. 2015-01-23 18:41:29 +02:00
Paul Sokolovsky
c8b0229bc7 tests: sha256: skip test if uhashlib module is not available. 2014-12-18 00:32:15 +02:00
Paul Sokolovsky
4a1c80c293 tests: Add test for hashlib.sha256 . 2014-11-22 14:54:02 +02:00
Paul Sokolovsky
66d08eb4fe moductypes: Add test for accessing UINT8 array. 2014-10-30 03:50:37 +02:00
Paul Sokolovsky
2559e13957 moductypes: Make sure we can apply .sizeof() to all aggregate types.
Before, sizeof() could be applied to a structure field only if that field
was itself a structure. Now it can be applied to PTR and ARRAY fields too.
It's not possible to apply it to scalar fields though, because as soon as
scalar field (int or float) is dereferenced, its value is converted into
Python int/float value, and all original type info is lost. Moreover, we
allow sizeof of type definitions too, and there int is used to represent
(scalar) types. So, we have ambiguity what int may be - either dereferenced
scalar structure field, or encoded scalar type. So, rather throw an error
if user tries to apply sizeof() to int.
2014-10-30 03:50:23 +02:00
Damien George
f5d69794a8 extmod: Add uheapq module. 2014-10-22 23:20:15 +01:00
Paul Sokolovsky
297d8469b8 modure: Update to re1.5 v0.6.1, fixed and extended character class support. 2014-10-17 22:25:18 +03:00
Paul Sokolovsky
95908b0f50 modure: Update to re1.5 v0.6, support for char sets/classes ([a-c]). 2014-10-15 04:44:07 +03:00
Paul Sokolovsky
34162872b1 moduzlib: Integrate into the system. 2014-10-13 00:07:44 +03:00
Paul Sokolovsky
f7bcce0552 modure: Basic tests. 2014-10-11 14:36:33 +03:00
Paul Sokolovsky
9aeec0e3a3 tests: Add missing "import sys". 2014-10-06 22:30:46 +03:00
Damien George
f53c343363 tests: Force skip of LE test on non-LE arch; improve run-tests-exp.sh. 2014-10-06 17:35:46 +00:00
Damien George
c3ab90da46 tests: Make printing of floats hopefully more portable. 2014-10-05 17:50:02 +01:00
Damien George
cde0ca21bf py: Simplify JSON str printing (while still conforming to JSON spec).
The JSON specs are relatively flexible and allow us to use one function
to print strings, be they ascii, bytes or utf-8 encoded.
2014-09-25 17:35:56 +01:00
Damien George
96e20c600f tests: Fix uctypes tests to run on 64bit arch; enable more native tests. 2014-09-23 14:15:45 +00:00
Damien George
2c180f7ccc extmod, ujson: Add test and comment for loads. 2014-09-21 23:43:03 +01:00
Damien George
612045f53f py: Add native json printing using existing print framework.
Also add start of ujson module with dumps implemented.  Enabled in unix
and stmhal ports.  Test passes on both.
2014-09-17 22:56:34 +01:00
Damien George
1ddd844815 extmod: Finish rename of zlib to zlibd; enable zlibd on stmhal. 2014-08-12 23:23:53 +01:00
Paul Sokolovsky
5073d3da07 tests: Add test for zlibd module. 2014-08-13 00:26:26 +03:00
Paul Sokolovsky
2097c8b1e1 moductypes: Add symbolic constants to specify bitfield position/length. 2014-07-11 00:06:36 +03:00
Paul Sokolovsky
8215847b4d moductypes: Foreign data interface module, roughly based on ctype ideas.
But much smaller and memory-efficient. Uses Python builtin data structures
(dict, tuple, int) to describe structure layout.
2014-07-09 19:28:24 +03:00