summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2017-08-11Merge #701bors[bot]
701: Calculate `nfds` parameter for `select` r=asomers Doing this behind the scenes makes the API less error-prone and easier to use. It should also fix my issue in https://github.com/nix-rust/nix/issues/679#issuecomment-316838148
2017-08-11Calculate `nfds` parameter for `select`Jonas Schievink
Doing this behind the scenes makes the API less error-prone and easier to use. It should also fix https://github.com/nix-rust/nix/issues/679#issuecomment-316838148
2017-08-10Merge remote-tracking branch 'upstream/master' into ptrace-noregMarcin Mielniczuk
2017-08-09Merge #688bors[bot]
688: Support for OpenBSD r=Susurrus Fixes #685 These changes get nix building on OpenBSD 6.1. There is one failing test that I want a little guidance on: ``` error[E0308]: mismatched types --> src/sys/event.rs:333:30 | 333 | assert!(expected.data == actual.data()); | ^^^^^^^^^^^^^ expected i64, found isize ``` `KEvent::data` is: ``` pub fn data(&self) -> intptr_t { self.kevent.data as intptr_t } ``` I assume the test should be updated to cast to the expected type but wanted to confirm that before making the change.
2017-08-08Add a convenience method .pid() to WaitStatus.Marcin Mielniczuk
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-08-03Merge remote-tracking branch 'upstream/master' into ptrace-noregMarcin Mielniczuk
2017-08-02Reword the comment.Marcin Mielniczuk
2017-08-01add SockProtocol type for third argument of socket and socketpairNicolas Dusart
2017-07-31Extra docMarcin Mielniczuk
2017-07-31Add a line break.Marcin Mielniczuk
2017-07-31Possibly fix tests failing on qemu architectures.Marcin Mielniczuk
2017-07-31Add tests for ptrace::contMarcin Mielniczuk
2017-07-31support delivering a signal with ptrace::contMarcin Mielniczuk
2017-07-30Merge #672bors[bot]
672: add poll module in Android r=Susurrus `poll` functions are defined in Android as well. libc is missing some constant, but once rust-lang/libc#663 is merged, it'll be good to merge here. Closes #711
2017-07-26add poll module for all platformsNicolas Dusart
2017-07-26Mark nix::sys::ptrace::ptrace as unsafe, add safe variants of source routines.Marcin Mielniczuk
These include: * PTRACE_TRACEME * PTRACE_CONT * PTRACE_ATTACH * PTRACE_SYSCALL
2017-07-25Remove the TODO comments, add unwrap() for ptrace.Marcin Mielniczuk
2017-07-25Fix the tests compilingMarcin Mielniczuk
2017-07-25Disable failing tests on mips64Bryant Mairs
These are assumed to be QEMU issues, as they also fail on mips.
2017-07-25Replace remaining process::exit with libc::_exitJonas Schievink
Note that ptrace isn't documented as signal-safe, but it's supposed to just be a light syscall wrapper, so it should be fine.
2017-07-25Remove unneeded localJonas Schievink
2017-07-25Document 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-25Allow doc attributes in ioctl macroroblabla
2017-07-25use std::env::temp_dir() to retrieve the temp directory in test_mkstempNicolas Dusart
2017-07-25Add WaitStatus::PtraceSyscall for use with PTRACE_O_TRACESYSGOODGeoffrey Thomas
The recommended way to trace syscalls with ptrace is to set the PTRACE_O_TRACESYSGOOD option, to distinguish syscall stops from receiving an actual SIGTRAP. In C, this would cause WSTOPSIG to return SIGTRAP | 0x80, but nix wants to parse that as an actual signal. Add another wait status type for syscall stops (in the language of the ptrace(2) manpage, "PTRACE_EVENT stops" and "Syscall-stops" are different things), and mask out bit 0x80 from signals before trying to parse it. Closes #550
2017-07-25Add tests of actual ioctl usageBryant Mairs
2017-07-25fix some tests for AndroidNicolas Dusart
2017-07-25Fix thread safety issues in pty and termios testsAlan Somers
ptsname(3) returns a pointer to a global variable, so it isn't thread-safe. Protect it with a mutex.
2017-07-25Refactor ioctl! for buffersBryant Mairs
Instead of relying on the macro user to calculate the length in bytes do that within the macro itself
2017-07-25Add 'bad' prefixes for read, write_*, and readwrite ioctlsBryant Mairs
2017-07-25Split ioctl!(write ...) into write_ptr and write_intBryant Mairs
There two different write semantics used with ioctls: one involves passing a pointer the other involves passing an int. Previously the ioctl! macro did not distinguish between these cases and left it up to the user to set the proper datatype. This previous version was not type safe and prone to errors. The solution here is to split the "write" variant into a "write_ptr" and "write_int" variant that makes the semantics more explicit and improves type safety by specifying arguments better.
2017-07-25Add a "bad none" variant to the ioctl macroBryant Mairs
2017-07-25Re-add bad variant of ioctl!Bryant Mairs
2017-07-24Disable failing tests on mips64Bryant Mairs
These are assumed to be QEMU issues, as they also fail on mips.
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-23Merge #661bors[bot]
661: Allow doc attributes in ioctl r=asomers fixes #571 . Note that this is a breaking change because it also changes ``` ioctl!(some_name with 12); ``` to ``` ioctl!(bad some_name with 12); ``` This is to work around a bug in the rust compiler whereby rules around matching idents are overly strict. See https://github.com/rust-lang/rust/issues/24189 It doesn't break anything else though.
2017-07-22Replace remaining process::exit with libc::_exitJonas Schievink
Note that ptrace isn't documented as signal-safe, but it's supposed to just be a light syscall wrapper, so it should be fine.
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-21Allow doc attributes in ioctl macroroblabla
2017-07-21use std::env::temp_dir() to retrieve the temp directory in test_mkstempNicolas Dusart
2017-07-21Get rid of the bulk importsMarcin Mielniczuk
2017-07-21Add WaitStatus::PtraceSyscall for use with PTRACE_O_TRACESYSGOODGeoffrey Thomas
The recommended way to trace syscalls with ptrace is to set the PTRACE_O_TRACESYSGOOD option, to distinguish syscall stops from receiving an actual SIGTRAP. In C, this would cause WSTOPSIG to return SIGTRAP | 0x80, but nix wants to parse that as an actual signal. Add another wait status type for syscall stops (in the language of the ptrace(2) manpage, "PTRACE_EVENT stops" and "Syscall-stops" are different things), and mask out bit 0x80 from signals before trying to parse it. Closes #550
2017-07-20Merge pull request #691 from asomers/ptsnameAlan Somers
Fix thread safety issues in pty and termios tests
2017-07-20Add tests of actual ioctl usageBryant Mairs
2017-07-20fix some tests for AndroidNicolas Dusart
2017-07-20Tidy up imports in test_ptrace.rsMarcin Mielniczuk
2017-07-20Fix testsMarcin Mielniczuk
2017-07-19Fix thread safety issues in pty and termios testsAlan Somers
ptsname(3) returns a pointer to a global variable, so it isn't thread-safe. Protect it with a mutex.