summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-02-10 10:49:37 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-02-10 14:01:38 +0000
commitbadf2d6c4d2c2a3e12bad4dcbd5854401156bb5f (patch)
tree16af765794b1f871a4fb6a4c0de8501fa6245a47
parent7c21e49c2c83092e9fd5f40c43a03c764a6d3663 (diff)
downloadlibguestfs-badf2d6c4d2c2a3e12bad4dcbd5854401156bb5f.tar.gz
libguestfs-badf2d6c4d2c2a3e12bad4dcbd5854401156bb5f.tar.xz
libguestfs-badf2d6c4d2c2a3e12bad4dcbd5854401156bb5f.zip
virt-format: Add a test.
-rw-r--r--format/Makefile.am13
-rwxr-xr-xformat/test-virt-format.sh34
2 files changed, 40 insertions, 7 deletions
diff --git a/format/Makefile.am b/format/Makefile.am
index b3ff2164..0d1b28ea 100644
--- a/format/Makefile.am
+++ b/format/Makefile.am
@@ -18,6 +18,7 @@
include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
+ $(TESTS) \
virt-format.pod
CLEANFILES = stamp-virt-format.pod
@@ -67,12 +68,10 @@ stamp-virt-format.pod: virt-format.pod
# Tests.
-# random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
+random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
-# TESTS_ENVIRONMENT = \
-# MALLOC_PERTURB_=$(random_val) \
-# LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
-# LIBGUESTFS_PATH=$(top_builddir)/appliance \
-# TMPDIR=$(top_builddir)
+TESTS_ENVIRONMENT = \
+ MALLOC_PERTURB_=$(random_val) \
+ $(top_builddir)/run
-# TESTS = test-virt-format.sh
+TESTS = test-virt-format.sh
diff --git a/format/test-virt-format.sh b/format/test-virt-format.sh
new file mode 100755
index 00000000..2035e67e
--- /dev/null
+++ b/format/test-virt-format.sh
@@ -0,0 +1,34 @@
+#!/bin/bash -
+# libguestfs
+# Copyright (C) 2012 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.
+
+# Test virt-format command.
+
+set -e
+
+rm -f test1.img
+
+../fish/guestfish -N bootrootlv exit
+
+./virt-format --filesystem=ext3 -a test1.img
+
+if [ "$(../cat/virt-filesystems -a test1.img)" != "/dev/sda1" ]; then
+ echo "$0: unexpected output after using virt-format"
+ exit 1
+fi
+
+rm -f test1.img