mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: Test trigger sets config_changed flag
A Config trigger must set the config_changed flag so the next device specific configuration read can bump config_generation. A Queue trigger must leave the flag alone. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
90b9481745
commit
1ba4298551
@@ -1417,4 +1417,19 @@ mod unit_tests {
|
||||
intr.config_vector.store(0xFFFE, Ordering::Release);
|
||||
intr.trigger(VirtioInterruptType::Config).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn trigger_config_sets_config_changed_flag() {
|
||||
let intr = make_msix_interrupt(2);
|
||||
assert!(!intr.config_changed.load(Ordering::Acquire));
|
||||
intr.trigger(VirtioInterruptType::Config).unwrap();
|
||||
assert!(intr.config_changed.load(Ordering::Acquire));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn trigger_queue_does_not_set_config_changed_flag() {
|
||||
let intr = make_msix_interrupt(2);
|
||||
intr.trigger(VirtioInterruptType::Queue(0)).unwrap();
|
||||
assert!(!intr.config_changed.load(Ordering::Acquire));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user