summaryrefslogtreecommitdiff
path: root/tests (unfollow)
Commit message (Collapse)AuthorFilesLines
2017-08-06Rebase fibers on top of schedulers and tasksAndy Wingo2-2/+3
This commit refactors fibers to be based on lighter-weight "tasks", and makes the scheduler API more orthogonal. Now there are no more fiber objects (although the fibers layer could re-add them if they are useful), and fibers no longer have names (although again this could be re-added at an upper layer). Also it's the current scheduler that's bound by a parameter, not the current fiber, and as it's a thread-safe parameter it doesn't need to be bound in each fiber.
2017-02-20Add new channels test.Andy Wingo1-0/+22
* tests/channels.scm (pingpong): New test.
2017-02-19run-fibers returns when initial fiber finishesAndy Wingo2-32/+34
* epoll.c (scm_primitive_epoll_wait): Accept timeout in internal time units instead of milliseconds. Avoid some overhead if the timeout is zero. * fibers/epoll.scm (epoll): Adapt to primitive-epoll-wait chance. Change get-timeout callback to an "expiry" argument and an update-expiry last-minute function. Tighten the window around the "waiting" epoll-state. * fibers.scm (%run-fibers): Remove current-read-waiter / current-write-waiter parameterization, given that fibers individually each have this parameterization. (run-fibers): Add #:drain? argument. * fibers/internal.scm (schedule-runnables-for-next-turn): Simplify a bit, inlining scheduler-poll-timeout and adapting to epoll change. (scheduler-work-pending?): New function. (run-scheduler): Simplify finish? logic. * tests/basic.scm: * tests/speedup.scm: Update to drain where needed. * fibers.texi: Update for new run-fibers termination condition.
2017-02-17Add allocation speedup testAndy Wingo1-0/+13
* tests/speedup.scm: Add allocation speedup test.
2017-02-11Add condition variable implementationAndy Wingo2-1/+82
* fibers/conditions.scm: * tests/conditions.scm: New files. * Makefile.am: Add new files. * fibers.texi (Conditions): New section. * fibers/timers.scm (sleep-operation): Rename from wait-operation. * tests/foreign.scm: Adapt to sleep-operation change.
2017-01-18More speedup tests.Andy Wingo1-3/+7
* tests/speedup.scm (do-times): Add different loop-to tests.
2017-01-18Add test for parallel speedup.Andy Wingo1-0/+55
* tests/speedup.scm: New file. * Makefile.am (TESTS): Add new file.
2017-01-08Disable parallelism in scheduling-order testsAndy Wingo1-4/+4
* tests/basic.scm (assert-run-fibers-terminates): Allow keyword args to run-fibers. (run-order, wakeup-order): Disable parallelism.
2017-01-05Add support for operations from foreign threadsAndy Wingo1-0/+71
* tests/foreign.scm: New file. * Makefile.am: Add new file. * fibers/operations.scm (perform-operation): Support blocking operations from foreign threads (without a scheduler). * fibers/timers.scm (timer-sched, *timer-sched*, timer-operation): Add support for timeouts that use an auxiliary thread instead of relying on the current scheduler.
2016-12-30Fix spawn-fiber outside run-fibersAndy Wingo1-1/+6
* fibers.scm (run-fibers): Require init thunk for run-fibers without a scheduler. (spawn-fiber): Incorporate helper procedures, remove dynamic-state argument (as it's always the current dynamic state), and add parallel? argument. Ensure the fiber will have the right read/write waiters. * tests/basic.scm: Update.
2016-12-12Add support for preemptionAndy Wingo1-0/+81
* Makefile.am: Add new test. * TODO.md: Remove stale TODO entries. * fibers.scm (run-fibers): Add #:hz parameter. * fibers.texi (Design): Mention that we support preemption. (Using Fibers): Update for preemption. * fibers/internal.scm (<scheduler>): Add hz field. (make-scheduler): Add #:hz initarg. (maybe-preemptive): New helper. (run-scheduler): Use maybe-preemptive. * tests/preemption.scm: New test.
2016-12-12Fibers inherit dynamic state of parent.Andy Wingo1-0/+72
* fibers.scm (spawn-fiber): Fibers inherit dynamic state of parent. * tests/parameters.scm: New test. * Makefile.am: Add new file.
2016-10-03Reimplement in terms of Parallel Concurrent MLAndy Wingo2-22/+81
* fibers/operations.scm: New file. * fibers/channels.scm: Reimplement in terms of operations (CML events). * tests/basic.scm: Remove channels tests. * tests/channels.scm: Add channels tests. * Makefile.am: Update for new files.
2016-09-11Sleep duration testAndy Wingo1-1/+13
* tests/basic.scm (check-sleep): Add sleep duration test.
2016-09-10Add initial channels testsAndy Wingo1-5/+16
* tests/basic.scm (assert-run-fibers-returns): Change arg order. (rpc, rpc-fib): Add channels tests.
2016-09-10run-fibers returns values from initial threadAndy Wingo1-3/+13
* fibers.scm (run-fibers): * fibers/internal.scm (run-scheduler): If there is an init thunk, keep the scheduler running until the corresponding fiber is finished. Return the values returned from the fiber. * tests/basic.scm (assert-run-fibers-terminates): Return values. (assert-run-fibers-returns): New helper. Use it.
2016-09-09Better fiber run orderAndy Wingo1-0/+22
* fibers/internal.scm (schedule-runnables-for-next-turn): Reverse runnables queue so that fibers are run in the next turn in the order that they were added in the previous turn. * tests/basic.scm (run-order): Add run order and sleep wakeup order tests.
2016-09-08Update test to-doAndy Wingo1-6/+0
* tests/basic.scm: Update comments.
2016-09-08Add testsAndy Wingo1-0/+121
* Makefile.am (TESTS, TESTS_ENVIRONMENT): * configure.ac: Enable tests. * tests/basic.scm: Add some tests.