[libvirt] [PATCH] tests: Add URI precedence checking

Daniel P. Berrange berrange at redhat.com
Thu Aug 22 11:12:49 UTC 2013


On Thu, Aug 22, 2013 at 12:58:46PM +0200, Martin Kletzander wrote:
> Commit a0b6a36f is fixing what commit abfff210 broke, so to avoid having
> to deal with this issue again, I present you The "uriprecedencetest".
> 
> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
> ---
>  tests/Makefile.am       |  2 ++
>  tests/uriprecedencetest | 77 +++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 79 insertions(+)
>  create mode 100755 tests/uriprecedencetest
> 
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 09144d6..419db8b 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -98,6 +98,7 @@ EXTRA_DIST =		\
>  	storagevolxml2xmlout \
>  	sysinfodata \
>  	test-lib.sh	\
> +	uriprecedencetest \
>  	vmx2xmldata \
>  	xencapsdata \
>  	xmconfigdata \
> @@ -235,6 +236,7 @@ test_scripts +=				\
>  	read-bufsiz			\
>  	read-non-seekable		\
>  	start				\
> +	uriprecedencetest		\

Can you add a 'virsh-' prefix on this so we keep some grouping
of virsh tests

>  	vcpupin				\
>  	virsh-all			\
>  	virsh-optparse			\
> diff --git a/tests/uriprecedencetest b/tests/uriprecedencetest
> new file mode 100755
> index 0000000..9515e63
> --- /dev/null
> +++ b/tests/uriprecedencetest
> @@ -0,0 +1,77 @@
> +#!/bin/sh
> +
> +: ${srcdir=.}
> +. $srcdir/test-lib.sh
> +
> +# This test checks if virsh obeys the proper precedence of different
> +# URI settings
> +test_intro "uriprecedencetest"
> +
> +virsh_bin="$abs_top_builddir/tools/virsh"
> +counter=1
> +ret=0
> +
> +tmpdir="$(mktemp -d)"
> +cleanup_() { rm -rf "$tmpdir"; }

IIIUC,  test-lib.sh is creating a temporary directory in which
the test is run. So I think we can just use CWD for our state
files, rather than creating a new tmpdir.

> +unset LIBVIRT_DEFAULT_URI
> +unset VIRSH_DEFAULT_CONNECT_URI
> +bad_uri="test:///default?bad_uri"
> +good_uri="test:///default?good_uri"

Ahh, clever idea to invent custom uris :-)

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list