Commit Graph

10332 Commits

Author SHA1 Message Date
Scott Shawcroft b62d8faaec
Merge pull request #735 from jepler/generator-stack-overflow-circuitpython
py/objgenerator: Check stack before resuming a generator
2018-04-01 22:38:19 -07:00
Jeff Epler a909007fef py/objgenerator: Check stack before resuming a generator
This turns a hard crash in a recursive generator into
a 'maximum recursion depth exceeded' exception.
2018-04-01 16:40:15 -05:00
Jeff Epler 0041df0c6b py/objstr: Don't crash when end < start
.. and add testcases for the same.

(crash found by afl-fuzz)
2018-03-31 22:17:11 -05:00
Radomir Dopieralski 280374fa63 Respect pin's pull in gamepad
While it is traditional to have buttons on pins that are pulled up, and
have the button connect them to the ground, some CircuitPython boards
(notably the CPX) have the button pins pulled low and the button
connects them to VCC.

This patch makes the gamepad only change the pin's pull if it wasn't
already set when passed to the constructor, and also makes it consider
a button pressed when its value is the opposite of its pull.
2018-03-31 21:13:02 +02:00
Radomir Dopieralski 6ca4fd82ed Add a type check to the gamepad module
Make sure that all the arguments passed are indeed DigitalInOut.
This avoids crashes when the users pass something else.
2018-03-31 20:41:16 +02:00
Scott Shawcroft 3215b85568
Merge pull request #728 from jepler/double-splat-crash-circuitpython
py/bc: Turn assertion error into exception
2018-03-31 09:57:25 -07:00
Scott Shawcroft d65ea992bf
Merge pull request #729 from jepler/tests-parallel-circuitpython
Optionally parallelize the testsuite
2018-03-31 09:55:21 -07:00
Jeff Epler f8e0baa0b7 appveyor: parallelize tests 2018-03-31 10:43:57 -05:00
Jeff Epler b59964f707 ports/unix/Makefile: parallelize tests 2018-03-31 10:42:33 -05:00
Jeff Epler 0dfc3be903 run_tests: EXTERNAL_TARGETS can't run in parallel 2018-03-31 10:40:37 -05:00
Jeff Epler c1cd259529 travis.yml: best guesses about when to run tests in parallel
Notably, "--via-mpy" spews failures when threaded, possibly indicating
that micropython is not creating mpy files in threadsafe manner.
2018-03-31 10:39:55 -05:00
Jeff Epler c2b8529698 run-tests: automatically parallelism based on CPU (thread) count 2018-03-31 10:38:54 -05:00
Jeff Epler a3309ebb80 run-tests: optionally parallelize tests
When requested via 'run-tests -j', more than one test will be run
at a time.  On my system, (i5-3320m with 4 threads / 2 cores), this
reduces elapsed time by over 50% when testing pots/unix/micropython.

Elapsed time, seconds, best of 3 runs with each -j value:

before patchset: 18.1
            -j1: 18.1
            -j2: 11.3  (-37%)
            -j4:  8.7  (-52%)
            -j6:  8.4  (-54%)

In all cases the final output is identical:
    651 tests performed (18932 individual testcases)
    651 tests passed
    23 tests skipped: buffered_writer...
though the individual pass/fail messages can be different/interleaved.
2018-03-31 10:38:54 -05:00
Jeff Epler b9dd6a5bb4 run-tests: sort skipped and failed tests
.. otherwise the line which reports tests skipped and failed can come in
different orders when -j values above 1 are used.
2018-03-31 10:38:54 -05:00
Jeff Epler a73f005e00 run_tests: make access to shared variables thread safe 2018-03-31 10:38:52 -05:00
Jeff Epler 4767d23db3 run_tests: factor run_one_test to function 2018-03-31 10:38:04 -05:00
Jeff Epler 853f7ac4d0 py/bc: Turn assertion error into exception 2018-03-31 08:44:29 -05:00
Dan Halbert c00b25ec45 WIP: HID works with MSC interfaces removed 2018-03-30 23:31:28 -04:00
Dan Halbert df91878d2e WIP: works with just keyboard but not complex report descriptor 2018-03-30 23:24:00 -04:00
Scott Shawcroft 1489450693
Merge pull request #727 from sommersoft/build_doc
Added git submodule Step To SAMD README
2018-03-30 15:59:39 -07:00
sommersoft 8af98d0dc9 ambiguized directory paths 2018-03-30 22:44:16 +00:00
sommersoft a5b60647be improved arrangement 2018-03-30 22:26:21 +00:00
sommersoft 7c0be04696 verbiage cleanup 2018-03-30 22:21:35 +00:00
sommersoft c70acab8b3 updated README; added git submodule info 2018-03-30 22:16:36 +00:00
sommersoft 6ee573c7c9
Merge branch 'master' into super_status 2018-03-30 14:27:39 -05:00
Dan Halbert bee0d2edb4
Merge pull request #710 from jepler/assertion-failures-to-exceptions
Assertion failures to exceptions
2018-03-30 13:47:55 -04:00
Jeff Epler ff06a45599 Fix assertion failures in super_attr
micropython: ../../py/objtype.c:1100: super_attr: Assertion `MP_OBJ_IS_TYPE(self->type, &mp_type_type)' failed.

e.g., when making calls like
    super(1, 1).x
2018-03-29 06:42:10 -05:00
Jeff Epler 6da8d7c465 Fix assertion failures in mp_obj_new_type
Fixes the following assertion failures when the arguments to type()
were not of valid types:
micropython: ../../py/objtype.c:984: mp_obj_new_type: Assertion `MP_OBJ_IS_TYPE(bases_tuple, &mp_type_tuple)' failed.
micropython: ../../py/objtype.c:994: mp_obj_new_type: Assertion `MP_OBJ_IS_TYPE(items[i], &mp_type_type)' failed.

e.g., when making calls like
    type("", (), 3)
    type("", 3, {})
2018-03-29 06:42:10 -05:00
Jeff Epler a55988a547 Fix assertion failure in mpz_divmod_inpl
.. turning this from an assertion failure into an exception:
    pow(1,1,0)
2018-03-29 06:42:10 -05:00
Scott Shawcroft 676ed4e199
Merge pull request #724 from tannewt/fix_freetouch_submodule
Remove freetouch files that were accidentally checked in and
2018-03-28 14:24:32 -07:00
Scott Shawcroft 7b2215a27c
Merge pull request #723 from jepler/high-quality-float-hash
Enable high-quality float hash
2018-03-28 14:16:32 -07:00
Scott Shawcroft 19b0b414e6 Remove freetouch files that were accidentally checked in and
readd the submodule.
2018-03-28 14:04:53 -07:00
Jeff Epler abec199c19 Enable high-quality float hash
This appears to have a relatively small impact on flash usage but
fixes some pathological slow behavior putting floats in dicts or sets.

Closes: #704
2018-03-27 21:56:30 -05:00
Scott Shawcroft 6711c5c90d
Merge pull request #712 from jepler/fslabel
Add ability to get, set filesystem label from CircuitPython
2018-03-27 19:51:48 -07:00
Jeff Epler 34f5498760 Document storage.VfsFat more thoroughly 2018-03-27 21:28:19 -05:00
Jeff Epler 9c47fd9c13 Specifically give a better error message for setlabel on RO fs 2018-03-27 21:28:19 -05:00
Jeff Epler fe7f405fc7 Add VfsFat.label property
These allow accessing the filesystem label.  For instance,
in boot.py, you can set the label on the built-in storage with:
   storage.remount('/', False)
   storage.getmount('/').label = "NEWLABEL"
   storage.remount('/', True)

Users with multiple CIRCUITPY boards may find it desirable to
choose a different label for each board they own.
2018-03-27 21:28:18 -05:00
Jeff Epler c08f5a3a00 Add storage.getmount to retrieve the mount object associated with a path 2018-03-27 21:28:18 -05:00
Jeff Epler 968763aa1d factor out storage_object_from_path 2018-03-27 21:28:18 -05:00
Dan Halbert 1eba580443
Merge pull request #722 from adafruit/tannewt-patch-7
Add four missing drivers
2018-03-27 17:53:43 -04:00
Scott Shawcroft f4563d11d1
Add four missing drivers 2018-03-27 14:25:14 -07:00
Dan Halbert 4c2f729a7a
Merge pull request #713 from jepler/lto-type-diagnostic-bis
Allow building on gcc 5.4, while preserving ability to build with 7.2
2018-03-27 09:28:41 -04:00
Scott Shawcroft 4517ab8ba4
Merge pull request #709 from jepler/core-class-superproperty
Make test core_class_superproperty.py succeed
2018-03-26 21:59:05 -07:00
Kattni 77938db8c8
Merge pull request #719 from tannewt/fix_i2c_hang
Fix I2C init hang when the SCL pin is pulled low.
2018-03-26 20:08:14 -04:00
Dan Halbert 4190aa2eed
Merge pull request #715 from jepler/array-operation-restrictions-bis
Remove 'O', 'P' support in arrays
2018-03-26 20:01:34 -04:00
Jeff Epler 047a4f59c5 This test now passes, make it run regularly 2018-03-26 18:47:06 -05:00
Scott Shawcroft cebcec5e63 Check for floating pins by pulling them low briefly before testing their values. 2018-03-26 16:32:16 -07:00
Jeff Epler 355bf8b553 Conditionally compile out nonstandard array/struct typecodes
.. defaulting to off for circuitpython-supported boards, on for others.

.. fixing up the tests that fail when it is turned off, so that they skip
instead of failing
2018-03-26 18:13:49 -05:00
Scott Shawcroft 25ba8ee489 Add an s because grammar. 2018-03-26 15:21:08 -07:00
Scott Shawcroft 37538fc0e7 Fix I2C init hang when the SCL pin is pulled low.
We added a check to make sure the pins are in a high state before
initing the bus. This leads to a friendly error message when someone
forgets to add the pull up resistors to their circuit.
2018-03-26 15:13:52 -07:00