diff --git a/tests/data/capabilities/kvm-loongarch64-domcaps.xml b/tests/data/capabilities/kvm-loongarch64-domcaps.xml
new file mode 100644
index 000000000..e9836fec4
--- /dev/null
+++ b/tests/data/capabilities/kvm-loongarch64-domcaps.xml
@@ -0,0 +1,166 @@
+
+ /usr/bin/qemu-system-loongarch64
+ kvm
+ virt
+ loongarch64
+
+
+
+
+ efi
+
+
+ /usr/share/edk2/loongarch64/QEMU_CODE.fd
+
+ rom
+ pflash
+
+
+ yes
+ no
+
+
+ no
+
+
+
+
+
+
+ off
+
+
+
+
+ on
+ off
+
+
+
+
+ la464
+ max
+ la132
+
+
+
+
+ file
+ anonymous
+ memfd
+
+
+
+
+
+ disk
+ cdrom
+ floppy
+ lun
+
+
+ fdc
+ scsi
+ virtio
+ usb
+ sata
+
+
+ virtio
+ virtio-transitional
+ virtio-non-transitional
+
+
+
+
+ sdl
+ vnc
+ spice
+ egl-headless
+ dbus
+
+
+
+
+
+ subsystem
+
+
+ default
+ mandatory
+ requisite
+ optional
+
+
+ usb
+ pci
+ scsi
+
+
+
+
+
+
+ virtio
+ virtio-transitional
+ virtio-non-transitional
+
+
+ random
+ egd
+ builtin
+
+
+
+
+ path
+ handle
+ virtiofs
+
+
+
+
+
+ usb
+
+
+
+
+ pty
+ unix
+ spicevmc
+
+
+
+
+ virtio
+
+
+ qemu
+
+
+ builtin
+ lkcf
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/data/capabilities/kvm-loongarch64.xml b/tests/data/capabilities/kvm-loongarch64.xml
new file mode 100644
index 000000000..7aab1b7c1
--- /dev/null
+++ b/tests/data/capabilities/kvm-loongarch64.xml
@@ -0,0 +1,71 @@
+
+
+
+ 21628021-9401-4aef-ad85-a26f109ec950
+
+ loongarch64
+
+
+
+
+
+
+
+
+
+
+
+ tcp
+ rdma
+
+
+
+
+
+ 16532032
+ 1033252
+ 0
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+ none
+ 0
+
+
+ dac
+ 0
+ +964:+964
+ +964:+964
+
+
+
+
+ hvm
+
+ 64
+ /usr/bin/qemu-system-loongarch64
+ virt
+ x-remote
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/data/cli/compare/virt-install-loongarch64-cdrom.xml b/tests/data/cli/compare/virt-install-loongarch64-cdrom.xml
new file mode 100644
index 000000000..f0b5d8565
--- /dev/null
+++ b/tests/data/cli/compare/virt-install-loongarch64-cdrom.xml
@@ -0,0 +1,154 @@
+
+ fedora29
+ 00000000-1111-2222-3333-444444444444
+
+
+
+
+
+ 65536
+ 65536
+ 2
+
+ hvm
+
+
+
+
+
+
+
+
+ /usr/bin/qemu-system-loongarch64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /dev/urandom
+
+
+ destroy
+
+
+ fedora29
+ 00000000-1111-2222-3333-444444444444
+
+
+
+
+
+ 65536
+ 65536
+ 2
+
+ hvm
+
+
+
+
+
+
+
+ /usr/bin/qemu-system-loongarch64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /dev/urandom
+
+
+
diff --git a/tests/data/cli/compare/virt-install-loongarch64-cloud-init.xml b/tests/data/cli/compare/virt-install-loongarch64-cloud-init.xml
new file mode 100644
index 000000000..9c32f9238
--- /dev/null
+++ b/tests/data/cli/compare/virt-install-loongarch64-cloud-init.xml
@@ -0,0 +1,152 @@
+
+ fedora29
+ 00000000-1111-2222-3333-444444444444
+
+
+
+
+
+ 65536
+ 65536
+ 2
+
+ hvm
+
+
+
+
+
+
+ /usr/bin/qemu-system-loongarch64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /dev/urandom
+
+
+
+
+
+
+
+
+
+ destroy
+
+
+ fedora29
+ 00000000-1111-2222-3333-444444444444
+
+
+
+
+
+ 65536
+ 65536
+ 2
+
+ hvm
+
+
+
+
+
+
+
+ /usr/bin/qemu-system-loongarch64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /dev/urandom
+
+
+
+
+
+
+
+
diff --git a/tests/data/cli/compare/virt-install-loongarch64-graphics.xml b/tests/data/cli/compare/virt-install-loongarch64-graphics.xml
new file mode 100644
index 000000000..c6711da67
--- /dev/null
+++ b/tests/data/cli/compare/virt-install-loongarch64-graphics.xml
@@ -0,0 +1,70 @@
+
+ fedora29
+ 00000000-1111-2222-3333-444444444444
+
+
+
+
+
+ 65536
+ 65536
+ 2
+
+ hvm
+
+
+
+
+
+
+
+ /usr/bin/qemu-system-loongarch64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /dev/urandom
+
+
+
diff --git a/tests/data/cli/compare/virt-install-loongarch64-headless.xml b/tests/data/cli/compare/virt-install-loongarch64-headless.xml
new file mode 100644
index 000000000..5671b2f22
--- /dev/null
+++ b/tests/data/cli/compare/virt-install-loongarch64-headless.xml
@@ -0,0 +1,58 @@
+
+ fedora29
+ 00000000-1111-2222-3333-444444444444
+
+
+
+
+
+ 65536
+ 65536
+ 2
+
+ hvm
+
+
+
+
+
+
+
+ /usr/bin/qemu-system-loongarch64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /dev/urandom
+
+
+
diff --git a/tests/data/cli/compare/virt-install-loongarch64-kernel-boot.xml b/tests/data/cli/compare/virt-install-loongarch64-kernel-boot.xml
new file mode 100644
index 000000000..6ef1294aa
--- /dev/null
+++ b/tests/data/cli/compare/virt-install-loongarch64-kernel-boot.xml
@@ -0,0 +1,72 @@
+
+ fedora29
+ 00000000-1111-2222-3333-444444444444
+
+
+
+
+
+ 65536
+ 65536
+ 2
+
+ hvm
+ /kernel.img
+ /initrd.img
+ root=/dev/vda2
+
+
+
+
+
+
+ /usr/bin/qemu-system-loongarch64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /dev/urandom
+
+
+
diff --git a/tests/data/cli/compare/virt-install-loongarch64-unattended.xml b/tests/data/cli/compare/virt-install-loongarch64-unattended.xml
new file mode 100644
index 000000000..183fa4e08
--- /dev/null
+++ b/tests/data/cli/compare/virt-install-loongarch64-unattended.xml
@@ -0,0 +1,152 @@
+
+ fedora29
+ 00000000-1111-2222-3333-444444444444
+
+
+
+
+
+ 65536
+ 65536
+ 2
+
+ hvm
+
+
+
+
+
+
+ /usr/bin/qemu-system-loongarch64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /dev/urandom
+
+
+
+
+
+
+
+
+
+ destroy
+
+
+ fedora29
+ 00000000-1111-2222-3333-444444444444
+
+
+
+
+
+ 65536
+ 65536
+ 2
+
+ hvm
+
+
+
+
+
+
+
+ /usr/bin/qemu-system-loongarch64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /dev/urandom
+
+
+
+
+
+
+
+
diff --git a/tests/test_cli.py b/tests/test_cli.py
index c42457897..11f822f4d 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -73,6 +73,7 @@ TEST_DATA = {
'URI-KVM-X86': utils.URIs.kvm_x86,
'URI-KVM-ARMV7L': utils.URIs.kvm_armv7l,
'URI-KVM-AARCH64': utils.URIs.kvm_aarch64,
+ 'URI-KVM-LOONGARCH64': utils.URIs.kvm_loongarch64,
'URI-KVM-PPC64LE': utils.URIs.kvm_ppc64le,
'URI-KVM-S390X': utils.URIs.kvm_s390x,
'URI-QEMU-RISCV64': utils.URIs.qemu_riscv64,
@@ -1207,6 +1208,19 @@ c.add_compare("--connect %(URI-KVM-AARCH64)s --disk %(EXISTIMG1)s --os-variant f
+#####################
+# loongarch64 tests #
+#####################
+
+c.add_compare("--connect %(URI-KVM-LOONGARCH64)s --arch loongarch64 --osinfo fedora29 --import --disk %(EXISTIMG1)s --network default --graphics none", "loongarch64-headless")
+c.add_compare("--connect %(URI-KVM-LOONGARCH64)s --arch loongarch64 --osinfo fedora29 --import --disk %(EXISTIMG1)s --network default --graphics spice", "loongarch64-graphics")
+c.add_compare("--connect %(URI-KVM-LOONGARCH64)s --arch loongarch64 --osinfo fedora29 --import --disk %(EXISTIMG1)s --boot kernel=/kernel.img,initrd=/initrd.img,cmdline='root=/dev/vda2'", "loongarch64-kernel-boot")
+c.add_compare("--connect %(URI-KVM-LOONGARCH64)s --arch loongarch64 --osinfo fedora29 --import --disk %(EXISTIMG1)s --cloud-init", "loongarch64-cloud-init")
+c.add_compare("--connect %(URI-KVM-LOONGARCH64)s --arch loongarch64 --osinfo fedora29 --cdrom %(ISO-F26-NETINST)s", "loongarch64-cdrom")
+c.add_compare("--connect %(URI-KVM-LOONGARCH64)s --arch loongarch64 --osinfo fedora29 --unattended", "loongarch64-unattended")
+
+
+
#################
# AMD sev tests #
#################
diff --git a/tests/utils.py b/tests/utils.py
index 0ff505e81..f9de0f8f1 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -105,6 +105,7 @@ class _URIs(object):
self.kvm_ppc64le = _uri_qemu + _caps("kvm-ppc64le.xml") + _domcaps("kvm-ppc64le-domcaps.xml")
self.kvm_s390x = _uri_qemu + _caps("kvm-s390x.xml") + _domcaps("kvm-s390x-domcaps.xml")
self.qemu_riscv64 = _uri_qemu + _caps("qemu-riscv64.xml") + _domcaps("qemu-riscv64-domcaps.xml")
+ self.kvm_loongarch64 = _uri_qemu + _caps("kvm-loongarch64.xml") + _domcaps("kvm-loongarch64-domcaps.xml")
# hvf
self.hvf_x86 = _uri_qemu + _caps("hvf-x86_64.xml") + _domcaps("hvf-x86_64-domcaps.xml")