From 834747a85d80ce02e9deca32be89199c10cd74fd Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 14 Sep 2012 14:42:24 +0100 Subject: [PATCH] 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 --- .gitignore | 2 -- Makefile.am | 1 + run.in | 7 ++++++- src/guestfs.pod | 12 ++++++++++++ tmp/.gitignore | 2 ++ 5 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 tmp/.gitignore diff --git a/.gitignore b/.gitignore index f809379b2..3fd4e0a88 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/Makefile.am b/Makefile.am index e8fd47e81..fdc4f38c0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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. diff --git a/run.in b/run.in index 413d7f7b8..6eb0e0b12 100644 --- a/run.in +++ b/run.in @@ -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" diff --git a/src/guestfs.pod b/src/guestfs.pod index aee836085..45c81db57 100644 --- a/src/guestfs.pod +++ b/src/guestfs.pod @@ -3287,6 +3287,18 @@ will work with libguestfs. Tests. +=item C + +Used for temporary files when running the tests (instead of C +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 Command line tools written in Perl (L and many others). diff --git a/tmp/.gitignore b/tmp/.gitignore new file mode 100644 index 000000000..996d0c5da --- /dev/null +++ b/tmp/.gitignore @@ -0,0 +1,2 @@ +/.guestfs-* +/guestfs.*