Commit Graph

148 Commits

Author SHA1 Message Date
Richard W.M. Jones
ebc86ae6d7 Fix checksums-out command (RHBZ#895904).
This was broken by the earlier
commit 0306c98d31.

This commit also adds a regression test.
2013-01-21 11:14:56 +00:00
Richard W.M. Jones
2974b5d666 tests/qemu: Don't require LVM for these tests. 2013-01-18 17:23:43 +00:00
Richard W.M. Jones
312d02afe4 tests: Don't construct the guests in parallel.
In automake 1.13, check_DATA is now built in parallel, resulting in it
trying to build 4 or 5 guests in parallel.
2013-01-18 07:13:53 +00:00
Richard W.M. Jones
d1ad89520e tests: Skip windows.img tests if it is zero-sized.
If ntfs-3g is not installed, then tests/guests creates a 'windows.img'
file which is zero-sized.

This is problematical because other tests which use this image will
fail at best, or hit RHBZ#847549 (qemu/virtio-scsi bug) at worst.

Change the tests which use windows.img so they skip if 'windows.img'
has zero size.
2012-12-18 17:35:51 +00:00
Matthew Booth
52cd07a0ac daemon: fix directory outside current root when executing commands
When executing a command, we temporarily chroot, fork and exec the
command, then chroot back. We intentionally don't chdir in the parent
process so that we can 'jailbreak' the chroot later. However, this has
the effect that commands are executed with a current working directory
which is outside the current root.  This unusual state can cause
errors in executed commands which don't anticipate it.

This change does a chdir("/") before executing and command. This
happens inside the fork, so the jailbreak isn't affected in the
parent.
2012-12-13 17:15:01 +00:00
Richard W.M. Jones
585dd44e17 debian: Allow test-disk-labels test to be skipped. 2012-12-13 11:50:08 +00:00
Richard W.M. Jones
52744cc232 tests: charset: Fix broken Makefile.am escaping.
This fixes commit 5a2e320ec9.
2012-12-04 15:21:49 +00:00
Richard W.M. Jones
5a2e320ec9 configure: Add --enable-code-profiling and --enable-code-coverage flags.
These configure flags enable code profiling (with gprof) and code
coverage (with gcov) respectively.

Although this is a nice idea, it's not currently very useful.

Libtool mangles filenames in such a way that gcov cannot locate its
datafiles.

Profiling is of dubious utility with libguestfs which is not CPU-bound
and relies extensively on running external programs (oprofile-like
system profiling that took into account libguestfs + qemu or
libguestfs + qemu + the appliance + filesystem tools *would* be
useful).

Also neither flag will help in capturing data from the appliance.
2012-12-04 14:11:14 +00:00
Richard W.M. Jones
6b5f9221b4 tmpdirs: Make relative TMPDIR (etc) absolute, and check it's a directory (RHBZ#882417).
This fixes commit 1efed122c0.
2012-12-01 12:04:09 +00:00
Richard W.M. Jones
e8ad3efbc4 dist: Add miscellaneous files to the tarball.
Lots of these had been omitted over time.
2012-11-13 15:26:29 +00:00
Richard W.M. Jones
2d89aef897 tests/protocol: Add test-qemudir-launchfail.sh to tarball (but don't run it).
This file was present in git, but missing from the tarball.

Don't actually run the test: it depends on details of how the
appliance is constructed which would fail for old-style appliances.
2012-11-13 15:26:29 +00:00
Richard W.M. Jones
5c44c691f2 tests: Add a parallel launch test.
This is designed to reveal libvirt race conditions such as
bug 875741.

This is a "slow test" so it only runs if you do 'make check-slow'.
2012-11-13 15:26:29 +00:00
Richard W.M. Jones
ee5f18293b tests: Add 'make check-slow' rule to recursively run slow/long-running tests. 2012-11-13 15:26:29 +00:00
Richard W.M. Jones
3636c5fcff tests: Replace 'make extra-tests' with individual tests.
'make extra-tests' was a monolithic set of tests that did all sorts of
things: valgrind, tests over local guests, tests with upstream qemu,
tests with upstream libvirt, tests with the appliance attach method.

This made it hard to perform individual tests, eg. just valgrind
testing.  It was also hard to maintain because the tests were not
located in the same directories as the programs and sometimes
duplicated tests that were run elsewhere.

This commit splits up 'make extra-tests' into 5 separate targets:

 make check-valgrind              # run a subset of tests under valgrind
 make check-valgrind-local-guests # test under valgrind with local guests
 make check-with-appliance        # test with attach-method == appliance
 make check-with-upstream-qemu    # test with an alternate/upstream qemu
 make check-with-upstream-libvirt # test with an alternate/upstream libvirt

(You can also still run 'make extra-tests' which is now simply
a rule that runs the above 5 targets in order).

This replaces everything that was in the tests/extra directory,
so that has now gone.
2012-11-13 15:26:29 +00:00
Richard W.M. Jones
c4a3ea066b extra-tests: Add $(libvirt_ro_uri) substitution to configure.
This is essentially just code motion.
2012-11-13 15:26:29 +00:00
Richard W.M. Jones
765d14dc05 Define whole valgrind command (as @VG@) in the configure script.
This is mostly just code motion, but it also changes the default
location where valgrind.log is written to be the top build directory
(instead of tests/extra/valgrind.log).
2012-11-13 15:26:29 +00:00
Richard W.M. Jones
e884abfd06 extra-tests: Move valgrind suppressions file to top source directory.
This is just code motion.
2012-11-12 15:49:08 +00:00
Richard W.M. Jones
2d220f5da2 tools: Modify existing tools to use guestfs_{push,pop}_error_handler.
This is a shorter and more convenient way to disable errors
temporarily across calls.
2012-11-09 19:51:09 +00:00
Richard W.M. Jones
1efed122c0 lib: Rework temporary and cache directory code.
New APIs: set-tmpdir, get-tmpdir, set-cachedir, get-cachedir.

The current code has evolved over time and has a number of problems:

(a) A single environment variable ($TMPDIR) controls the
location of several directories.

(b) It's hard for the library user to predict which directory
libguestfs will use, unless the user simulates the same internal steps
that libguestfs performs.

This commit fixes these issues.

(a) Now three environment variables control the location of all small
temporary files, and the appliance cache:

  For temporary files: $LIBGUESTFS_TMPDIR or $TMPDIR or /tmp.

  For the appliance cache: $LIBGUESTFS_CACHEDIR or $TMPDIR or /var/tmp.

The user can also set these directories explicitly through API calls
(guestfs_set_tmpdir and guestfs_set_cachedir).

(b) The user can also retrieve the actual directories that libguestfs
will use, by calling guestfs_get_tmpdir and guestfs_get_cachedir.
These functions are also used internally.

This commit also:

 - reworks the internal tmpdir code

 - removes the internal (undocumented) guestfs_tmpdir call (replacing
   it with calls to the documented guestfs_get_tmpdir API instead)

 - changes the ./run script to set LIBGUESTFS_TMPDIR and
   LIBGUESTFS_CACHEDIR

 - adds a test

 - fixes a few places like libguestfs-make-fixed-appliance which
   depended on $TMPDIR
2012-11-09 13:11:53 +00:00
Richard W.M. Jones
f5194e6b0a tests: Allow more tests to be skipped.
Specifically tests which involve btrfs, because btrfs is
currently broken upstream (RHBZ#863978).
2012-10-30 12:56:06 +00:00
Richard W.M. Jones
2dab72794e valgrind: Add suppression for memory leak in libdl:_dl_init function. 2012-10-18 17:43:38 +01:00
Richard W.M. Jones
c164cc9bea lib: Add a test for environment parsing functions.
This updates commit 9466060201.
2012-10-15 16:35:13 +01:00
Richard W.M. Jones
626ca8e74f valgrind: Fix FUSE memory leak suppression. 2012-10-14 12:54:02 +01:00
Richard W.M. Jones
33f49d85c2 tests: Fix test-qemudie-* so they re-adds the disk on second launch.
Commit ed7fda161e changed the
way that the drives are handled across appliance shutdowns.

Previously during the following sequence of calls:

  create the handle
  add drive(s)
  launch
  kill subprocess
  launch

the added drives are still in the handle at the second launch.

After the above commit, the added drives are removed from the handle,
which means the second launch happens with no drives (which could be
an error).

This was never actually defined either way, so in this case fix the
test to re-add the drive before the second launch.

Since hotplugging was added, it isn't really feasible to return to the
original semantics, since users might remove drives, in which case we
have lost information about those drives so we cannot restore them on
the second launch.

NOTE: PLEASE CALLERS DON'T DO THIS!  Always use a new handle for each
launch of the appliance.
2012-10-10 16:46:35 +00:00
Richard W.M. Jones
0a85fbc946 Add support for hotplugging (removing disks).
New API: remove-drive.

Note because of a bug in fuser, this only works with psmisc >= 22.20.

This also updates the hotplugging tests.
2012-10-09 09:45:42 +01:00
Richard W.M. Jones
18b7f09f36 Add support for hotplugging (adding disks) to the libvirt attach-method.
When libvirt is used, we can allow disks to be hotplugged.
guestfs_add_drive can be called after launch to hot-add a disk.

When a disk is hot-added, we first ask libvirt to add the disk to the
appliance, then we make an internal call into the appliance to get it
to wait for the disk to appear (ie. udev_settle ()).

Hot-added disks are tracked in the g->drives array.

This also adds a test.
2012-10-08 20:04:53 +01:00
Richard W.M. Jones
7786d56db8 launch: Add add_drive 'label' option.
New API: list-disk-labels

Allow the user to pass an optional disk label when adding a drive.

This is passed through to qemu / libvirt using the disk serial field,
and from there to the appliance which exposes it through udev,
creating a special alias of the device /dev/disk/guestfs/<label>.
Partitions are named /dev/disk/guestfs/<label><partnum>.

virtio-blk and virtio-scsi limit the serial field to 20 bytes.  We
further limit the name to maximum 20 ASCII characters in [a-zA-Z].

list-devices and list-partitions are not changed: these calls still
return raw block device names.  However a new call, list-disk-labels,
returns a hash table allowing callers to map between disk labels, and
block device and partition names.

This commit also includes a test.
2012-10-08 20:04:47 +01:00
Richard W.M. Jones
013fb91a69 tests: Fix rhbz690819.sh to skip when attach-method is libvirt.
This sets the iface parameter (implicitly), which is not supported yet
by the libvirt backend.

This updates commit 8e198dc1c5.
2012-10-06 23:15:48 +01:00
Richard W.M. Jones
b44d82ec8d Revert "test-launch-race: Add SELinux label to $TMPDIR."
Because RHBZ#860235 has been fixed in selinux-policy 3.11.1-25.fc18.

This reverts commit 7fc838cca3.
2012-09-26 12:04:02 +01:00
Richard W.M. Jones
7fc838cca3 test-launch-race: Add SELinux label to $TMPDIR.
This is a temporary workaround for
https://bugzilla.redhat.com/show_bug.cgi?id=860235
which can be removed once this bug is fixed.
2012-09-25 12:16:25 +01:00
Wanlong Gao
45d459f402 Fix tests/bigdirs/test-big-dirs.pl to use mke2fs
Let tests/bigdirs/test-big-dirs.pl uses mke2fs to create small
inode ratio files.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>

RWMJ:
 - Fix invocation of mke2fs with optional arguments.
 - Run the test to check it works.
2012-09-24 16:41:07 +01:00
Richard W.M. Jones
a297a9348f tests/bigdirs: Add empty TESTS= rule.
Without this empty rule, automake doesn't generate the rest of the
testing infrastructure, so you can't enable the test yourself by doing
'make check TESTS=test-big-dirs.pl'.
2012-09-24 16:40:46 +01:00
Richard W.M. Jones
09c372ea25 test-launch-race: Add comment. 2012-09-22 10:47:11 +01:00
Richard W.M. Jones
aeb2f76a58 extra-tests: Re-run the tests against upstream libvirt. 2012-09-18 12:52:37 +01:00
Richard W.M. Jones
157b5006db extra-tests: Clean up some comments about the upstream qemu tests. 2012-09-18 12:48:36 +01:00
Richard W.M. Jones
7e4b197cb6 extra-tests: Add scripts used by these tests to EXTRA_DIST. 2012-09-18 12:47:50 +01:00
Richard W.M. Jones
cb13ffe190 syntax: Remove definitions of O_CLOEXEC, except in examples (thanks Jim Meyering).
The gnulib <fcntl.h> replacement header will now define this symbol if
it's not defined already.
2012-09-17 10:07:31 +01:00
Richard W.M. Jones
e6bd0b87eb extra-tests: Write a qemu wrapper script on the fly.
Passing the $upstream_qemu environment variable is not reliable when
libvirt is involved: Environment variables are passed to the first
instance of the session libvirtd, but because libvirt reuses the
session libvirtd, subsequent environment variable settings are lost
(this is filed as RHBZ#856619).

Bypass all of this by writing a custom qemu-wrapper.sh which contains
the hard-coded values we want.
2012-09-15 17:36:15 +01:00
Richard W.M. Jones
2fd51c28fd extra-tests: Rerun extra tests with regular appliance attach method.
If libvirt is being used as the backend, rerun all the extra-tests
again using the regular appliance backend.
2012-09-15 14:41:06 +01:00
Richard W.M. Jones
509dd90c43 extra-tests: The upstream qemu test now reruns all the extra tests. 2012-09-15 14:41:06 +01:00
Richard W.M. Jones
eeb0c598ec extra-tests: Fix libvirt URI so we can run tests with libvirt attach-method. 2012-09-15 14:41:06 +01:00
Richard W.M. Jones
2cac8d490e syntax: Remove trailing whitespace.
Found by 'make syntax-check'.
2012-09-15 13:36:02 +01:00
Richard W.M. Jones
6361810b53 syntax: Replace test == with = or -eq as appropriate.
Found by 'make syntax-check'.
2012-09-15 13:21:55 +01:00
Richard W.M. Jones
b0cefb417d syntax: Use STREQ/STRNEQ in place of strcmp.
Found by 'make syntax-check'.
2012-09-15 13:11:45 +01:00
Richard W.M. Jones
5b02c8d0bc test-9p: Disable this test with libvirt.
This test doesn't work with sVirt if SELinux is enforcing, because
qemu won't be able to access the 9p-exported directory on the host.
2012-09-14 16:46:37 +01:00
Richard W.M. Jones
81c682f129 extra-tests: Don't use $QEMU as a variable.
Since 'QEMU' is set (overwritten) by the autoconf-generated Makefile,
this test would always test installed qemu, not upstream qemu,
making it pretty useless.  Use another name for this variable.
2012-09-05 13:56:34 +01:00
Richard W.M. Jones
d754f4a5a3 tests/rsync: Allow rsync test to be skipped by setting SKIP_TEST_RSYNC_SH=1. 2012-08-31 19:06:38 +01:00
Richard W.M. Jones
87cb154976 tests/mount-local: Link test program with gnulib. 2012-08-31 10:26:40 +01:00
Richard W.M. Jones
2d6bf3ba70 tests/big-dirs: Don't run this test by default. 2012-08-30 08:58:00 +01:00
Olaf Hering
044c5b26d7 remove ulockmgr from fuse LDFLAGS
libguestfs fails to build with --enable-fuse on openSuSE 11.4 and
earlier because the included fuse version does not include
libulockmgr.so. configure already used pkgconfig to retrieve the correct
CFLAGS, so there is no need to hardcode -lulockmgr.
With this change the build succeeds again.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2012-08-29 16:42:51 +01:00