summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-07-30 23:17:49 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-07-30 23:49:47 +0100
commit499497fab03716278cb5214a8aa89a35618e06c6 (patch)
tree879b2918e34220a22428af908caf5346bb760390
parent77326fa4ad757bb255a3c3a07bef8c3ce050a5ac (diff)
downloadlibguestfs-499497fab03716278cb5214a8aa89a35618e06c6.tar.gz
libguestfs-499497fab03716278cb5214a8aa89a35618e06c6.tar.xz
libguestfs-499497fab03716278cb5214a8aa89a35618e06c6.zip
9p: Add a regression test for 9p functionality in qemu.
-rw-r--r--Makefile.am1
-rw-r--r--configure.ac1
-rw-r--r--tests/9p/Makefile.am22
-rwxr-xr-xtests/9p/test-9p.sh56
4 files changed, 80 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 2954be19..7b1f219d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -48,6 +48,7 @@ SUBDIRS += tests/btrfs
SUBDIRS += tests/charsets
SUBDIRS += tests/xml
SUBDIRS += tests/mount-local
+SUBDIRS += tests/9p
SUBDIRS += tests/regressions
endif
diff --git a/configure.ac b/configure.ac
index 76e95d82..7f99fe62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1365,6 +1365,7 @@ AC_CONFIG_FILES([Makefile
src/libguestfs.pc
sysprep/Makefile
test-tool/Makefile
+ tests/9p/Makefile
tests/btrfs/Makefile
tests/c-api/Makefile
tests/charsets/Makefile
diff --git a/tests/9p/Makefile.am b/tests/9p/Makefile.am
new file mode 100644
index 00000000..29600104
--- /dev/null
+++ b/tests/9p/Makefile.am
@@ -0,0 +1,22 @@
+# libguestfs
+# Copyright (C) 2009-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.
+
+include $(top_srcdir)/subdir-rules.mk
+
+TESTS = test-9p.sh
+
+TESTS_ENVIRONMENT = $(top_builddir)/run --test
diff --git a/tests/9p/test-9p.sh b/tests/9p/test-9p.sh
new file mode 100755
index 00000000..74b4e234
--- /dev/null
+++ b/tests/9p/test-9p.sh
@@ -0,0 +1,56 @@
+#!/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 9p filesystems for Avi. As there is no way to add a 9p disk to
+# libguestfs, we have to fake it using 'config'.
+
+set -e
+
+if [ -n "$SKIP_TEST_9P_SH" ]; then
+ echo "$0: test skipped because environment variable is set."
+ exit 77
+fi
+
+method="$(../../fish/guestfish get-attach-method)"
+if [[ "$method" != "appliance" && ! "$method" =~ ^libvirt ]]; then
+ echo "$0: test skipped because attach-method ($method) is not 'appliance' or 'libvirt'."
+ exit 77
+fi
+
+rm -f test.img test.out
+
+../../fish/guestfish <<EOF
+# This dummy disk is not actually used, but libguestfs requires one.
+sparse test.img 1M
+
+config -device 'virtio-9p-pci,fsdev=test9p,mount_tag=test9p'
+config -fsdev 'local,id=test9p,path=$(pwd),security_model=passthrough'
+
+run
+
+mount-9p test9p /
+ls / | grep 'test-9p.sh\$' > test.out
+
+EOF
+
+if [ "$(cat test.out)" != "test-9p.sh" ]; then
+ echo "$0: unexpected output from listing 9p directory:"
+ cat test.out
+fi
+
+rm test.img test.out