[Libguestfs] [PATCH 2/3] tests: Add a regression test for RHBZ#1370424.

Richard W.M. Jones rjones at redhat.com
Sat Aug 27 08:12:01 UTC 2016


Regression test for previous commit which just tests that
guestfs_add_domain doesn't assert-fail on guests with no port
attribute.
---
 tests/regressions/Makefile.am     |  2 ++
 tests/regressions/rhbz1370424.sh  | 42 +++++++++++++++++++++++++++++++++++++++
 tests/regressions/rhbz1370424.xml | 28 ++++++++++++++++++++++++++
 3 files changed, 72 insertions(+)
 create mode 100755 tests/regressions/rhbz1370424.sh
 create mode 100644 tests/regressions/rhbz1370424.xml

diff --git a/tests/regressions/Makefile.am b/tests/regressions/Makefile.am
index 77a5ff5..407c5b0 100644
--- a/tests/regressions/Makefile.am
+++ b/tests/regressions/Makefile.am
@@ -48,6 +48,7 @@ EXTRA_DIST = \
 	rhbz1232192.sh \
 	rhbz1232192.xml \
 	rhbz1285847.sh \
+	rhbz1370424.sh \
 	test-noexec-stack.pl
 
 TESTS = \
@@ -77,6 +78,7 @@ TESTS = \
 	rhbz1175196.sh \
 	rhbz1232192.sh \
 	rhbz1285847.sh \
+	rhbz1370424.sh \
 	test-big-heap \
 	test-noexec-stack.pl \
 	$(SLOW_TESTS)
diff --git a/tests/regressions/rhbz1370424.sh b/tests/regressions/rhbz1370424.sh
new file mode 100755
index 0000000..5b21a32
--- /dev/null
+++ b/tests/regressions/rhbz1370424.sh
@@ -0,0 +1,42 @@
+#!/bin/bash -
+# libguestfs
+# Copyright (C) 2016 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# Regression test for:
+# https://bugzilla.redhat.com/show_bug.cgi?id=1370424
+# Handle a network disk without a port attribute.
+
+set -e
+export LANG=C
+
+if [ -n "$SKIP_TEST_RHBZ1370424_SH" ]; then
+    echo "$0: test skipped because environment variable is set"
+    exit 77
+fi
+
+if [ "$(guestfish get-backend)" = "uml" ]; then
+    echo "$0: test skipped because UML backend does not support network"
+    exit 77
+fi
+
+guestfish <<EOF
+-add-domain rhbz1370424 \
+            libvirturi:test://$(pwd)/rhbz1370424.xml \
+            readonly:true
+# The test is just that the above command does not segfault.
+# We don't need to do anything else here.
+EOF
diff --git a/tests/regressions/rhbz1370424.xml b/tests/regressions/rhbz1370424.xml
new file mode 100644
index 0000000..059ea21
--- /dev/null
+++ b/tests/regressions/rhbz1370424.xml
@@ -0,0 +1,28 @@
+<node>
+  <domain type='test'>
+    <name>rhbz1370424</name>
+    <memory>1048576</memory>
+    <vcpu>2</vcpu>
+    <os>
+      <type>hvm</type>
+      <boot dev='hd'/>
+    </os>
+    <features>
+      <acpi/>
+      <apic/>
+      <pae/>
+    </features>
+    <devices>
+      <disk type='network' device='disk'>
+        <driver name='qemu' type='raw'/>
+        <source protocol='gluster' name='gluster-vol/test.qcow2'>
+          <host name='localhost'/>
+        </source>
+        <backingStore/>
+        <target dev='vda' bus='virtio'/>
+        <alias name='virtio-disk0'/>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+      </disk>
+    </devices>
+  </domain>
+</node>
-- 
2.7.4




More information about the Libguestfs mailing list