[virt-tools-list] [PATCH 3/3] tests: add tests for capabilities secmodels

Giuseppe Scrivano gscrivan at redhat.com
Fri Nov 15 12:15:35 UTC 2013


Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
---
 tests/capabilities-xml/capabilities-kvm.xml | 6 ++++++
 tests/capabilities.py                       | 9 +++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/tests/capabilities-xml/capabilities-kvm.xml b/tests/capabilities-xml/capabilities-kvm.xml
index 4d3c574..afbc211 100644
--- a/tests/capabilities-xml/capabilities-kvm.xml
+++ b/tests/capabilities-xml/capabilities-kvm.xml
@@ -3,6 +3,12 @@
     <cpu>
       <arch>i686</arch>
     </cpu>
+    <secmodel>
+      <model>dac</model>
+      <doi>0</doi>
+      <baselabel type='kvm'>+0:+0</baselabel>
+      <baselabel type='qemu'>+0:+0</baselabel>
+    </secmodel>
   </host>
 
   <guest>
diff --git a/tests/capabilities.py b/tests/capabilities.py
index 271ae9c..952838b 100644
--- a/tests/capabilities.py
+++ b/tests/capabilities.py
@@ -61,6 +61,9 @@ class TestCapabilities(unittest.TestCase):
         if secmodel:
             self.assertEqual(secmodel[0], caps.host.secmodel.model)
             self.assertEqual(secmodel[1], caps.host.secmodel.doi)
+            if secmodel[2]:
+                for k, v in secmodel[2].items():
+                    self.assertEqual(v, caps.host.secmodel.baselabels[k])
 
         for idx in range(len(guests)):
             self._compareGuest(guests[idx], caps.guests[idx])
@@ -83,7 +86,7 @@ class TestCapabilities(unittest.TestCase):
 
     def testCapabilities2(self):
         host = ('x86_64', {})
-        secmodel = ('selinux', '0')
+        secmodel = ('selinux', '0', None)
 
         guests = [
             ('x86_64', 'hvm',
@@ -123,7 +126,9 @@ class TestCapabilities(unittest.TestCase):
                ['g3bw', 'mac99', 'prep']]], {}),
        ]
 
-        self._testCapabilities("capabilities-kvm.xml", host, guests)
+        secmodel = ('dac', '0', {"kvm" : "+0:+0", "qemu" : "+0:+0"})
+
+        self._testCapabilities("capabilities-kvm.xml", host, guests, secmodel)
 
     def testCapabilities4(self):
         host = ('i686',
-- 
1.8.3.1




More information about the virt-tools-list mailing list