Skip to content

Commit 669418d

Browse files
committed
Add tcsetattr call in test
1 parent 96e2f22 commit 669418d

3 files changed

Lines changed: 28 additions & 0 deletions

File tree

‎tests/unit/out/refcount/termios.rs‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,28 @@ fn main_0() -> i32 {
4747
} == -1_i32) as i32)
4848
!= 0)
4949
);
50+
assert!(
51+
((({
52+
let __action = match 0 {
53+
0 => nix::sys::termios::SetArg::TCSANOW,
54+
1 => nix::sys::termios::SetArg::TCSADRAIN,
55+
2 => nix::sys::termios::SetArg::TCSAFLUSH,
56+
__a => panic!("tcsetattr: unsupported action {__a}"),
57+
};
58+
let __t =
59+
nix::sys::termios::Termios::from((tio.as_pointer()).with(|__src| __src.to_libc()));
60+
match FdRegistry::with_fd((*fd.borrow()), |__fd| {
61+
nix::sys::termios::tcsetattr(__fd, __action, &__t)
62+
}) {
63+
Ok(()) => 0,
64+
Err(__e) => {
65+
libcc2rs::cpp2rust_errno().write(__e as i32);
66+
-1
67+
}
68+
}
69+
} == -1_i32) as i32)
70+
!= 0)
71+
);
5072
assert!((((FdRegistry::close((*fd.borrow())) == 0) as i32) != 0));
5173
assert!(
5274
(((match nix::unistd::unlink((*path.borrow()).to_rust_string().as_str()) {

‎tests/unit/out/unsafe/termios.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ unsafe fn main_0() -> i32 {
2626
assert!(
2727
((((libc::tcgetattr(fd, (&mut tio as *mut ::libc::termios))) == (-1_i32)) as i32) != 0)
2828
);
29+
assert!(
30+
((((libc::tcsetattr(fd, 0, (&mut tio as *mut ::libc::termios).cast_const())) == (-1_i32))
31+
as i32)
32+
!= 0)
33+
);
2934
assert!(((((libc::close(fd)) == (0)) as i32) != 0));
3035
assert!(((((libc::unlink(path)) == (0)) as i32) != 0));
3136
return 0;

‎tests/unit/termios.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ int main(void) {
99
assert(fd >= 0);
1010
struct termios tio;
1111
assert(tcgetattr(fd, &tio) == -1);
12+
assert(tcsetattr(fd, TCSANOW, &tio) == -1);
1213
assert(close(fd) == 0);
1314
assert(unlink(path) == 0);
1415
return 0;

0 commit comments

Comments
 (0)