gpio: Update test's while loop to avoid test failure

The "test_gpio_process_events_multi_success" test currently hangs with
an update to a newer version of Rust. The code here tries to read the
value, locked, for each GPIO one by one. The values are updated in
another thread with the help of write lock.

More discussion around this issue can be found here.

https://github.com/rust-lang/rust/issues/101194

Taking the lock only once fixes it for now.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
Viresh Kumar 2022-08-30 14:37:43 +05:30
parent 452bc22a32
commit f5d74d4e9c

View File

@ -929,10 +929,13 @@ mod tests {
backend.process_events(desc_chains.clone(), &vring).unwrap();
while backend.handles.read().unwrap()[GPIO as usize].is_some()
|| backend.handles.read().unwrap()[(GPIO + 1) as usize].is_some()
|| backend.handles.read().unwrap()[(GPIO + 2) as usize].is_some()
{}
while {
let h = backend.handles.read().unwrap();
h[GPIO as usize].is_some()
|| h[(GPIO + 1) as usize].is_some()
|| h[(GPIO + 2) as usize].is_some()
} {}
validate_desc_chains(desc_chains, VIRTIO_GPIO_IRQ_STATUS_VALID, None);
}