Files
xen/tools/python/xen/migration/tests.py
T
Andrew Cooper 50ea2445f4 libxc/migration: Rename TSC_INFO to X86_TSC_INFO
This record is specific to x86, and should have had a prefix to being with.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2019-12-24 14:59:04 +00:00

55 lines
1.4 KiB
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Unit tests for migration v2 streams
"""
import unittest
from struct import calcsize
from xen.migration import libxc, libxl
class TestLibxc(unittest.TestCase):
def test_format_sizes(self):
for fmt, sz in ( (libxc.IHDR_FORMAT, 24),
(libxc.DHDR_FORMAT, 16),
(libxc.RH_FORMAT, 8),
(libxc.PAGE_DATA_FORMAT, 8),
(libxc.X86_PV_INFO_FORMAT, 8),
(libxc.X86_PV_P2M_FRAMES_FORMAT, 8),
(libxc.X86_PV_VCPU_HDR_FORMAT, 8),
(libxc.X86_TSC_INFO_FORMAT, 24),
(libxc.HVM_PARAMS_ENTRY_FORMAT, 16),
(libxc.HVM_PARAMS_FORMAT, 8),
):
self.assertEqual(calcsize(fmt), sz)
class TestLibxl(unittest.TestCase):
def test_format_sizes(self):
for fmt, sz in ( (libxl.HDR_FORMAT, 16),
(libxl.RH_FORMAT, 8),
(libxl.EMULATOR_HEADER_FORMAT, 8),
):
self.assertEqual(calcsize(fmt), sz)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestLibxc))
suite.addTest(unittest.makeSuite(TestLibxl))
return suite
if __name__ == "__main__":
unittest.main()