[Libguestfs] [PATCH 3/3] builder: Add test of virt-index-validate.

Richard W.M. Jones rjones at redhat.com
Thu Apr 3 07:59:48 UTC 2014


---
 builder/Makefile.am                     |  8 +++++++-
 builder/test-virt-index-validate-bad-1  |  8 ++++++++
 builder/test-virt-index-validate-good-1 |  0
 builder/test-virt-index-validate-good-2 |  2 ++
 builder/test-virt-index-validate.sh     | 24 ++++++++++++++++++++++++
 5 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100644 builder/test-virt-index-validate-bad-1
 create mode 100644 builder/test-virt-index-validate-good-1
 create mode 100644 builder/test-virt-index-validate-good-2
 create mode 100755 builder/test-virt-index-validate.sh

diff --git a/builder/Makefile.am b/builder/Makefile.am
index 56e8929..851e3a6 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -33,6 +33,10 @@ EXTRA_DIST = \
 	test-virt-builder.sh \
 	test-virt-builder-list.sh \
 	test-virt-builder-planner.sh \
+	test-virt-index-validate.sh \
+	test-virt-index-validate-bad-1 \
+	test-virt-index-validate-good-1 \
+	test-virt-index-validate-good-2 \
 	virt-builder.pod \
 	virt-index-validate.pod
 
@@ -226,7 +230,9 @@ fedora.qcow2.xz: fedora.qcow2
 	xz --best --block-size=16777216 -c $< > $@-t
 	mv $@-t $@
 
-TESTS = test-virt-builder-list.sh
+TESTS = \
+	test-virt-builder-list.sh \
+	test-virt-index-validate.sh
 
 if ENABLE_APPLIANCE
 TESTS += test-virt-builder.sh
diff --git a/builder/test-virt-index-validate-bad-1 b/builder/test-virt-index-validate-bad-1
new file mode 100644
index 0000000..f722af4
--- /dev/null
+++ b/builder/test-virt-index-validate-bad-1
@@ -0,0 +1,8 @@
+name=Phony Fedora
+arch=x86_64
+file=fedora.xz
+format=raw
+size=1073741824
+expand=/dev/sda2
+lvexpand=/dev/VG/Root
+notes=Phony Fedora look-alike used for testing.
diff --git a/builder/test-virt-index-validate-good-1 b/builder/test-virt-index-validate-good-1
new file mode 100644
index 0000000..e69de29
diff --git a/builder/test-virt-index-validate-good-2 b/builder/test-virt-index-validate-good-2
new file mode 100644
index 0000000..347e245
--- /dev/null
+++ b/builder/test-virt-index-validate-good-2
@@ -0,0 +1,2 @@
+# All lines commented out.
+# [foo]
diff --git a/builder/test-virt-index-validate.sh b/builder/test-virt-index-validate.sh
new file mode 100755
index 0000000..37e7339
--- /dev/null
+++ b/builder/test-virt-index-validate.sh
@@ -0,0 +1,24 @@
+#!/bin/bash -
+# test virt-index-validate
+# Copyright (C) 2014 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.
+
+export LANG=C
+set -e
+
+! $VG ./virt-index-validate test-virt-index-validate-bad-1
+$VG ./virt-index-validate test-virt-index-validate-good-1
+$VG ./virt-index-validate test-virt-index-validate-good-2
-- 
1.8.5.3




More information about the Libguestfs mailing list