Skip to content

Commit bcf4f6a

Browse files
committed
gpio: break the 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. rust-lang/rust#101194 Breaking the while loop into three, one for each GPIO fixes it for now. This is the simplest solution possible right now. Signed-off-by: Viresh Kumar <[email protected]>
1 parent 452bc22 commit bcf4f6a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

gpio/src/vhu_gpio.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -929,10 +929,9 @@ mod tests {
929929

930930
backend.process_events(desc_chains.clone(), &vring).unwrap();
931931

932-
while backend.handles.read().unwrap()[GPIO as usize].is_some()
933-
|| backend.handles.read().unwrap()[(GPIO + 1) as usize].is_some()
934-
|| backend.handles.read().unwrap()[(GPIO + 2) as usize].is_some()
935-
{}
932+
while backend.handles.read().unwrap()[GPIO as usize].is_some() {}
933+
while backend.handles.read().unwrap()[(GPIO + 1) as usize].is_some() {}
934+
while backend.handles.read().unwrap()[(GPIO + 2) as usize].is_some() {}
936935

937936
validate_desc_chains(desc_chains, VIRTIO_GPIO_IRQ_STATUS_VALID, None);
938937
}

0 commit comments

Comments
 (0)