From 7de9f3e078137843f5de6bf865d5c09a151a165c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 12 Nov 2019 22:45:30 +0100 Subject: [PATCH] tests: is_iommu_supported function QubesOS/qubes-issues#4689 --- qubes/tests/app.py | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/qubes/tests/app.py b/qubes/tests/app.py index 0f06b641..9fec1ef5 100644 --- a/qubes/tests/app.py +++ b/qubes/tests/app.py @@ -153,6 +153,56 @@ class TC_20_QubesHost(qubes.tests.QubesTestCase): ('xc.domain_getinfo', (1, 1), {}), ]) + def test_010_iommu_supported(self): + self.app.vmm.configure_mock(**{ + 'xc.physinfo.return_value': { + 'hw_caps': '...', + 'scrub_memory': 0, + 'virt_caps': 'hvm hvm_directio', + 'nr_cpus': 4, + 'threads_per_core': 1, + 'cpu_khz': 3400001, + 'nr_nodes': 1, + 'free_memory': 234752, + 'cores_per_socket': 4, + 'total_memory': 16609720 + } + }) + self.assertEqual(self.qubes_host.is_iommu_supported(), True) + + def test_011_iommu_supported(self): + self.app.vmm.configure_mock(**{ + 'xc.physinfo.return_value': { + 'hw_caps': '...', + 'scrub_memory': 0, + 'virt_caps': 'hvm hvm_directio pv pv_directio', + 'nr_cpus': 4, + 'threads_per_core': 1, + 'cpu_khz': 3400001, + 'nr_nodes': 1, + 'free_memory': 234752, + 'cores_per_socket': 4, + 'total_memory': 16609720 + } + }) + self.assertEqual(self.qubes_host.is_iommu_supported(), True) + + def test_010_iommu_supported(self): + self.app.vmm.configure_mock(**{ + 'xc.physinfo.return_value': { + 'hw_caps': '...', + 'scrub_memory': 0, + 'virt_caps': 'hvm pv', + 'nr_cpus': 4, + 'threads_per_core': 1, + 'cpu_khz': 3400001, + 'nr_nodes': 1, + 'free_memory': 234752, + 'cores_per_socket': 4, + 'total_memory': 16609720 + } + }) + self.assertEqual(self.qubes_host.is_iommu_supported(), False) class TC_30_VMCollection(qubes.tests.QubesTestCase):