summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2019-12-22Skip test_aio_cancel_all on muslAlan Somers
I suspect that the segfault is due to a stack overflow on musl's signal stack, but I can't reproduce the failure locally. Fixes #1169
2019-12-01ScmCredentials now wraps UnixCredentials instead of libc::ucredAlan Somers
2019-12-01Merge #1157bors[bot]
1157: Fix some race conditions in the integration tests r=asomers a=asomers Co-authored-by: Alan Somers <asomers@gmail.com>
2019-12-01Fix some race conditions in the integration testsAlan Somers
2019-12-01Remove the last use of mem::uninitializedAlan Somers
Replace it with mem::zeroed. It isn't perfect, but it's better than it was. Issue #1115
2019-12-01Allow signal injection in ptrace::{syscall, detach}Francisco Giordano
2019-11-21Implement sched::sched_getaffinity()Thibaut Ackermann
sched_getaffinity(2) get a process's CPU affinity mask
2019-11-03Implment linkatJohnnie Birch
This adds the linkat function which is part of POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/functions/linkat.html and widely implmented on Unix-Family platforms. Add back trailing whitespace removed on previous force push
2019-10-28Fix sys::socket::recvfrom for TCP socketsAlan Somers
recvfrom(2) only returns the sender's address for protocols that provide it. Usually, that means it returns the sender's address for datagram sockets but not for stream sockets. Fixes #1144
2019-09-30refactored test casesZhang Miaolei
ignore mkfifoat in OSX and andriod
2019-09-30add mkfifoatZhang Miaolei
2019-09-28Merge #1121 #1130bors[bot]
1121: Fix #1093 r=asomers a=tathanhdinh Hello, This PR fixes the problem discovered in #1093. Thanks for any comment. 1130: unistd: getgrouplist: Rework code to use `reserve_double_buffer_size` r=asomers a=otavio The buffer resize logic can be simplified reusing the `reserve_double_buffer_size` method. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Co-authored-by: Ta Thanh Dinh <tathanhdinh@gmail.com> Co-authored-by: Otavio Salvador <otavio@ossystems.com.br>
2019-09-28Merge #1105bors[bot]
1105: posix_fallocate support r=asomers a=dingxiangfei2009 This PR add [`posix_fallocate`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html), which is available on - Linux - FreeBSD - Android - Emscripten - Fuchsia - WASI Here is a question: for some reason, `posix_fallocate` returns `EBADF` instead of `EPIPE` if a FIFO file descriptor is passed in on Linux 4.19.64. In the test `EBADF` is used for now, but I would like to know if such behaviour is expected. Co-authored-by: Ding Xiang Fei <dingxiangfei2009@gmail.com>
2019-09-23fix #1093Ta Thanh Dinh
2019-09-19Where relevant, replace equality checks in assert! with assert_eq!Xavier L'Heureux
`assert_eq!` gives more debug info when the test fails by default than `assert!`. This should help make debugging easier.
2019-09-19Fix test breakage in Seccomp mode.Alan Somers
Travis is now using Seccomp, and Docker's default Seccomp policy disables execveat (though, weirdly, not fexecve). It also prohibits any operations on AF_ALG sockets. While I'm here, replace close/dup with dup2, which is more reliable. Also, drop the fork mutex earlier. This way all of the exeve tests will run, even if one fails. https://docs.docker.com/engine/security/seccomp/
2019-09-19Require CAP_SYS_PTRACE for certain testsAlan Somers
process_vm_readv requires it, and I'm not exactly sure which other things do too.
2019-09-12use slices for array comparisonDing Xiang Fei
2019-09-12better wordingDing Xiang Fei
2019-09-12posix_fallocateDing Xiang Fei
2019-09-04Merge #1120bors[bot]
1120: Fix length of abstract socket address r=asomers a=yshui NULL bytes have no special significance in an abstrace address, and the length of the address is solely decided by the length member. If the length is set to sun_path.len(), all the NULL bytes will be considered part of the address. Tests are updated accordingly. Closes #1119 Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com> Co-authored-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-04Fix length of abstract socket addressYuxuan Shui
NULL bytes have no special significance in an abstrace address, and the length of the address is solely decided by the length member. If the length is set to sun_path.len(), all the NULL bytes will be considered part of the address. Tests are updated accordingly. Closes #1119 Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-04Replace Signal::from_c_int by Signal::try_fromAlan Somers
TryFrom wasn't stable when that function was written.
2019-09-03Skip the aio_suspend test on LinuxAlan Somers
On Travis (and only on Travis) this test crashes. It hits an internal assertion within glibc. It happens reliably with rustc 1.37.0. Ignore the test until Travis updates its images; then we'll try again. Issue #1099
2019-09-03Replace most instances of mem::uninitialized with mem::MaybeUninitAlan Somers
Only two instances remain: * For the deprecated sys::socket::CmsgSpace::new. We should probably just remove that method. * For sys::termios::Termios::default_uninit. This will require some more thought. Fixes #1096
2019-08-28Fix some ioctl tests on muslAlan Somers
Weirdly, musl uses i32 to store the ioctl opcode
2019-08-22update readlink to return the path instead of mangling the bufferSendil Kumar
2019-08-22fix readlink/readlinkat to return too long only when it is longSendil Kumar
2019-07-17Add renameatScott Lamb
renameat is (somewhat oddly, imho) in stdio.h. I put it in nix::fcntl because there's no nix::stdio and all its friends (including the AT_* constants) are in nix::fcntl.
2019-07-16Merge #1058bors[bot]
1058: Implement unlinkat r=asomers a=jlb6740 This adds the unlinkat function, which is part of POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/functions/unlinkat.html and widely implmented on Unix-family platforms. Co-authored-by: Johnnie Birch <45402135+jlb6740@users.noreply.github.com>
2019-07-14Implement unlinkatJohnnie Birch
This adds the unlinkat function, which is part of POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/functions/unlinkat.html and widely implmented on Unix-family platforms. Implement unlinkat - Update comments to unlink at and breakup tests Changes made based on comments from pull request #1058 Implement unlinkat - Update should_panic for more precise check Updae should_panic attribute for more precise check. Also remove some dead code and note the pull request ID. Implement unlinkat - Update error handling to use unwrap_err The previous patch failed testing on two targets that returned EPERM as the Sys error instead of EISDIR. This patch changes from using the should_panic attribute to using the unwrap_err and matching against the result. Implement Unlinkat - Passing tests should not print anything. Fix. Implement unlinkat - Update location of commit comment in the CHANGELOG Implement unlinkat - Remove newline
2019-07-13Merge #1095bors[bot]
1095: Fix warnings on Rust 1.37.0 r=asomers a=asomers * Replace obsolete range syntax "..." with inclusive range "..=" * Use dyn Trait syntax instead of Box<Trait> * Raise MSRV to 1.27.0 (for dyn Trait syntax) * Test with nightly again Co-authored-by: Alan Somers <asomers@gmail.com>
2019-07-13Temporarily allow deprecated itemsAlan Somers
This fixes the tests on Rust 1.38.0. We'll fix them for real after release 0.15.0. Issue #1096
2019-07-13Fix warnings on Rust 1.37.0Alan Somers
* Replace obsolete range syntax "..." with inclusive range "..=" * Use dyn Trait syntax instead of Box<Trait> * Raise MSRV to 1.27.0 (for dyn Trait syntax) * Raise MSRV to 1.31.0 (because of rand) tempfile pulls in rand, and rand pulls in fuchsia-cprng, which requires 1.31.0. Why rand pulls in fuchsia-cprng I don't know. It's specified as a target-specific dependency, but Cargo tries to build it anyway (only on Linux, not on FreeBSD or OSX). A bug in Cargo 1.27.0?
2019-07-12test_socket: add AddressFamily::Vsock testStefano Garzarella
The current VSOCK implementation does not support loopback devices, so, for now, we expect a failure in the spawned thread when it tries to connect. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2019-07-09implement posix_fadviseKevin Wern
2019-06-15sys/stat: implement mkdiratKevin Wern
2019-06-12Implement `copy_file_range()`Árni Dagur
2019-06-11Fix tests for abstract socketsBryant Mairs
Abstract paths should always be N-1 in length where N is the length of the `sun_path` field (first byte is \0). Given that, `UnixAddr::new_abstract()` should always return this N-1 length, not just the length of the string provided (the rest of the array will be \0s).
2019-06-09Improve debugging of mq tests by using assert_* macrosBryant Mairs
2019-06-09Remove test of impl Debug for PollFdBryant Mairs
As this is now derived, having a test is unnecessary
2019-06-09Add extra traits for all typesBryant Mairs
Derive Clone, Copy, Eq, Hash, and PartialEq for all types. Not all traits are supported by all types, which is why many are missing some.
2019-06-06Fix an "unused use statement" warning on non-musl platformsAlan Somers
This was an oversight from 974320d09fbd1fae79da537383c2144ed9aa4967
2019-06-06Fix some bugs with multithreaded tests:Alan Somers
* kmod tests must run exclusively, because they load and unload a module with a constant name. * A few tests were doing some variant of chdir, but weren't taking the CWD_MTX. * The kmod tests read files by path relative to CWD, so they need the CWD_MTX. But they don't need it exclusively, so convert the CWD_MTX into an RwLock. * Tests that do change the cwd need to change it back when they're done.
2019-06-06Fix multiple problems with the test_acct testAlan Somers
* On Linux, it requires the CAP_SYS_PACCT capability. * Reenable the test on FreeBSD, because our FreeBSD CI environment is no longer jailed (since we switched from BuildBot to CirrusCI), but check at runtime whether the process is jailed. * test_acct needs the FORK_MTX because it uses Command::new . * Fix a race condition. acct(2) isn't synchronous. It starts a kernel thread but does not wait for it to become ready. Fix it by running the test command within the polling loop.
2019-06-06Fix kmod tests on in Linux containersAlan Somers
It's not sufficient to check for root privileges, because a containerized process may have root's euid but still lack important capabilities. Fix these tests by checking for the CAP_SYS_MOD capability.
2019-06-06Fix the is_so_mark_functional test in Linux containersAlan Somers
It's not sufficient to check for root privileges. In a container, the euid may be root even though the user lacks some capabilities. Replace this test's root check with a check for the CAP_NET_ADMIN capability instead.
2019-06-02Fix test_pthread_self on muslAlan Somers
On musl, pthread_t is a pointer type.
2019-04-29Restored the bytes field on RecvMsg in order to know the amount of bytes ↵Vincent Dagonneau
received using recvmsg.
2019-04-23pty: Add forkptyKevin Kuehler