[libvirt] tweak a format string and add a test
Daniel P. Berrange
berrange at redhat.com
Mon Mar 2 20:00:15 UTC 2009
On Mon, Mar 02, 2009 at 07:38:50PM +0100, Jim Meyering wrote:
> I'm about to commit these (like what I already posted,
> but now the test kills libvirtd):
>
> >From 944052f2287f1a07034be16ea08d620c55eecd6e Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Mon, 2 Mar 2009 14:46:20 +0100
> Subject: [PATCH 1/2] virsh: tweak a format string to avoid emitting trailing space
>
> * src/virsh.c (cmdNetworkList): Change format not to right-pad
> with spaces, as that would have required a trailing blank in
> an expected output file.
> ---
> src/virsh.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/virsh.c b/src/virsh.c
> index 8ae79c5..c23fdda 100644
> --- a/src/virsh.c
> +++ b/src/virsh.c
> @@ -2596,7 +2596,7 @@ cmdNetworkList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
> qsort(&inactiveNames[0], maxinactive, sizeof(char*), namesorter);
> }
> }
> - vshPrintExtra(ctl, "%-20s %-10s %-10s\n", _("Name"), _("State"), _("Autostart"));
> + vshPrintExtra(ctl, "%-20s %-10s %s\n", _("Name"), _("State"), _("Autostart"));
> vshPrintExtra(ctl, "-----------------------------------------\n");
>
> for (i = 0; i < maxactive; i++) {
> --
> 1.6.2.rc1.285.gc5f54
ACK, we already did the same for the 'list' command.
I really don't like these kind of tests in here - tests of the
live drivers should be part of a separate integration test suite
bundle, that's independant of main code releases.
> +
> +libvirtd --config=conf > libvirtd-log 2>&1 & pid=$!
> +sleep 1
> +
> +url="qemu:///session?socket=@$sock_dir/libvirt-sock"
> +virsh -c "$url" \
> + 'net-define net.xml; net-destroy N; net-list --all' > out 2>&1 \
> + || fail=1
Calling 'net-destroy' doesn't make sense because the network
hasn't been started here yet, merely defined as an inactive
config. Starting the network would not be a thing you want to
do in the test suite, because it may mess with your host networking.
The virtual network driver shouldn't be usable under the 'qemu:///session'
instance either, because it needs to be running privileged.
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list