[PATCH 4/4] bhyve: Test cases for UEFI bhyvexml2argvtest

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

 



---
 tests/bhyvexml2argvdata/bhyvexml2argv-nouefi.args  |  9 +++++++++
 .../bhyvexml2argvdata/bhyvexml2argv-nouefi.ldargs  |  1 +
 tests/bhyvexml2argvdata/bhyvexml2argv-nouefi.xml   | 23 ++++++++++++++++++++++
 tests/bhyvexml2argvdata/bhyvexml2argv-uefi.args    | 10 ++++++++++
 tests/bhyvexml2argvdata/bhyvexml2argv-uefi.ldargs  |  1 +
 tests/bhyvexml2argvdata/bhyvexml2argv-uefi.xml     | 23 ++++++++++++++++++++++
 tests/bhyvexml2argvtest.c                          | 13 ++++++++++--
 7 files changed, 78 insertions(+), 2 deletions(-)
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-nouefi.args
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-nouefi.ldargs
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-nouefi.xml
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-uefi.args
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-uefi.ldargs
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-uefi.xml

diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-nouefi.args b/tests/bhyvexml2argvdata/bhyvexml2argv-nouefi.args
new file mode 100644
index 0000000..88de179
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-nouefi.args
@@ -0,0 +1,9 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-u \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
+-s 2:0,ahci-hd,/tmp/freebsd.img bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-nouefi.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-nouefi.ldargs
new file mode 100644
index 0000000..421376d
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-nouefi.ldargs
@@ -0,0 +1 @@
+dummy
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-nouefi.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-nouefi.xml
new file mode 100644
index 0000000..eacae99
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-nouefi.xml
@@ -0,0 +1,23 @@
+<domain type='bhyve'>
+  <name>bhyve</name>
+  <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
+  <memory>219136</memory>
+  <vcpu>1</vcpu>
+  <os>
+    <type>hvm</type>
+    <loader readonly="yes" type="pflash">test.fd</loader>
+  </os>
+  <devices>
+    <disk type='file'>
+      <driver name='file' type='raw'/>
+      <source file='/tmp/freebsd.img'/>
+      <target dev='hda' bus='sata'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </disk>
+    <interface type='bridge'>
+      <model type='virtio'/>
+      <source bridge="virbr0"/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </interface>
+  </devices>
+</domain>
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-uefi.args b/tests/bhyvexml2argvdata/bhyvexml2argv-uefi.args
new file mode 100644
index 0000000..3f6ef65
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-uefi.args
@@ -0,0 +1,10 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-u \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 0:1,bootrom,test.fd \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
+-s 2:0,ahci-hd,/tmp/freebsd.img bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-uefi.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-uefi.ldargs
new file mode 100644
index 0000000..421376d
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-uefi.ldargs
@@ -0,0 +1 @@
+dummy
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-uefi.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-uefi.xml
new file mode 100644
index 0000000..eacae99
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-uefi.xml
@@ -0,0 +1,23 @@
+<domain type='bhyve'>
+  <name>bhyve</name>
+  <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
+  <memory>219136</memory>
+  <vcpu>1</vcpu>
+  <os>
+    <type>hvm</type>
+    <loader readonly="yes" type="pflash">test.fd</loader>
+  </os>
+  <devices>
+    <disk type='file'>
+      <driver name='file' type='raw'/>
+      <source file='/tmp/freebsd.img'/>
+      <target dev='hda' bus='sata'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </disk>
+    <interface type='bridge'>
+      <model type='virtio'/>
+      <source bridge="virbr0"/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </interface>
+  </devices>
+</domain>
diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c
index 7a2d366..5137251 100644
--- a/tests/bhyvexml2argvtest.c
+++ b/tests/bhyvexml2argvtest.c
@@ -44,9 +44,13 @@ static int testCompareXMLToArgvFiles(const char *xml,
     conn->privateData = &driver;
 
     cmd = virBhyveProcessBuildBhyveCmd(conn, vmdef, false);
-    ldcmd = virBhyveProcessBuildLoadCmd(conn, vmdef, "<device.map>",
+    if (!vmdef->os.loader)
+            ldcmd = virBhyveProcessBuildLoadCmd(conn, vmdef, "<device.map>",
                                         &actualdm);
 
+    if ((ldcmd == NULL) && (vmdef->os.loader))
+        ldcmd = virCommandNew("dummy");
+
     if ((cmd == NULL) || (ldcmd == NULL)) {
         if (flags & FLAG_EXPECT_FAILURE) {
             ret = 0;
@@ -151,7 +155,7 @@ mymain(void)
     DO_TEST_FULL(name, FLAG_EXPECT_PARSE_ERROR)
 
     driver.grubcaps = BHYVE_GRUB_CAP_CONSDEV;
-    driver.bhyvecaps = BHYVE_CAP_RTC_UTC;
+    driver.bhyvecaps = BHYVE_CAP_RTC_UTC | BHYVE_CAP_LPC_BOOTROM;
 
     DO_TEST("base");
     DO_TEST("acpiapic");
@@ -179,6 +183,11 @@ mymain(void)
 
     DO_TEST("serial-grub-nocons");
 
+    DO_TEST("uefi");
+
+    driver.bhyvecaps &= ~BHYVE_CAP_LPC_BOOTROM;
+    DO_TEST_FAILURE("nouefi");
+
     virObjectUnref(driver.caps);
     virObjectUnref(driver.xmlopt);
 
-- 
2.7.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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]