[PATCH 4/5] tests: Add firmware descriptor for edk2 on loongarch64

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

 



This fails to be parsed because libvirt doesn't yet know about
the architecture, but thanks to the recent improvements this
is a merely a local failure rather than bringing everything
else down with it.

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 .../qemu/firmware/50-edk2-loongarch64.json    | 29 +++++++++++++++++++
 tests/qemufirmwaretest.c                      | 26 +++++++++++++++++
 2 files changed, 55 insertions(+)
 create mode 100644 tests/qemufirmwaredata/usr/share/qemu/firmware/50-edk2-loongarch64.json

diff --git a/tests/qemufirmwaredata/usr/share/qemu/firmware/50-edk2-loongarch64.json b/tests/qemufirmwaredata/usr/share/qemu/firmware/50-edk2-loongarch64.json
new file mode 100644
index 0000000000..8251137ba9
--- /dev/null
+++ b/tests/qemufirmwaredata/usr/share/qemu/firmware/50-edk2-loongarch64.json
@@ -0,0 +1,29 @@
+{
+    "interface-types": [
+        "uefi"
+    ],
+    "mapping": {
+        "device": "flash",
+        "mode": "split",
+        "executable": {
+            "filename": "/usr/share/edk2/loongarch64/QEMU_EFI.fd",
+            "format": "raw"
+        },
+        "nvram-template": {
+            "filename": "/usr/share/edk2/loongarch64/QEMU_VARS.fd",
+            "format": "raw"
+        }
+    },
+    "targets": [
+        {
+            "architecture": "loongarch64",
+            "machines": [
+                "virt",
+                "virt-*"
+            ]
+        }
+    ],
+    "features": [
+        "acpi"
+    ]
+}
diff --git a/tests/qemufirmwaretest.c b/tests/qemufirmwaretest.c
index 7596c746ab..3a3aedb1c7 100644
--- a/tests/qemufirmwaretest.c
+++ b/tests/qemufirmwaretest.c
@@ -61,6 +61,23 @@ testParseFormatFW(const void *opaque)
 }
 
 
+static int
+testParseFailureFW(const void *opaque)
+{
+    const char *filename = opaque;
+    g_autofree char *inpath = NULL;
+
+    inpath = g_strdup_printf("%s/qemufirmwaredata/%s", abs_srcdir, filename);
+
+    /* This is a negative test case, so if the file was parsed
+     * successfully we need to report a failure  */
+    if (qemuFirmwareParse(inpath))
+        return -1;
+
+    return 0;
+}
+
+
 static int
 testFWPrecedence(const void *opaque G_GNUC_UNUSED)
 {
@@ -73,6 +90,7 @@ testFWPrecedence(const void *opaque G_GNUC_UNUSED)
         PREFIX "/share/qemu/firmware/40-edk2-ovmf-4m-qcow2-x64-sb.json",
         PREFIX "/share/qemu/firmware/41-edk2-ovmf-2m-raw-x64-sb.json",
         PREFIX "/share/qemu/firmware/50-edk2-aarch64-qcow2.json",
+        PREFIX "/share/qemu/firmware/50-edk2-loongarch64.json",
         PREFIX "/share/qemu/firmware/50-edk2-ovmf-4m-qcow2-x64-nosb.json",
         PREFIX "/share/qemu/firmware/50-edk2-ovmf-x64-microvm.json",
         PREFIX "/share/qemu/firmware/51-edk2-aarch64-raw.json",
@@ -238,11 +256,19 @@ mymain(void)
             ret = -1; \
     } while (0)
 
+#define DO_PARSE_FAILURE_TEST(filename) \
+    do { \
+        if (virTestRun("QEMU FW FAILURE " filename, \
+                       testParseFailureFW, filename) < 0) \
+            ret = -1; \
+    } while (0)
+
     DO_PARSE_TEST("usr/share/qemu/firmware/30-edk2-ovmf-4m-qcow2-x64-sb-enrolled.json");
     DO_PARSE_TEST("usr/share/qemu/firmware/31-edk2-ovmf-2m-raw-x64-sb-enrolled.json");
     DO_PARSE_TEST("usr/share/qemu/firmware/40-edk2-ovmf-4m-qcow2-x64-sb.json");
     DO_PARSE_TEST("usr/share/qemu/firmware/41-edk2-ovmf-2m-raw-x64-sb.json");
     DO_PARSE_TEST("usr/share/qemu/firmware/50-edk2-aarch64-qcow2.json");
+    DO_PARSE_FAILURE_TEST("usr/share/qemu/firmware/50-edk2-loongarch64.json");
     DO_PARSE_TEST("usr/share/qemu/firmware/50-edk2-ovmf-4m-qcow2-x64-nosb.json");
     DO_PARSE_TEST("usr/share/qemu/firmware/50-edk2-ovmf-x64-microvm.json");
     DO_PARSE_TEST("usr/share/qemu/firmware/51-edk2-aarch64-raw.json");
-- 
2.43.2
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[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