diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-10-15 19:44:08 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-10-24 14:21:56 -0700 |
| commit | bac96818580a97c049532e50702c2a8204e11754 (patch) | |
| tree | cb8fc611cf345d6f6c539bd62fd778b7b214d1a6 /src/libstd/rt/test.rs | |
| parent | 61f8c059c4c6082683d78b2ee3d963f65fa1eb98 (diff) | |
| download | rust-bac96818580a97c049532e50702c2a8204e11754.tar.gz rust-bac96818580a97c049532e50702c2a8204e11754.zip | |
Implement io::net::unix
Diffstat (limited to 'src/libstd/rt/test.rs')
| -rw-r--r-- | src/libstd/rt/test.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstd/rt/test.rs b/src/libstd/rt/test.rs index 4f7ebb4a721..759550e5cbd 100644 --- a/src/libstd/rt/test.rs +++ b/src/libstd/rt/test.rs @@ -8,8 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use rand; +use rand::Rng; +use os; use libc; use option::{Some, None}; +use path::{Path, GenericPath}; use cell::Cell; use clone::Clone; use container::Container; @@ -327,6 +331,12 @@ pub fn next_test_port() -> u16 { } } +/// Get a temporary path which could be the location of a unix socket +#[fixed_stack_segment] #[inline(never)] +pub fn next_test_unix() -> Path { + os::tmpdir().push(rand::task_rng().gen_ascii_str(20)) +} + /// Get a unique IPv4 localhost:port pair starting at 9600 pub fn next_test_ip4() -> SocketAddr { SocketAddr { ip: Ipv4Addr(127, 0, 0, 1), port: next_test_port() } |
