diff --git a/builder/Makefile.am b/builder/Makefile.am index 56e8929fa..851e3a655 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 000000000..f722af418 --- /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 000000000..e69de29bb diff --git a/builder/test-virt-index-validate-good-2 b/builder/test-virt-index-validate-good-2 new file mode 100644 index 000000000..347e24519 --- /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 000000000..37e7339b3 --- /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