Commit Graph

22 Commits

Author SHA1 Message Date
yangfl
138a28dc07 tests/thread/thread_stacksize1.py: Increase stack size for CPython.
On arm64 with CPython:

  >>> _thread.stack_size(32*1024)
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  ValueError: size not valid: 32768 bytes

So increase the CPython value in the test to 512k so it runs on more
systems (on modern Linux the default stack size is usually 8MB).
2020-05-05 00:43:24 +10:00
Jim Mussared
8470cd0be9 py/scheduler: Add assert that scheduler is locked when unlocking.
And add a test that shows how this can happen when multiple threads are
accessing the scheduler, which fails if atomic sections are not used.
2020-04-13 21:55:47 +10:00
David Lechner
3dc324d3f1 tests: Format all Python code with black, except tests in basics subdir.
This adds the Python files in the tests/ directory to be formatted with
./tools/codeformat.py.  The basics/ subdirectory is excluded for now so we
aren't changing too much at once.

In a few places `# fmt: off`/`# fmt: on` was used where the code had
special formatting for readability or where the test was actually testing
the specific formatting.
2020-03-30 13:21:58 +11:00
Damien George
e374cfff80 py/modthread: Raise RuntimeError in release() if lock is not acquired. 2017-06-14 14:43:50 +10:00
Ville Skyttä
ca16c38210 various: Spelling fixes 2017-05-29 11:36:05 +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
Damien George
28185bb81b tests/thread: Fix stack size test so tests run reliably on baremetal. 2017-02-01 17:21:35 +11:00
Damien George
bebb3a6160 tests/thread: Make thread_exc2 runable on baremetal. 2017-01-31 13:59:20 +11:00
Rami Ali
f397e1fdf0 tests/thread: Improve modthread.c test coverage. 2016-12-29 13:27:50 +11:00
Damien George
8b9ddf4031 tests/thread: Allow some tests to run on ports with not much heap. 2016-06-28 11:28:52 +01:00
Damien George
63d05228a3 tests/thread: Allow thread_sleep1 to run without floating point. 2016-06-28 11:28:52 +01:00
Damien George
15e68277c1 tests/thread: Make sure that thread tests don't rely on floating point. 2016-06-28 11:28:52 +01:00
Damien George
5b7789d519 tests/thread: Make stack-size test run correctly and reliable on uPy. 2016-06-28 11:28:52 +01:00
Damien George
b7274e91bc tests/thread: Add test for concurrent mutating of user instance. 2016-06-28 11:28:50 +01:00
Damien George
2e4cdae4fd tests/thread: Add test for concurrent interning of strings.
Qstr code accesses global state and needs to be made thread safe.
2016-06-28 11:28:50 +01:00
Damien George
094a0dd11a tests/thread: Add tests that mutate shared objects.
Tests concurrent mutating access to: list, dict, set, bytearray.
2016-06-28 11:28:50 +01:00
Damien George
c73cf9d931 tests/thread: Rename thread_stress_XXX.py to stress_XXX.py. 2016-06-28 11:28:50 +01:00
Damien George
dcc7c5bd89 tests/thread: Add tests for running GC within a thread, and heap stress. 2016-06-28 11:28:49 +01:00
Damien George
3545ef8bb4 tests/thread: Remove need to sleep to wait for completion in some tests.
Use a lock and a counter instead, and busy wait for all threads to
complete.  This makes test run faster and they no longer rely on the time
module.
2016-06-28 11:09:31 +01:00
Damien George
2d5ea38b49 tests: Add 3 more tests for _thread module. 2016-06-28 11:09:31 +01:00
Damien George
ed36632c6c tests: Add tests for _thread module.
Includes functionality and stress tests.
2016-06-28 11:09:31 +01:00