Blame SOURCES/0179-tests-Add-a-regression-test-for-RHBZ-1370424.patch

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