summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2018-04-05tests/micropython/extreme_exc.py: Fix test to run on more ports/configs.Damien George
2018-04-05tests/micropython: Add set of tests for extreme cases of raising exc's.Damien George
2018-04-05tests/basics/string_compare.py: Add test with string that hashes to 0.Damien George
The string "Q+?" is special in that it hashes to zero with the djb2 algorithm (among other strings), and a zero hash should be incremented to a hash of 1.
2018-04-05tests/basics/class_super.py: Add tests for store/delete of super attr.Damien George
2018-04-05tests/basics: Add tests for edge cases of nan-box's 47-bit small int.Damien George
2018-04-04tests/basics: Add test for subclassing an iterable native type.Damien George
2018-04-04tests/basics/int_big1.py: Add test for big int in mp_obj_get_int_maybe.Damien George
2018-04-04tests/stress: Add test to verify the GC can trace nested objects.Damien George
2018-04-04tests/basics: Modify int-big tests to prevent constant folding.Damien George
So that these tests test the runtime behaviour, not the compiler (which may be executed offline).
2018-04-04tests/basics/int_big1.py: Add test converting str with non-print chars.Damien George
2018-04-04tests/basics: Add test for use of return within try-except.Damien George
The case of a return statement in the try suite of a try-except statement was previously only tested by builtin_compile.py, and only then in the part of this test which checked for the existence of the compile builtin. So this patch adds an explicit unit test for this case.
2018-04-01Merge pull request #734 from jepler/str-find-backwards-circuitpythonScott Shawcroft
py/objstr: Don't crash when end < start
2018-04-01py/objgenerator: Check stack before resuming a generatorJeff Epler
This turns a hard crash in a recursive generator into a 'maximum recursion depth exceeded' exception.
2018-03-31py/objstr: Don't crash when end < startJeff Epler
.. and add testcases for the same. (crash found by afl-fuzz)
2018-03-31Merge pull request #728 from jepler/double-splat-crash-circuitpythonScott Shawcroft
py/bc: Turn assertion error into exception
2018-03-31Merge pull request #729 from jepler/tests-parallel-circuitpythonScott Shawcroft
Optionally parallelize the testsuite
2018-03-31run_tests: EXTERNAL_TARGETS can't run in parallelJeff Epler
2018-03-31run-tests: automatically parallelism based on CPU (thread) countJeff Epler
2018-03-31run-tests: optionally parallelize testsJeff Epler
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-31run-tests: sort skipped and failed testsJeff Epler
.. otherwise the line which reports tests skipped and failed can come in different orders when -j values above 1 are used.
2018-03-31run_tests: make access to shared variables thread safeJeff Epler
2018-03-31run_tests: factor run_one_test to functionJeff Epler
2018-03-31py/bc: Turn assertion error into exceptionJeff Epler
2018-03-30Merge pull request #710 from jepler/assertion-failures-to-exceptionsDan Halbert
Assertion failures to exceptions
2018-03-30tests/basics/iter1.py: Add more tests for walking a user-defined iter.Damien George
Some code in mp_iternext() was only tested by the native emitter, so the tests added here test this function using just the bytecode emitter.
2018-03-30py/runtime: Be sure that non-intercepted thrown object is an exception.Damien George
The VM expects that, if mp_resume() returns MP_VM_RETURN_EXCEPTION, then the returned value is an exception instance (eg to add a traceback to it). It's possible that a value passed to a generator's throw() is not an exception so must be explicitly checked for if the thrown value is not intercepted by the generator. Thanks to @jepler for finding the bug.
2018-03-30py/runtime: Check that keys in dicts passed as ** args are strings.Damien George
Prior to this patch the code would crash if a key in a ** dict was anything other than a str or qstr. This is because mp_setup_code_state() assumes that keys in kwargs are qstrs (for efficiency). Thanks to @jepler for finding the bug.
2018-03-29Fix assertion failures in super_attrJeff Epler
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-29Fix assertion failures in mp_obj_new_typeJeff Epler
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-29Fix assertion failure in mpz_divmod_inplJeff Epler
.. turning this from an assertion failure into an exception: pow(1,1,0)
2018-03-27Add VfsFat.label propertyJeff Epler
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-26Merge pull request #709 from jepler/core-class-superpropertyScott Shawcroft
Make test core_class_superproperty.py succeed
2018-03-26This test now passes, make it run regularlyJeff Epler
2018-03-26Conditionally compile out nonstandard array/struct typecodesJeff Epler
.. 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-23Merge pull request #697 from jepler/issue501Scott Shawcroft
extmod/vfs_fat_file: Implement SEEK_CUR for non-zero offset.
2018-03-23extmod/vfs_fat_file: Implement SEEK_CUR for non-zero offset.Ayke van Laethem
CPython doesn't allow SEEK_CUR with non-zero offset for files in text mode, and uPy inherited this behaviour for both text and binary files. It makes sense to provide full support for SEEK_CUR of binary-mode files in uPy, and to do this in a minimal way means also allowing to use SEEK_CUR with non-zero offsets on text-mode files. That seems to be a fair compromise.
2018-03-23Implement * and *= for array.arrayJeff Epler
2018-03-19tests/pyb/can: Update to test pyb.CAN restart, state, info, inplace recvDamien George
2018-03-16tests/pyb: Update CAN test to expect that auto_restart is printed.Damien George
2018-03-15tests/cpydiff: Indent workaround code snippet so it formats correctly.Damien George
2018-03-12extmod/vfs_fat: Add file size as 4th element of uos.ilistdir tuple.Tom Collins
2018-03-08tests/basics/builtin_enumerate: Add test for many pos args to enumerate.Damien George
2018-03-04tests/extmod/time_ms_us: Fix ticks tests, ticks_diff args are reversed.Damien George
2018-03-04tests/extmod/time_ms_us: Add test for calling ticks_cpu().Damien George
This is just to test that the function exists and returns some kind of valid value. Although this file is for testing ms/us functions, put the ticks_cpu() test here so not to add a new test file.
2018-03-03tests/unix: Add coverage test for uio.resource_stream from frozen str.Damien George
2018-03-02tests: Move heap-realloc-while-locked test from C to Python.Damien George
This test for calling gc_realloc() while the GC is locked can be done in pure Python, so better to do it that way since it can then be tested on more ports.
2018-03-01tests/unix: Add coverage tests for various GC calls.Damien George
2018-03-01py/formatfloat: Fix case where floats could render with negative digits.Damien George
Prior to this patch, some architectures (eg unix x86) could render floats with "negative" digits, like ")". For example, '%.23e' % 1e-80 would come out as "1.0000000000000000/)/(,*0e-80". This patch fixes the known cases.
2018-03-01py/formatfloat: Fix case where floats could render with a ":" character.Damien George
Prior to this patch, some architectures (eg unix x86) could render floats with a ":" character in them, eg 1e+39 would come out as ":e+38" (":" is just after "9" in ASCII so this is like 10e+38). This patch fixes some of these cases.
2018-03-01py/formatfloat: Fix rounding of %f format with edge-case FP values.Damien George
Prior to this patch the %f formatting of some FP values could be off by up to 1, eg '%.0f' % 123 would return "122" (unix x64). Depending on the FP precision (single vs double) certain numbers would format correctly, but others wolud not. This patch should fix all cases of rounding for %f.