def test(self):
    tmpfile = tempfile.NamedTemporaryFile()
    fd = tmpfile.fileno()

    for features in [0, hv_kvm.IFF_VNET_HDR]:
      fn = compat.partial(self._FakeIoctl, features)
      result = hv_kvm._GetTunFeatures(fd, _ioctl=fn)
      self.assertEqual(result, features)
Exemple #2
0
  def test(self):
    tmpfile = tempfile.NamedTemporaryFile()
    fd = tmpfile.fileno()

    for features in [0, hv_kvm.IFF_VNET_HDR]:
      fn = compat.partial(self._FakeIoctl, features)
      result = hv_kvm._GetTunFeatures(fd, _ioctl=fn)
      self.assertEqual(result, features)
 def testWrongIoctl(self):
   tmpfile = tempfile.NamedTemporaryFile()
   # A file does not have the right ioctls, so this must always fail
   result = hv_kvm._GetTunFeatures(tmpfile.fileno())
   self.assertTrue(result is None)
Exemple #4
0
 def testWrongIoctl(self):
   tmpfile = tempfile.NamedTemporaryFile()
   # A file does not have the right ioctls, so this must always fail
   result = hv_kvm._GetTunFeatures(tmpfile.fileno())
   self.assertTrue(result is None)