[PATCH 2/3] tests: adding vfio-ccw to nodedev tests

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

 



Signed-off-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx>
---
 ...52_9b13_9b13_9b13_cc23009b1326-create.argv |  5 +++
 ...52_9b13_9b13_9b13_cc23009b1326-create.json |  1 +
 ...52_9b13_9b13_9b13_cc23009b1326-define.argv |  5 +++
 ...52_9b13_9b13_9b13_cc23009b1326-define.json |  1 +
 .../mdevctl-list-multiple.json                |  9 ++++++
 .../mdevctl-list-multiple.out.xml             |  9 ++++++
 tests/nodedevmdevctltest.c                    | 31 ++++++++++++++++++-
 ...v_cc000052_9b13_9b13_9b13_cc23009b1326.xml |  8 +++++
 8 files changed, 68 insertions(+), 1 deletion(-)
 create mode 100644 tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-create.argv
 create mode 100644 tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-create.json
 create mode 100644 tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-define.argv
 create mode 100644 tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-define.json
 create mode 100644 tests/nodedevschemadata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326.xml

diff --git a/tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-create.argv b/tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-create.argv
new file mode 100644
index 0000000000..6d5c6e1cb8
--- /dev/null
+++ b/tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-create.argv
@@ -0,0 +1,5 @@
+mdevctl \
+start \
+--parent=0.0.0052 \
+--jsonfile=/dev/stdin \
+--uuid=cc000052-9b13-9b13-9b13-cc23009b1326
diff --git a/tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-create.json b/tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-create.json
new file mode 100644
index 0000000000..2dced5c695
--- /dev/null
+++ b/tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-create.json
@@ -0,0 +1 @@
+{"mdev_type":"vfio_ccw-io","start":"manual"}
diff --git a/tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-define.argv b/tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-define.argv
new file mode 100644
index 0000000000..997ce08fb8
--- /dev/null
+++ b/tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-define.argv
@@ -0,0 +1,5 @@
+mdevctl \
+define \
+--parent=0.0.0052 \
+--jsonfile=/dev/stdin \
+--uuid=cc000052-9b13-9b13-9b13-cc23009b1326
diff --git a/tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-define.json b/tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-define.json
new file mode 100644
index 0000000000..2dced5c695
--- /dev/null
+++ b/tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-define.json
@@ -0,0 +1 @@
+{"mdev_type":"vfio_ccw-io","start":"manual"}
diff --git a/tests/nodedevmdevctldata/mdevctl-list-multiple.json b/tests/nodedevmdevctldata/mdevctl-list-multiple.json
index 98e46584a0..ee6641df6f 100644
--- a/tests/nodedevmdevctldata/mdevctl-list-multiple.json
+++ b/tests/nodedevmdevctldata/mdevctl-list-multiple.json
@@ -52,6 +52,15 @@
           ]
         }
       }
+    ],
+    "0.0.0052": [
+      {
+        "cc000052-9b13-9b13-9b13-cc23009b1326": {
+          "mdev_type": "vfio_ccw-io",
+          "start": "manual",
+          "attrs": []
+        }
+      }
     ]
   }
 ]
diff --git a/tests/nodedevmdevctldata/mdevctl-list-multiple.out.xml b/tests/nodedevmdevctldata/mdevctl-list-multiple.out.xml
index 4b558a1464..4df5f4f43c 100644
--- a/tests/nodedevmdevctldata/mdevctl-list-multiple.out.xml
+++ b/tests/nodedevmdevctldata/mdevctl-list-multiple.out.xml
@@ -41,3 +41,12 @@
     <attr name='assign_control_domain' value='4'/>
   </capability>
 </device>
+<device>
+  <name>mdev_cc000052_9b13_9b13_9b13_cc23009b1326_0_0_0052</name>
+  <parent>css_0_0_0052</parent>
+  <capability type='mdev'>
+    <type id='vfio_ccw-io'/>
+    <uuid>cc000052-9b13-9b13-9b13-cc23009b1326</uuid>
+    <iommuGroup number='0'/>
+  </capability>
+</device>
diff --git a/tests/nodedevmdevctltest.c b/tests/nodedevmdevctltest.c
index 92d3c75766..d660d4cc21 100644
--- a/tests/nodedevmdevctltest.c
+++ b/tests/nodedevmdevctltest.c
@@ -331,6 +331,32 @@ fakeMatrixDevice(void)
 
     return def;
 }
+
+/* Add a fake css device that can be used as a parent device for mediated
+ * devices. For our purposes, it only needs to have a name that matches the
+ * parent of the mdev, and it needs the proper name
+ */
+static virNodeDeviceDef *
+fakeCSSDevice(void)
+{
+    virNodeDeviceDef *def = NULL;
+    virNodeDevCapCCW *css_dev;
+
+    def = g_new0(virNodeDeviceDef, 1);
+    def->caps = g_new0(virNodeDevCapsDef, 1);
+
+    def->name = g_strdup("css_0_0_0052");
+    def->parent = g_strdup("computer");
+
+    def->caps->data.type = VIR_NODE_DEV_CAP_CSS_DEV;
+    css_dev = &def->caps->data.ccw_dev;
+    css_dev->cssid = 0;
+    css_dev->ssid = 0;
+    css_dev->devno = 82;
+
+    return def;
+}
+
 static int
 addDevice(virNodeDeviceDef *def)
 {
@@ -354,7 +380,8 @@ nodedevTestDriverAddTestDevices(void)
 {
     if (addDevice(fakeRootDevice()) < 0 ||
         addDevice(fakePCIDevice()) < 0 ||
-        addDevice(fakeMatrixDevice()) < 0)
+        addDevice(fakeMatrixDevice()) < 0 ||
+        addDevice(fakeCSSDevice()) < 0)
         return -1;
 
     return 0;
@@ -437,6 +464,7 @@ mymain(void)
     DO_TEST_CREATE("mdev_d069d019_36ea_4111_8f0a_8c9a70e21366");
     DO_TEST_CREATE("mdev_fedc4916_1ca8_49ac_b176_871d16c13076");
     DO_TEST_CREATE("mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9");
+    DO_TEST_CREATE("mdev_cc000052_9b13_9b13_9b13_cc23009b1326");
 
     /* Test mdevctl stop command, pass an arbitrary uuid */
     DO_TEST_STOP("mdev_d069d019_36ea_4111_8f0a_8c9a70e21366");
@@ -449,6 +477,7 @@ mymain(void)
     DO_TEST_DEFINE("mdev_d069d019_36ea_4111_8f0a_8c9a70e21366");
     DO_TEST_DEFINE("mdev_fedc4916_1ca8_49ac_b176_871d16c13076");
     DO_TEST_DEFINE("mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9");
+    DO_TEST_DEFINE("mdev_cc000052_9b13_9b13_9b13_cc23009b1326");
 
     DO_TEST_UNDEFINE("mdev_d069d019_36ea_4111_8f0a_8c9a70e21366");
 
diff --git a/tests/nodedevschemadata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326.xml b/tests/nodedevschemadata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326.xml
new file mode 100644
index 0000000000..8a779464d8
--- /dev/null
+++ b/tests/nodedevschemadata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326.xml
@@ -0,0 +1,8 @@
+<device>
+  <name>mdev_cc000052_9b13_9b13_9b13_cc23009b1326</name>
+  <parent>css_0_0_0052</parent>
+  <capability type='mdev'>
+    <type id='vfio_ccw-io'/>
+    <uuid>cc000052-9b13-9b13-9b13-cc23009b1326</uuid>
+  </capability>
+</device>
-- 
2.33.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux