Exemplo n.º 1
0
 def test_init(self):
     address_str = "0000:0a:00.5"
     phys_addr = devspec.PciAddressGlobSpec(address_str)
     self.assertEqual(phys_addr.domain, "0000")
     self.assertEqual(phys_addr.bus, "0a")
     self.assertEqual(phys_addr.slot, "00")
     self.assertEqual(phys_addr.func, "5")
Exemplo n.º 2
0
 def test_false_match(self):
     address_str = "0000:0a:00.5"
     phys_addr = devspec.PhysicalPciAddress(address_str)
     addresses = [
         "0010:0a:00.5", "0000:0b:00.5", "*:0a:01.5", "0000:0a:*.4"
     ]
     for address in addresses:
         glob_addr = devspec.PciAddressGlobSpec(address)
         self.assertFalse(phys_addr.match(glob_addr))
Exemplo n.º 3
0
 def test_match(self):
     address_str = "0000:0a:00.5"
     phys_addr = devspec.PhysicalPciAddress(address_str)
     addresses = [
         "0000:0a:00.5", "*:0a:00.5", "0000:*:00.5", "0000:0a:*.5",
         "0000:0a:00.*"
     ]
     for address in addresses:
         glob_addr = devspec.PciAddressGlobSpec(address)
         self.assertTrue(glob_addr.match(phys_addr))