fix(test): stabilize integration tests
This commit is contained in:
parent
be9d573fd6
commit
fe28bcb880
2 changed files with 9 additions and 2 deletions
|
|
@ -59,6 +59,11 @@ pub fn main(mut data: impl RunData) -> Option<()> {
|
||||||
data.created_server();
|
data.created_server();
|
||||||
|
|
||||||
let (xsock_wl, xsock_xwl) = UnixStream::pair().unwrap();
|
let (xsock_wl, xsock_xwl) = UnixStream::pair().unwrap();
|
||||||
|
// XCB takes responsibility for cleaning up this FD, but since connecting takes a RawFd at the
|
||||||
|
// FFI level, see (`XState::new`), `xsock_wl`'s destructor also closes the FD, leading the FD
|
||||||
|
// being closed twice. This mainly caused problems in the integration tests, where `xsock_wl`'s
|
||||||
|
// destructor would be run after the descriptor was freed, leading to an opaque abort message.
|
||||||
|
let xsock_wl = Box::leak(Box::new(xsock_wl));
|
||||||
// Prevent creation of new Xwayland command from closing fd
|
// Prevent creation of new Xwayland command from closing fd
|
||||||
rustix::io::fcntl_setfd(&xsock_xwl, rustix::io::FdFlags::empty()).unwrap();
|
rustix::io::fcntl_setfd(&xsock_xwl, rustix::io::FdFlags::empty()).unwrap();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,9 @@ impl Drop for Fixture {
|
||||||
// thread does not use file descriptors which outlive the Fixture's BorrowedFd
|
// thread does not use file descriptors which outlive the Fixture's BorrowedFd
|
||||||
let return_ptr = Box::into_raw(Box::new(0_usize)) as usize;
|
let return_ptr = Box::into_raw(Box::new(0_usize)) as usize;
|
||||||
self.quit_tx.write_all(&return_ptr.to_ne_bytes()).unwrap();
|
self.quit_tx.write_all(&return_ptr.to_ne_bytes()).unwrap();
|
||||||
thread.join().expect("Main thread panicked");
|
if thread.join().is_err() {
|
||||||
|
log::error!("main thread panicked");
|
||||||
|
}
|
||||||
rustix::process::kill_process(self.pid, Signal::Term).unwrap();
|
rustix::process::kill_process(self.pid, Signal::Term).unwrap();
|
||||||
rustix::process::waitpid(Some(self.pid), WaitOptions::NOHANG).unwrap();
|
rustix::process::waitpid(Some(self.pid), WaitOptions::NOHANG).unwrap();
|
||||||
}
|
}
|
||||||
|
|
@ -891,7 +893,7 @@ fn activation_x11_to_x11() {
|
||||||
let surface2 = f.map_as_toplevel(&mut connection, window2);
|
let surface2 = f.map_as_toplevel(&mut connection, window2);
|
||||||
|
|
||||||
f.testwl.focus_toplevel(surface2);
|
f.testwl.focus_toplevel(surface2);
|
||||||
std::thread::sleep(Duration::from_millis(1));
|
std::thread::sleep(Duration::from_millis(10));
|
||||||
connection.send_client_message(&x::ClientMessageEvent::new(
|
connection.send_client_message(&x::ClientMessageEvent::new(
|
||||||
window1,
|
window1,
|
||||||
connection.atoms.net_active_window,
|
connection.atoms.net_active_window,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue