summaryrefslogtreecommitdiff
path: root/test/test_unistd.rs
AgeCommit message (Collapse)Author
2017-11-12unistd: groups: Respond to minor PR feedback itemsJamie Hewland
2017-11-12groups tests: Add groups mutex and print message when tests skippedJamie Hewland
Fix groups mutex name
2017-11-12test_unistd: Add test for getgrouplist/initgroups()Jamie Hewland
2017-11-12test_unistd: Add test for getgroups/setgroups()Jamie Hewland
2017-10-11added unistd::mkfifo #602Jakub Pastuszek
2017-08-18unistd: add fexecve()Luca Bruno
This adds fexecve() to `nix::unistd`. It is available in libc since 0.2.29. Ref: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fexecve.html
2017-08-05Fix tests on OpenBSDWesley Moore
There appears to be some interaction with test_pathconf_limited and another one when they are run in parallel, causing it to return ENOENT so the path has been changed from . to /.
2017-07-24Merge #693bors[bot]
693: fix some tests for Android r=asomers I tested the crate on an Android emulator and quite all the tests passed. Only 6 were failing. > failures: > > ---- sys::test_pthread::test_pthread_self stdout ---- > thread 'sys::test_pthread::test_pthread_self' panicked at 'assertion failed: tid > 0', test/sys/test_pthread.rs:6 > note: Run with `RUST_BACKTRACE=1` for a backtrace. > > ---- sys::test_socket::test_getsockname stdout ---- > thread 'sys::test_socket::test_getsockname' panicked at 'bind failed: Sys(EACCES)', /checkout/src/libcore/result.rs:859 > > ---- sys::test_socket::test_unixdomain stdout ---- > thread 'sys::test_socket::test_unixdomain' panicked at 'bind failed: Sys(EACCES)', /checkout/src/libcore/result.rs:859 > > ---- sys::test_termios::test_local_flags stdout ---- > thread 'sys::test_termios::test_local_flags' panicked at 'called `Option::unwrap()` on a `None` value', /checkout/src/libcore/option.rs:329 > > ---- test_net::test_if_nametoindex stdout ---- > thread 'test_net::test_if_nametoindex' panicked at 'assertion failed: if_nametoindex(&LOOPBACK[..]).is_ok()', test/test_net.rs:11 > > ---- test_unistd::test_mkstemp stdout ---- > thread 'test_unistd::test_mkstemp' panicked at 'mkstemp failed: ENOENT: No such file or directory', test/test_unistd.rs:73 This PR fixes 3 of those: - `test_pthread_self`: pthread_t is unsigned, so it can be negative (and it is often the case) - `test_if_nametoindex`: constant `LOOPBACK` is the same than on Linux - `test_mkstemp`: directory `/tmp` does not exist in Android Two are still failing (`test_unixdomain` and `test_getsockname`) because we need some special permissions on Android for playing with sockets. On a rooted physical device, they passed. So, if tests for Android are integrated in CI, we should try to embed the tests to run in an APK with requested permissions or find a way to give the permission to a native program. `test_local_flags` is still failing also because `O_LARGEFILE` is hardcoded and is not the right value in Android. Then `fcntl::OFlag::from_bits(flags).unwrap()` fails because this flag is then not recognised. I made a PR in `libc` so that we can rely on libc definitions for all `O_*` flags. (rust-lang/libc#683) Do you prefer to wait for this one to be fixed for this PR to merged as well ?
2017-07-22Remove unneeded localJonas Schievink
2017-07-22Document invariants of fork and fix testsJonas Schievink
Some tests were invoking non-async-signal-safe functions from the child process after a `fork`. Since they might be invoked in parallel, this could lead to problems.
2017-07-21use std::env::temp_dir() to retrieve the temp directory in test_mkstempNicolas Dusart
2017-07-20fix some tests for AndroidNicolas Dusart
2017-07-18Remove broken execvpe implementationBryant Mairs
It was broken when enabled, and currently the libc definition is only available for windows. This will be re-added when a new libc is released that supports it across all available platforms
2017-07-18Merge #638bors[bot]
638: Make aio, chdir, and wait tests thread safe r=Susurrus Fix thread safety issues in aio, chdir, and wait tests They have four problems: * The chdir tests change the process's cwd, which is global. Protect them all with a mutex. * The wait tests will reap any subprocess, and several tests create subprocesses. Protect them all with a mutex so only one subprocess-creating test will run at a time. * When a multithreaded test forks, the child process can sometimes block in the stack unwinding code. It blocks on a mutex that was held by a different thread in the parent, but that thread doesn't exist in the child, so a deadlock results. Fix this by immediately calling `std::process:;exit` in the child processes. * My previous attempt at thread safety in the aio tests didn't work, because anonymous MutexGuards drop immediately. Fix this by naming the SIGUSR2_MTX MutexGuards. Fixes #251
2017-07-16Fix thread safety issues in aio, chdir, and wait testsAlan Somers
They have four problems: * The chdir tests change the process's cwd, which is global. Protect them all with a mutex. * The wait tests will reap any subprocess, and several tests create subprocesses. Protect them all with a mutex so only one subprocess-creating test will run at a time. * When a multithreaded test forks, the child process can sometimes block in the stack unwinding code. It blocks on a mutex that was held by a different thread in the parent, but that thread doesn't exist in the child, so a deadlock results. Fix this by immediately calling std::process:exit in the child processes. * My previous attempt at thread safety in the aio tests didn't work, because anonymous MutexGuards drop immediately. Fix this by naming the SIGUSR2_MTX MutexGuards. Fixes #251
2017-07-15Merge #630bors[bot]
630: Add wrappers for sysconf(3), pathconf(2), and fpathconf(2) r=asomers
2017-07-15Add sysconf(3), pathconf(2), and fpathconf(2)Alan Somers
2017-07-09Fix double close bugs in test_lseek and test_lseek64Alan Somers
std::fs::File closes the underlying file descriptor on Drop, without checking for errors. test_lseek and test_lseek64 also manually close the file descriptor. That works for single threaded test runs. But for multithreaded runs, it causes EBADF errors in other tests. Fix the tests by consuming the File with into_raw_fd(), so its drop method will never be called. Also, fix a potential short read bug in the same tests.
2017-07-02Newtypes for uid_t, gid_t and pid_t.Martin Habovštiak
2017-01-19unistd: add fchdir(2)Luca Bruno
This introduces a wrapper for fchdir(2), allowing a process to change directory based on an open file descriptor. The underlying function is available in libc crate since 0.2.20.
2016-11-13Avoid TempDir::into_path(), because it doesn't cleanup on DropAlan 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-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-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-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-07Add gettidDave Hylands
2015-07-13Add status to WaitStatusJoseph Kain
* Extend the enums in WaitStatus to include all process states (signaled, stopped, exited, continued). * Decode status from waitpid * Return appropate WaitStatus * Update tests to use the new WaitStatus * Add new tests for specific status values
2015-07-07make execvpe unit test compile on LinuxMarkus Jais
2015-06-08added wait system call and unit testMarkus Jais
2015-05-19added getpid and getppidMarkus Jais
2015-05-05feat: add execvpeQingping Hou
2015-03-25Track Rust masterCarl Lerche
2015-03-24NixResult -> nix::Result; NixError -> nix::ErrorCarl Lerche
2015-03-13Amend some files to make it compile on arm-linux-androideabi.kennytm
2015-02-21Cleanup readv & writev + testsCarl Lerche