summaryrefslogtreecommitdiff
path: root/test/test_pty.rs
AgeCommit message (Collapse)Author
2023-07-21Disable tcsetattr() on illumos and solarisfix/disable_tcsetattr_illumosMartin Samuelsson
Calling tcsetattr() as currently done by nix is documented undefined behaviour on illumos, and will always fail. For details, please see: https://github.com/nix-rust/nix/issues/2071
2022-12-09fixSteve Lau
2022-12-09refactor: take AsFd by valueSteve Lau
2022-12-08feat: I/O safety for 'sys/termios' & 'pty'Steve Lau
2022-08-09remove deprecated itemsSteveLauC
2022-06-24Fix all formating problems to pass CI formating testCostin-Robert Sin
Signed-off-by: Costin-Robert Sin <sin.costinrobert@gmail.com>
2022-02-22also implement Read and Write for &PtyMasterJesse Luehrs
2021-11-27Avoid lock poisoning by using parking_lotRyan Zoeller
parking_lot provides synchronization primitives which aren't poisoned on panic. This makes it easier to determine which tests are failing, as a test failure no longer causes all subsequent tests using that mutex to fail.
2021-09-19Clippy cleanupAlan Somers
And this time, start running Clippy in CI
2021-03-21illumos and Solaris supportJason King
Co-authored-by: Dominik Hassler <hadfl@omnios.org> Co-authored-by: Joshua M. Clulow <josh@sysmgr.org>
2021-02-20pty: Make forkpty() unsafeTavian Barnes
After the child returns from a fork() of a multi-threaded process, it is undefined behaviour to call non-async-signal-safe functions according to POSIX. Since forkpty() is implemented in terms of fork(), those restrictions should apply to it too.
2020-08-11use subordinate terminal device for termios callsJoshua M. Clulow
The pseudo-terminal device handling tests in some places make tcgetattr(3C) and tcsetattr(3C) calls using the control/manager file descriptor rather than the subordinate terminal descriptor. This works on some systems, but not all; others such as illumos (and presumably Solaris) are more strict and require the termios requests be made against the terminal descriptor only.
2020-05-31Convert the crate to edition 2018Alan Somers
2020-04-21impl io::{Read,Write} for PtyMasterJosh Stone
`PtyMaster` acts like an owned file descriptor, even closing on `Drop`. Implementing `io::Read` and `io::Write` lets it be used directly in standard I/O operations.
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-04-23pty: Add forkptyKevin Kuehler
2018-09-05Replace allow unused directive with _ prefixPascal Bach
2017-12-20Add backticks to types in doccommentsBryant Mairs
2017-12-20Use write_all instead of writeBryant Mairs
Several tests make the assumption that all data is written, which is not guaranteed with write(), so use write_all() instead.
2017-12-02Upgrade to Bitflags 1.0Bryant Mairs
The libc_bitflags! macro was replaced with a non-recursive one supporting only public structs. I could not figure out how to make the old macro work with the upgrade, so I reworked part of the bitflags! macro directly to suit our needs, much as the original recursive macro was made. There are no uses of this macro for non-public structs, so this is not a problem for internal code.
2017-08-24Mark and document pty::ptsname() as unsafeNelson Chen
`ptsname()` mutates global variables and mutating global variables is always considered `unsafe` by Rust. Reference: https://github.com/nix-rust/nix/pull/742#issuecomment-324385919
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.
2017-07-15PtyMaster::drop should panic on EBADFAlan Somers
Also, document the double-close risk with unistd::close Fixes #659
2017-07-10Use libc types for termiosBryant Mairs
This also removes the incorrect TCSASOFT definition as an enum type because it's actually a bitfield.
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-01Handle short reads in pty testsAlan Somers
Some pty tests would fail intermittently because read(2) occasionally returns less data than requested.
2017-06-12Add openpty()Kelvin Ly
2017-05-16Add various pty functionsBryant Mairs
* grantpt * ptsname/ptsname_r * posix_openpt * unlockpt