[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



Signed-off-by: Giuseppe Scrivano <gscrivan 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]