about summary refs log tree commit diff
path: root/src/libstd/rt/test.rs
AgeCommit message (Collapse)AuthorLines
2013-12-24std: Delete rt::testAlex Crichton-440/+0
This module contains many M:N specific concepts. This will no longer be available with libgreen, and most functions aren't really that necessary today anyway. New testing primitives will be introduced as they become available for 1:1 and M:N. A new io::test module is introduced with the new ip4/ip6 address helpers to continue usage in io tests.
2013-12-16Fallout of rewriting std::commAlex Crichton-11/+11
2013-12-10libextra: Another round of de-`Cell`-ing.Patrick Walton-20/+10
34 uses of `Cell` remain.
2013-12-04Rename std::rt::deque::*::init() to *::new()Kevin Ballard-3/+3
2013-12-04Revert "libstd: Change `Path::new` to `Path::init`."Kevin Ballard-1/+1
This reverts commit c54427ddfbbab41a39d14f2b1dc4f080cbc2d41b. Leave the #[ignores] in that were added to rustpkg tests. Conflicts: src/librustc/driver/driver.rs src/librustc/metadata/creader.rs
2013-11-29Implement a lock-free work-stealing dequeAlex Crichton-18/+16
This adds an implementation of the Chase-Lev work-stealing deque to libstd under std::rt::deque. I've been unable to break the implementation of the deque itself, and it's not super highly optimized just yet (everything uses a SeqCst memory ordering). The major snag in implementing the chase-lev deque is that the buffers used to store data internally cannot get deallocated back to the OS. In the meantime, a shared buffer pool (synchronized by a normal mutex) is used to deallocate/allocate buffers from. This is done in hope of not overcommitting too much memory. It is in theory possible to eventually free the buffers, but one must be very careful in doing so. I was unable to get some good numbers from src/test/bench tests (I don't think many of them are slamming the work queue that much), but I was able to get some good numbers from one of my own tests. In a recent rewrite of select::select(), I found that my implementation was incredibly slow due to contention on the shared work queue. Upon switching to the parallel deque, I saw the contention drop to 0 and the runtime go from 1.6s to 0.9s with the most amount of time spent in libuv awakening the schedulers (plus allocations). Closes #4877
2013-11-29libstd: Change `Path::new` to `Path::init`.Patrick Walton-1/+1
2013-11-27Improve the rt::thread moduleAlex Crichton-1/+1
* Added doc comments explaining what all public functionality does. * Added the ability to spawn a detached thread * Added the ability for the procs to return a value in 'join'
2013-11-26librustc: Make `||` lambdas not infer to `proc`sPatrick Walton-12/+17
2013-11-18auto merge of #10561 : pcwalton/rust/procify, r=alexcrichtonbors-15/+15
r? @alexcrichton
2013-11-18Remove the C++ lock_and_signal typeAlex Crichton-8/+12
A the same time this purges all runtime support needed for statically initialized mutexes, moving all users over to the new Mutex type instead.
2013-11-18libstd: Change all `~fn()`s to `proc`s in the standard library.Patrick Walton-15/+15
This makes `Cell`s no longer necessary in most cases.
2013-11-11Move std::rt::io to std::ioAlex Crichton-1/+1
2013-11-11Remove #[fixed_stack_segment] and #[rust_stack]Alex Crichton-4/+0
These two attributes are no longer useful now that Rust has decided to leave segmented stacks behind. It is assumed that the rust task's stack is always large enough to make an FFI call (due to the stack being very large). There's always the case of stack overflow, however, to consider. This does not change the behavior of stack overflow in Rust. This is still normally triggered by the __morestack function and aborts the whole process. C stack overflow will continue to corrupt the stack, however (as it did before this commit as well). The future improvement of a guard page at the end of every rust stack is still unimplemented and is intended to be the mechanism through which we attempt to detect C stack overflow. Closes #8822 Closes #10155
2013-11-10Enable uv pipe tests on windowsAlex Crichton-1/+5
Turns out the pipe names must have special names on windows. Once we have special names, all the tests pass just fine. Closes #10386
2013-10-29Move rust's uv implementation to its own crateAlex Crichton-4/+3
There are a few reasons that this is a desirable move to take: 1. Proof of concept that a third party event loop is possible 2. Clear separation of responsibility between rt::io and the uv-backend 3. Enforce in the future that the event loop is "pluggable" and replacable Here's a quick summary of the points of this pull request which make this possible: * Two new lang items were introduced: event_loop, and event_loop_factory. The idea of a "factory" is to define a function which can be called with no arguments and will return the new event loop as a trait object. This factory is emitted to the crate map when building an executable. The factory doesn't have to exist, and when it doesn't then an empty slot is in the crate map and a basic event loop with no I/O support is provided to the runtime. * When building an executable, then the rustuv crate will be linked by default (providing a default implementation of the event loop) via a similar method to injecting a dependency on libstd. This is currently the only location where the rustuv crate is ever linked. * There is a new #[no_uv] attribute (implied by #[no_std]) which denies implicitly linking to rustuv by default Closes #5019
2013-10-28Allow fail messages to be caught, and introduce the Any traitMarvin Löbel-23/+24
Some code cleanup, sorting of import blocks Removed std::unstable::UnsafeArc's use of Either Added run-fail tests for the new FailWithCause impls Changed future_result and try to return Result<(), ~Any>. - Internally, there is an enum of possible fail messages passend around. - In case of linked failure or a string message, the ~Any gets lazyly allocated in future_results recv method. - For that, future result now returns a wrapper around a Port. - Moved and renamed task::TaskResult into rt::task::UnwindResult and made it an internal enum. - Introduced a replacement typedef `type TaskResult = Result<(), ~Any>`.
2013-10-24Implement a basic event loop built on LittleLockAlex Crichton-2/+42
It's not guaranteed that there will always be an event loop to run, and this implementation will serve as an incredibly basic one which does not provide any I/O, but allows the scheduler to still run. cc #9128
2013-10-24Remove IoFactoryObject for ~IoFactoryAlex Crichton-2/+2
This involved changing a fair amount of code, rooted in how we access the local IoFactory instance. I added a helper method to the rtio module to access the optional local IoFactory. This is different than before in which it was assumed that a local IoFactory was *always* present. Now, a separate io_error is raised when an IoFactory is not present, yet I/O is requested.
2013-10-24Migrate Rtio objects to true trait objectsAlex Crichton-2/+3
This moves as many as I could over to ~Trait instead of ~Typedef. The only remaining one is the IoFactoryObject which should be coming soon...
2013-10-24Implement io::net::unixAlex Crichton-0/+10
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-3/+3
Who doesn't like a massive renaming?
2013-10-17std: Move size/align functions to std::mem. #2240Brian Anderson-1/+1
2013-10-15path2: Replace the path module outrightKevin Ballard-3/+5
Remove the old path. Rename path2 to path. Update all clients for the new path. Also make some miscellaneous changes to the Path APIs to help the adoption process.
2013-09-30std: Remove usage of fmt!Alex Crichton-3/+3
2013-09-15Remove {uint,int,u64,i64,...}::from_str,from_str_radixblake2-ppc-2/+2
Remove these in favor of the two traits themselves and the wrapper function std::from_str::from_str. Add the function std::num::from_str_radix in the corresponding role for the FromStrRadix trait.
2013-09-09rename `std::iterator` to `std::iter`Daniel Micay-1/+1
The trait will keep the `Iterator` naming, but a more concise module name makes using the free functions less verbose. The module will define iterables in addition to iterators, as it deals with iteration in general.
2013-09-02Raise the file descriptor limits when running compiletestAlex Crichton-2/+8
We already do this for libstd tests automatically, and compiletest runs into the same problems where when forking lots of processes lots of file descriptors are created. On OSX we can use specific syscalls to raise the limits, in this situation, though. Closes #8904
2013-08-19Try to fix mac valgrind bot by disabling thread-heavy activities.Graydon Hoare-5/+9
2013-08-19Add externfn macro and correctly label fixed_stack_segmentsNiko Matsakis-0/+3
2013-08-10Mass rename of .consume{,_iter}() to .move_iter()Erick Tryzelaar-1/+1
cc #7887
2013-08-08Enabled workstealing in the scheduler. Previously we had one global work ↵toddaaro-4/+14
queue shared by each scheduler. Now there is a separate work queue for each scheduler, and work is "stolen" from other queues when it is exhausted locally.
2013-08-07std: Allow spawners to specify stack sizeBrian Anderson-8/+7
2013-08-05Updated std::Option, std::Either and std::ResultMarvin Löbel-2/+2
- Made naming schemes consistent between Option, Result and Either - Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None) - Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
2013-08-04auto merge of #8243 : stepancheg/rust/ipv, r=brsonbors-5/+5
multicast functions now take IpAddr (without port), because they dont't need port. Uv* types renamed: * UvIpAddr -> UvSocketAddr * UvIpv4 -> UvIpv4SocketAddr * UvIpv6 -> UvIpv6SocketAddr "Socket address" is a common name for (ip-address, port) pair (e.g. in sockaddr_in struct). P. S. Are there any backward compatibility concerns? What is std::rt module, is it a part of public API?
2013-08-03remove obsolete `foreach` keywordDaniel Micay-4/+4
this has been replaced by `for`
2013-08-02Bump fd limit on macos when running rt testsKevin Ballard-0/+78
OS X defaults the ulimit for open files to 256 for programs launched from the Terminal (GUI apps get a higher default). Unfortunately this is too low for the rt tests, which deliberately overcommit and create a lot of threads (which means a lot of schedulers, and each scheduler needs at least 2 fds). By calling sysctl() and setrlimit() we can bump the fd limit up to the maximum allowed (on stock OS X it's 10240). Fixes #7772.
2013-08-02Revert "std::rt: Use a constant 4 threads for multithreaded sched tests"Kevin Ballard-4/+5
This workaround was less than ideal. A better solution is to raise the fd limit. This reverts commit 49b72bdd77916e27aaf95909516702c1450f11ac.
2013-08-03Rename IpAddr -> SocketAddr, extract IpAddr from SocketAddrStepan Koltsov-5/+5
multicast functions now take IpAddr (without port), because they dont't need port. Uv* types renamed: * UvIpAddr -> UvSocketAddr * UvIpv4 -> UvIpv4SocketAddr * UvIpv6 -> UvIpv6SocketAddr "Socket address" is a common name for (ip-address, port) pair (e.g. in sockaddr_in struct).
2013-08-02replace `range` with an external iteratorDaniel Micay-2/+2
2013-08-01fixed incorrect handling of returned scheduler option and restructed ↵toddaaro-1/+3
scheduler functions slightly
2013-08-01A major refactoring that changes the way the runtime uses TLS. In thetoddaaro-168/+53
old design the TLS held the scheduler struct, and the scheduler struct held the active task. This posed all sorts of weird problems due to how we wanted to use the contents of TLS. The cleaner approach is to leave the active task in TLS and have the task hold the scheduler. To make this work out the scheduler has to run inside a regular task, and then once that is the case the context switching code is massively simplified, as instead of three possible paths there is only one. The logical flow is also easier to follow, as the scheduler struct acts somewhat like a "token" indicating what is active. These changes also necessitated changing a large number of runtime tests, and rewriting most of the runtime testing helpers. Polish level is "low", as I will very soon start on more scheduler changes that will require wiping the polish off. That being said there should be sufficient comments around anything complex to make this entirely respectable as a standalone commit.
2013-08-01migrate many `for` loops to `foreach`Daniel Micay-4/+4
2013-07-30std::rt: Change Thread interface to require an explicit joinBrian Anderson-1/+3
Makes it more obvious what's going on
2013-07-25libstd: Fix errors when rtdebug! is not a noop.Luqman Aden-2/+2
2013-07-20auto merge of #7858 : bblum/rust/kill, r=brsonbors-7/+17
Some notes about the commits. Exit code propagation commits: * ```Reimplement unwrap()``` has the same old code from ```arc::unwrap``` ported to use modern atomic types and finally (it's considerably nicer this way) * ```Add try_unwrap()``` has some new slightly-tricky (but pretty simple) concurrency primitive code * ```Add KillHandle``` and ```Add kill::Death``` are the bulk of the logic. Task killing commits: * ```Implement KillHandle::kill() and friends```, ```Do a task-killed check```, and ```Add BlockedTask``` implement the killing logic; * ```Change the HOF context switchers``` turns said logic on Linked failure commits: * ```Replace *rust_task ptrs``` adapts the taskgroup code to work for both runtimes * ```Enable taskgroup code``` does what it says on the tin. r? @brson
2013-07-20Add test::with_test_task() convenience function.Ben Blum-1/+11
2013-07-20Change the HOF context switchers to pass a BlockedTask instead of a ~Task.Ben Blum-3/+3
2013-07-20Add kill::Death for task death services and use it in Task.Ben Blum-3/+3
2013-07-20auto merge of #7855 : brson/rust/rt-overcommit, r=pcwaltonbors-5/+4
Too much overcommit here exhausts the low fd limit on OS X.