mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
Auto merge of #27193 - gterzian:fix_monitor_test_timeout, r=jdm
improve reliability of hang monitor tests <!-- Please describe your changes on the following line: --> FIX https://github.com/servo/servo/issues/27191 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
e61628420b
2 changed files with 25 additions and 17 deletions
|
@ -33,7 +33,8 @@ impl HangMonitorRegister {
|
||||||
monitoring_enabled: bool,
|
monitoring_enabled: bool,
|
||||||
) -> Box<dyn BackgroundHangMonitorRegister> {
|
) -> Box<dyn BackgroundHangMonitorRegister> {
|
||||||
let (sender, port) = unbounded();
|
let (sender, port) = unbounded();
|
||||||
let _ = thread::Builder::new().spawn(move || {
|
let _ = thread::Builder::new()
|
||||||
|
.spawn(move || {
|
||||||
let mut monitor = BackgroundHangMonitorWorker::new(
|
let mut monitor = BackgroundHangMonitorWorker::new(
|
||||||
constellation_chan,
|
constellation_chan,
|
||||||
control_port,
|
control_port,
|
||||||
|
@ -43,7 +44,8 @@ impl HangMonitorRegister {
|
||||||
while monitor.run() {
|
while monitor.run() {
|
||||||
// Monitoring until all senders have been dropped...
|
// Monitoring until all senders have been dropped...
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
.expect("Couldn't start BHM worker.");
|
||||||
Box::new(HangMonitorRegister {
|
Box::new(HangMonitorRegister {
|
||||||
sender,
|
sender,
|
||||||
monitoring_enabled,
|
monitoring_enabled,
|
||||||
|
|
|
@ -197,12 +197,18 @@ fn test_hang_monitoring_exit_signal() {
|
||||||
);
|
);
|
||||||
|
|
||||||
let (exit_sender, exit_receiver) = ipc::channel().expect("Failed to create IPC channel!");
|
let (exit_sender, exit_receiver) = ipc::channel().expect("Failed to create IPC channel!");
|
||||||
// Send the exit message.
|
|
||||||
let _ = control_sender.send(BackgroundHangMonitorControlMsg::Exit(exit_sender));
|
|
||||||
|
|
||||||
|
// Send the exit message.
|
||||||
|
if control_sender
|
||||||
|
.send(BackgroundHangMonitorControlMsg::Exit(exit_sender))
|
||||||
|
.is_ok()
|
||||||
|
{
|
||||||
// Assert we receive a confirmation back.
|
// Assert we receive a confirmation back.
|
||||||
assert!(exit_receiver.recv().is_ok());
|
assert!(exit_receiver.recv().is_ok());
|
||||||
|
|
||||||
// Assert we get the exit signal.
|
// Assert we get the exit signal.
|
||||||
while !closing.load(Ordering::SeqCst) {}
|
while !closing.load(Ordering::SeqCst) {
|
||||||
|
thread::sleep(Duration::from_millis(10));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue