summaryrefslogtreecommitdiff
path: root/tests (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Rebase fibers on top of schedulers and tasksAndy Wingo2017-08-062-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.
* Add new channels test.Andy Wingo2017-02-201-0/+22
| | | | * tests/channels.scm (pingpong): New test.
* run-fibers returns when initial fiber finishesAndy Wingo2017-02-192-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.
* Add allocation speedup testAndy Wingo2017-02-171-0/+13
| | | | * tests/speedup.scm: Add allocation speedup test.
* Add condition variable implementationAndy Wingo2017-02-112-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.
* More speedup tests.Andy Wingo2017-01-181-3/+7
| | | | * tests/speedup.scm (do-times): Add different loop-to tests.
* Add test for parallel speedup.Andy Wingo2017-01-181-0/+55
| | | | | * tests/speedup.scm: New file. * Makefile.am (TESTS): Add new file.
* Disable parallelism in scheduling-order testsAndy Wingo2017-01-081-4/+4
| | | | | | * tests/basic.scm (assert-run-fibers-terminates): Allow keyword args to run-fibers. (run-order, wakeup-order): Disable parallelism.
* Add support for operations from foreign threadsAndy Wingo2017-01-051-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.
* Fix spawn-fiber outside run-fibersAndy Wingo2016-12-301-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.
* Add support for preemptionAndy Wingo2016-12-121-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.
* Fibers inherit dynamic state of parent.Andy Wingo2016-12-121-0/+72
| | | | | | * fibers.scm (spawn-fiber): Fibers inherit dynamic state of parent. * tests/parameters.scm: New test. * Makefile.am: Add new file.
* Reimplement in terms of Parallel Concurrent MLAndy Wingo2016-10-032-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.
* Sleep duration testAndy Wingo2016-09-111-1/+13
| | | | * tests/basic.scm (check-sleep): Add sleep duration test.
* Add initial channels testsAndy Wingo2016-09-101-5/+16
| | | | | * tests/basic.scm (assert-run-fibers-returns): Change arg order. (rpc, rpc-fib): Add channels tests.
* run-fibers returns values from initial threadAndy Wingo2016-09-101-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.
* Better fiber run orderAndy Wingo2016-09-091-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.
* Update test to-doAndy Wingo2016-09-081-6/+0
| | | | * tests/basic.scm: Update comments.
* Add testsAndy Wingo2016-09-081-0/+121
* Makefile.am (TESTS, TESTS_ENVIRONMENT): * configure.ac: Enable tests. * tests/basic.scm: Add some tests.