summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2016-11-19Add TimeSpec, a Newtype around libc::timespecAlan Somers
Also, add trait TimeValLike, so some code can be shared between TimeSpec and TimeVal.
2016-11-18Improve portability of test_getsocknameAlan Somers
test_getsockname used an IPv4 socket and assumed that localhost was "127.0.0.1". But that assumption doesn't hold on IPv6-only hosts or on shared-IP FreeBSD jails. Unfortunately, the Rust standard library doesn't provide a good way to resolve localhost. So change the test to use a unix-domain socket instead.
2016-11-18Fix Unix domain sockets.Alan Somers
There were multiple errors regarding Unix domain sockets: * UnixAddr::path assumed that gethostbyname and similar functions would include the terminating null as part of len. That is not universally true. In fact, POSIX only guarantees that len will be at least large enough to store the non-null-terminated path. So it could be larger or smaller than nix was assuming. Since abstract sockets' paths are not strings, we can't modify gethostbyname. Instead, I implemented the fix in UnixAddr::path and UnixAddr::new. I clarified the documentation too. * SockAddr::as_ffi_pair contained a Linuxism. * sockaddr_storage_to_addr forgot to adjust sun_len when creating a UnixAddr
2016-11-16Fix intermittency in test_selectAlan Somers
Sometimes, on a heavily laden system, select would timeout and the test would fail. Fix it by lengthening the timeout to 10s.
2016-11-15Auto merge of #466 - fiveop:warnings, r=posborneHomu
Get rid of a few test compilation warnings Cleans up after 0fa7250b9575a2746519a854d0138c4c8255f109 and 40351db00da6ee8c904f47599ee692a85e3d96ef.
2016-11-14Get rid of a few test compilation warningsPhilipp Matthias Schaefer
2016-11-14Make signal argument to kill optionalPhilipp Matthias Schaefer
2016-11-13Avoid TempDir::into_path(), because it doesn't cleanup on DropAlan Somers
2016-10-24mount: Run test_mount_bind in CIKamal Marhubi
Looks like Travis allows bind mounts in their container infra now.
2016-10-23use tempfile in test_pwrite.Alan Somers
2016-09-28Apparently not all mkstemp implementation require the X at the end (despite ↵Philipp Keller
its documentation\!), checking the failure of a directory now
2016-09-27test also that mkstemp fails when there's no X at the endPhilipp Keller
2016-09-16made it running with rust 1.2, added documentation to mkstempPhilipp Keller
2016-09-08Auto merge of #416 - philippkeller:master, r=posborneHomu
add unistd::getcwd and unistd::mkdir As a (late) followup of [this withdrawn PR](https://github.com/rust-lang/libc/pull/326) I have added getcwd (wrapper around `libc::getcwd`) and mkdir (wrapper around `libc::mkdir`) and added testing. A few notes: - I'm new to rust so I would appreciate some pair of eyes testing the code, plus I'm open for revision of code or general remarks about my coding style - I have run the tests both on OSX as on Linux (Ubuntu) - I've run `clippy` to see if my code is well formatted, however clippy issues many warnings about the project. I think I didn't add any more warnings - the methods in unistd are not documented so I also left out the documentation of `getcwd` and `mkdir`, although I think it'd probably be good to add some documentation, especially some example code how to use the methods - the base idea of `getcwd` is [taken from std](https://github.com/rust-lang/rust/blob/1.9.0/src/libstd/sys/unix/os.rs#L95-L119), should I mention that somewhere?
2016-09-07fixed indentationPhilipp Keller
2016-09-06added documentation for getcwd and mkdir, changed test so that it compares ↵Philipp Keller
against std::env::current_dir
2016-09-06made it running with rust 1.2.0: the code for getcwd is now an exact copy of ↵Philipp Keller
the implementation in std
2016-09-05implemented mkdir, extended getcwd test to include long path namesPhilipp Keller
2016-09-03added test for getcwd, still not complete (needs to check also longer ↵Philipp Keller
directory names, need to be created with mkdir first which doesn't exist yet)
2016-09-02implemented getcwd (returning Result<PathBuf>, reconciling all calls to ↵Philipp Keller
expect into proper try handling), needs testing still
2016-09-01Auto merge of #392 - fiveop:less_ffi, r=@fiveopHomu
Replace ffi module by libc functions in mqueue.rs This is almost finished. I still need to check if I introduced any breaking changes by changing signatures. I would want to record this in the change log, however, for that we still need to merge #391. - [x] update change log - [x] run rustfmt on `src/mqueue.rs`
2016-08-31Replace ffi module by libc functions in mqueue.rsPhilipp Matthias Schaefer
2016-08-31Use libc in poll.rsPhilipp Matthias Schaefer
2016-08-15Get rid of a few warnings during compilation of testsPhilipp Matthias Schaefer
2016-06-13Added lseek to unistdAndrei Oprisan
llseek and lseek64 impl Whence fixed formatting awful typo when refactoring no llseek wrong test name using off64_t got rid of offset Added SeekHole/Data; formatted test; SeekCur/Set/End use libc constants
2016-05-01Return both the fd and the created pathAndreas Fuchs
2016-05-01Remove dependency on Result::expectAndreas Fuchs
2016-05-01Add mkstemp(3)Andreas Fuchs
2016-03-31Auto merge of #332 - kamalmarhubi:fork-enum, r=fiveopHomu
unistd: Redesign the enum returned by fork() This changes the name of the enum returned by `fork()` to `ForkResult`, and changes the `Parent` variant to be struct-like. The result can be matched like use nix::unistd::ForkResult::*; match fork().unwrap() { Parent { child } => { ... } Child => { ... } } using the shorthand matching syntax for struct-like enum variants. This is a breaking change.
2016-03-30unistd: Redesign the enum returned by fork()Kamal Marhubi
This commit changes the name of the enum returned by `fork()` to `ForkResult`, and changes the `Parent` variant to be struct-like. The result can be matched like use nix::unistd::ForkResult::*; match fork().unwrap() { Parent { child } => { ... } Child => { ... } } using the shorthand matching syntax for struct-like enum variants. This is a breaking change.
2016-03-30socket: Respect IPv6 flowinfo and scope_id in InetAddr::from_stdKamal Marhubi
Fixes #329
2016-03-30Use pause(2) in test_wait_signalKamal Marhubi
Replace a busy loop with a call to `pause(2)`.
2016-03-21Use getuid(2) from nix instead of libc in test_mountKamal Marhubi
2016-03-21mount: Do not treat unshare(2) failure as test failureKamal Marhubi
The mount test runner uses unprivileged user namespaces. Previously, failure from `unshare(2)` to create the user namespace would fail the test. This changes that to simply print an error and exit successfully. Refs https://github.com/nix-rust/nix/pull/326
2016-03-10update signalfd to use libc typesAlex Gulyás
2016-03-07Add gettidDave Hylands
2016-02-20Auto merge of #271 - abbradar:mqueue-fixes, r=kamalmarhubiHomu
mqueue: change types to allow more cases Part of https://github.com/nix-rust/nix/pull/270, fixed according to @kamalmarhubi's comments.
2016-02-20mqueue: change types to allow more casesNikolay Amiantov
2016-02-20select: allow infinite timeoutNikolay Amiantov
2016-02-14linux: Add splice(2), tee(2), vmsplice(2)Kamal Marhubi
2016-02-12linux: Add sendfile(2)Kamal Marhubi
2016-01-29Convert MSG_ flags to bitflags! type.Philipp Matthias Schaefer
2016-01-29Add tests for sockopt (SndBuf, RcvBuf, SndBufForce, RcvBufForce)Frank Denis
2016-01-27Bring back mountKamal Marhubi
Fixes https://github.com/carllerche/nix-rust/issues/85
2016-01-27Add test for if_nametoindexKamal Marhubi
2016-01-25Add everything from poll.h.Utkarsh Kukreti
2016-01-18update libc to 0.2.2Mattis Marjak
2016-01-13Use tempdir for temporary files in testsKamal Marhubi
2016-01-13Fix compiler warnings in testsKamal Marhubi
2015-10-28Fix handling of sockaddr_un lengthsGeoffrey Thomas
The returned length of AF_UNIX sockaddrs is significant, and generally does not match the length of the entire structure. For filesystem sockets, this is ignorable because the path is also NUL-terminated, but for unbound sockets (e.g., a socketpair) or abstract-namespace sockets (a Linux extension where the address is an arbitrary bytestring), we need to keep track of the length. Fixes #177. Also add a UnixAddr::new_abstract function and some better handling of abstract-namespace socket addresses to fix #169.