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

Richard W.M. Jones rjones at redhat.com
Tue Oct 6 10:48:54 UTC 2015


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};
+
 my $pid = fork();
 die ("fork failed: $!") if ($pid < 0);
 
-- 
2.5.0




More information about the Libguestfs mailing list