From 415d74d0b8cd7d08a655041396e75841d59b90a4 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 9 Sep 2013 11:58:06 +0100 Subject: [PATCH] tests: Add a regression test that ensure the network can be added. This was only tested before (implicitly) by the rsync test in tests/rsync. It's better to have an explicit test of this functionality. --- Makefile.am | 1 + configure.ac | 1 + tests/network/Makefile.am | 26 ++++++++++++++++++++++++ tests/network/test-network.sh | 37 +++++++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 tests/network/Makefile.am create mode 100755 tests/network/test-network.sh diff --git a/Makefile.am b/Makefile.am index 681270a47..a28f7470f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,6 +41,7 @@ SUBDIRS += tests/events SUBDIRS += tests/parallel SUBDIRS += tests/disks SUBDIRS += tests/mountable +SUBDIRS += tests/network SUBDIRS += tests/lvm SUBDIRS += tests/luks SUBDIRS += tests/md diff --git a/configure.ac b/configure.ac index 069764dd2..263c2621b 100644 --- a/configure.ac +++ b/configure.ac @@ -1710,6 +1710,7 @@ AC_CONFIG_FILES([Makefile tests/mount-local/Makefile tests/mountable/Makefile tests/nbd/Makefile + tests/network/Makefile tests/ntfsclone/Makefile tests/parallel/Makefile tests/protocol/Makefile diff --git a/tests/network/Makefile.am b/tests/network/Makefile.am new file mode 100644 index 000000000..2d47ca13c --- /dev/null +++ b/tests/network/Makefile.am @@ -0,0 +1,26 @@ +# libguestfs +# Copyright (C) 2013 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-network.sh + +TESTS_ENVIRONMENT = $(top_builddir)/run --test + +EXTRA_DIST = \ + $(TESTS) diff --git a/tests/network/test-network.sh b/tests/network/test-network.sh new file mode 100755 index 000000000..be260a88b --- /dev/null +++ b/tests/network/test-network.sh @@ -0,0 +1,37 @@ +#!/bin/bash - +# libguestfs +# Copyright (C) 2013 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. + +# In future we could make this test much more comprehensive, +# especially testing that the network in fact works. For now just +# test that the network device can be added. + +set -e +export LANG=C + +if [ -n "$SKIP_TEST_RHBZ690819_SH" ]; then + echo "$0: test skipped because environment variable is set." + exit 77 +fi + +backend="$(../../fish/guestfish get-backend)" +if [[ "$backend" =~ ^uml ]]; then + echo "$0: test skipped because backend ($backend) is 'uml'." + exit 77 +fi + +../../fish/guestfish --network -a /dev/null run