[Libguestfs] [PATCH 1/2] tests: Fix test-launch-race.

Pino Toscano ptoscano at redhat.com
Wed Oct 7 12:03:06 UTC 2015


On Tuesday 06 October 2015 11:48:54 Richard W.M. Jones wrote:
> This test has been broken for a while.  It is meant to test that when
> the appliance cachedir is empty, two simultaneous runs of libguestfs
> (both rebuilding the full appliance) will not cause conflicts, because
> (eg) the locking in either supermin or libguestfs is not working.
> 
> However the test only set $TMPDIR, but the ./run script sets
> $LIBGUESTFS_CACHEDIR which overrides $TMPDIR, so it was simply reusing
> the existing appliance, and hence not testing anything.
> 
> Fix this by clearing $LIBGUESTFS_CACHEDIR.
> 
> Note the test now takes a lot longer to run since it does a full
> appliance rebuild.
> ---
>  tests/protocol/test-launch-race.pl | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/protocol/test-launch-race.pl b/tests/protocol/test-launch-race.pl
> index fadfdbf..6fef1a5 100755
> --- a/tests/protocol/test-launch-race.pl
> +++ b/tests/protocol/test-launch-race.pl
> @@ -1,5 +1,5 @@
>  #!/usr/bin/env perl
> -# Copyright (C) 2010 Red Hat Inc.
> +# Copyright (C) 2010-2015 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
> @@ -32,6 +32,9 @@ exit 77 if $ENV{SKIP_TEST_LAUNCH_RACE_PL};
>  my $tmpdir = tempdir (CLEANUP => 1);
>  $ENV{TMPDIR} = $tmpdir;
>  
> +# Unset LIBGUESTFS_CACHEDIR (set by ./run) since that will override TMPDIR.
> +delete $ENV{LIBGUESTFS_CACHEDIR};
> +

Should $LIBGUESTFS_TMPDIR be unset too, just to not rely solely on that
being overridden by $TMPDIR?

Anyway, patches LGTM.	

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20151007/fa41add0/attachment.sig>


More information about the Libguestfs mailing list