build: Create new 'tmp' directory for tests.

Having a separate directory means:

(1) It's easy to clean up orphaned temporary files, the appliance,
    etc.

(2) You can put an SELinux label on this directory so that qemu can
    write to it when you're using sVirt and SELinux is enforcing:

    chcon --reference=/tmp tmp
This commit is contained in:
Richard W.M. Jones
2012-09-14 14:42:24 +01:00
parent aa9e0057b1
commit 834747a85d
5 changed files with 21 additions and 3 deletions

2
.gitignore vendored
View File

@@ -147,8 +147,6 @@ Makefile.in
/gobject/Guestfs-1.0.typelib
/gobject/guestfs-gobject*.c
/gobject/guestfs-gobject*.h
/.guestfs-*
/guestfs.*
/guestfs-release-notes.1
/guestfsd-in-wine.log
/haskell/Bindtests

View File

@@ -151,6 +151,7 @@ EXTRA_DIST = \
libtool-kill-dependency_libs.sh \
logo/fish.svg logo/fish.png \
m4/.gitignore \
tmp/.gitignore \
update-bugs.sh
# The website.

7
run.in
View File

@@ -45,7 +45,12 @@ b=@abs_builddir@
# Set TMPDIR so the appliance doesn't conflict with globally
# installed libguestfs.
export TMPDIR="$b"
#
# We set it to a subdirectory ('tmp') so that we can label this
# subdirectory to make libvirt + sVirt + SELinux enforcing work.
#
# chcon --reference=/tmp tmp
export TMPDIR="$b/tmp"
# Set local environment relative to this script.
export LIBGUESTFS_PATH="$b/appliance"

View File

@@ -3287,6 +3287,18 @@ will work with libguestfs.
Tests.
=item C<tmp>
Used for temporary files when running the tests (instead of C</tmp>
etc). The reason is so that you can run multiple parallel tests of
libguestfs without having one set of tests overwriting the appliance
created by another.
If you are using libvirt + sVirt with SELinux enforcing, then you have
to label this directory:
chcon --reference=/tmp tmp
=item C<tools>
Command line tools written in Perl (L<virt-win-reg(1)> and many others).

2
tmp/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/.guestfs-*
/guestfs.*