@@ -741,7 +741,6 @@ mod tests {
741
741
assert_eq ! ( dummy. queues( ) . len( ) , QUEUE_SIZES . len( ) ) ;
742
742
}
743
743
744
- // NOTE: we are also failing this test now
745
744
#[ test]
746
745
fn test_device_info ( ) {
747
746
let start_addr1 = GuestAddress ( 0x0 ) ;
@@ -820,30 +819,31 @@ mod tests {
820
819
}
821
820
822
821
#[ test]
823
- fn test_slot_irq_allocation ( ) {
822
+ fn test_no_irq_allocation ( ) {
824
823
let mut device_manager = MMIODeviceManager :: new ( ) ;
825
824
let mut resource_allocator = ResourceAllocator :: new ( ) . unwrap ( ) ;
825
+
826
826
let device_info = device_manager
827
827
. allocate_mmio_resources ( & mut resource_allocator, 0 )
828
828
. unwrap ( ) ;
829
829
assert ! ( device_info. irq. is_none( ) ) ;
830
+ }
831
+
832
+ #[ test]
833
+ fn test_irq_allocation ( ) {
834
+ let mut device_manager = MMIODeviceManager :: new ( ) ;
835
+ let mut resource_allocator = ResourceAllocator :: new ( ) . unwrap ( ) ;
836
+
830
837
let device_info = device_manager
831
838
. allocate_mmio_resources ( & mut resource_allocator, 1 )
832
839
. unwrap ( ) ;
833
840
assert_eq ! ( device_info. irq. unwrap( ) . get( ) , crate :: arch:: IRQ_BASE ) ;
834
- assert_eq ! (
835
- format!(
836
- "{}" ,
837
- device_manager
838
- . allocate_mmio_resources(
839
- & mut resource_allocator,
840
- crate :: arch:: IRQ_MAX - crate :: arch:: IRQ_BASE + 1
841
- )
842
- . unwrap_err( )
843
- ) ,
844
- "Invalid MMIO IRQ configuration."
845
- . to_string( )
846
- ) ;
841
+ }
842
+
843
+ #[ test]
844
+ fn test_allocation_failure ( ) {
845
+ let mut device_manager = MMIODeviceManager :: new ( ) ;
846
+ let mut resource_allocator = ResourceAllocator :: new ( ) . unwrap ( ) ;
847
847
assert_eq ! (
848
848
format!(
849
849
"{}" ,
@@ -854,8 +854,5 @@ mod tests {
854
854
"Invalid MMIO IRQ configuration."
855
855
. to_string( )
856
856
) ;
857
- device_manager
858
- . allocate_mmio_resources ( & mut resource_allocator, 0 )
859
- . unwrap ( ) ;
860
857
}
861
858
}
0 commit comments