Commit Graph

517 Commits

Author SHA1 Message Date
Richard W.M. Jones
6d2111990e RHEL 8: tests: Disable daemon tests that require the 'unix' backend. 2020-03-17 10:35:02 +01:00
Richard W.M. Jones
341b3d7f32 RHEL 8: Fix tests for libguestfs-winsupport.
It doesn't let us use guestfish for arbitrary Windows edits.
2020-03-17 10:35:02 +01:00
Richard W.M. Jones
7dd52c8769 RHEL 8: Disable unsupported remote drive protocols (RHBZ#962113).
This disables support for unsupported remote drive protocols:

 * ftp
 * ftps
 * http
 * https
 * tftp
 * gluster
 * iscsi
 * sheepdog
 * ssh

Note 'nbd' is not disabled, and of course 'file' works.

We hope to gradually add some of these back over the lifetime of RHEL 8.
2020-03-17 10:35:02 +01:00
Pino Toscano
09c33f5ed4 tests: regressions: make test-big-heap use a temporary empty file
Newer versions of qemu use file locking for the images by default, and
apparently that does not work with /dev/null.  Since this test just
calls qemu-img to get the format of an empty image, create a temporary
one instead.

(cherry picked from commit 2bf88b102c)
2018-05-01 18:01:39 +01:00
Pino Toscano
3c0a77fbf7 automake2junit.ml: use LargeFile to stat'ing files
While scanning the sources, some of the files (i.e. the cached
appliance) may be larger than 4G, and thus raise EOVERFLOW on 32bit
architectures.

Fixes commit b4e119d8b7.

(cherry picked from commit ba53251ab9)
2018-05-01 17:46:31 +01:00
Pino Toscano
5f70bf7040 automake2junit.ml: ignore symlinks when searching for .trs files
One gnulib test creates a symlink to the same directory, causing our
iteration to read the same test directory over and over, every time
considering it as new level of subdirectory.

As solution (or workaround), when iterating through a directory consider
only regular files, and directories, ignoring any other file type
(symlinks included).

(cherry picked from commit b4e119d8b7)
2018-05-01 17:45:44 +01:00
Mykola Ivanets
079681058e tests: md: test guestfish finds md and LV devices in different combinations
Test guestfish finds:
1. md device created from physical block device and LV,
2. md device created from LVs
3. LV created on md device

raid0 is used for md device because it is inoperable if one of its components is inaccessible so it is easy observable that md device is missing (raid1 in this case will be operable but in degraded state).
2018-01-16 09:49:21 +00:00
Mykola Ivanets
c71e9e9acd tests: md: test guestfish finds logical volume on md device
Test guestfish finds logical volume (LV) created on md device
2018-01-16 09:49:21 +00:00
Richard W.M. Jones
04031269f6 tests: Further instances of $(RPC_CFLAGS). 2018-01-09 12:17:53 +00:00
Richard W.M. Jones
212762c593 Update copyright dates for 2018.
Run the following command over the source:

  perl -pi.bak -e 's/(20[01][0-9])-2017/$1-2018/g' `git ls-files`
2018-01-04 15:30:10 +00:00
Richard W.M. Jones
6407f23e3d tests: Make filtering code in rhbz557655.sh test more liberal.
Because of vagaries in how the debug messages get printed they can get
split over lines:

  gulibguestfs: trace: truncate_size = 0
  estfsd: => truncate_size (0xc8) took 0.00 secs

and the code which filtered out those messages before comparison was
failing.  This makes the code more liberal on how it matches and
filters out these messages.
2017-11-16 22:43:53 +00:00
Richard W.M. Jones
8295e44004 tests: disks: Enhance the test output by naming the test failures.
Makes it easier to find which test is failing.
2017-10-18 14:54:22 +01:00
Richard W.M. Jones
b7f5919aa7 tests: disks: Small adjustment for new libvirt iscsi qemu parameter.
Latest libvirt (3.8, I think) made a very small adjustment to the
format of the generated -drive parameter when using iscsi, from:

  file=iscsi://1.2.3.4:1234/iqn.2003-01.org.linux-iscsi.fedora,

to:

  file=iscsi://1.2.3.4:1234/iqn.2003-01.org.linux-iscsi.fedora/0,

This makes a corresponding change to the test so that both patterns
can be recognized.
2017-10-18 14:54:22 +01:00
Richard W.M. Jones
f397049191 tests: Fix regression test to work with new debug messages from guestfsd.
Commit 0b631d739b changed the debug
message format from the main loop in guestfsd.  This test tried to
filter out these messages when comparing output, but that stopped
working.  The problem was only evident when enabling debugging while
running the tests.
2017-10-17 23:31:36 +01:00
Richard W.M. Jones
9ac5d9859c threads: Add a test. 2017-09-16 23:06:25 +01:00
Richard W.M. Jones
4662c95266 tests: md: Temporarily disable test which requires device name hints.
These are broken after inspection was rewritten, but we should
fix them before 1.38 is released.
2017-09-16 22:27:16 +01:00
Richard W.M. Jones
4c474aba91 tests/qemu: Make the isolation tests more read and write heavy.
Do more reading of the backing file data, and more writes to the
overlay.
2017-09-14 16:58:17 +01:00
Richard W.M. Jones
52be0a6c50 tests/qemu: Split qemu snapshot isolation into 3 tests.
It contained 3 tests before.  It's better to run them in parallel.

Just a simple refactoring, no change.
2017-09-14 16:58:17 +01:00
Richard W.M. Jones
b237418678 tests: Add a regression test for RHBZ#1477623. 2017-08-08 17:50:23 +01:00
Richard W.M. Jones
58ecca0432 tests: discard: Remove dubious use of "/dev/urandom" as a Device parameter.
This API docs don't state that this is permitted.
2017-08-08 17:50:23 +01:00
Richard W.M. Jones
a20859f563 tests: lvm: Make the lvm_set_filter test easier to understand.
No functional change.
2017-07-27 14:39:46 +01:00
Richard W.M. Jones
2cb0413049 gobject: Use TEST_FUNCTIONS framework in tests. 2017-07-10 17:03:19 +01:00
Richard W.M. Jones
e6c89f9631 utils: Rename ‘guestfs-internal-frontend.h’ to ‘guestfs-utils.h’.
The reason it's not just ‘utils.h’ is because Pino is worried that we
might pick up /usr/include/utils.h from a rogue library.
2017-07-10 17:01:59 +01:00
Richard W.M. Jones
5efebd8c7e utils: Split out structs cleanups and printing into common/structs.
These won't be used by the daemon, so interferes with us using
common/utils in the daemon, so they are moved to a different library.
2017-07-10 17:01:59 +01:00
Richard W.M. Jones
c77837e6f2 s390x: tests: 9p: Use virtio-9p-ccw as the 9p device in this test. 2017-05-18 19:02:01 +01:00
Richard W.M. Jones
93af83de85 s390x: tests: regressions: Skip IDE tests on S/390.
IDE interface is not supported.
2017-05-18 19:02:01 +01:00
Matteo Cafasso
f3d3136a17 yara_scan: added API tests
Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2017-05-02 13:42:29 +01:00
Richard W.M. Jones
99ac577a5b tests: Replace test-max-disks with several tests.
Replace the monolithic 'test-max-disks.pl' script with a test program
written in C.  The program is completely equivalent to the old script,
except for the enhancement that it is able to detect if disks are
added to the appliance in the wrong order.

The tests themselves are split out into some shell scripts:

 - test-27-disks: Fully tests 27 disks.
   This is the minimum supported configuration for all backends.

 - test-255-disks: Fully tests 255 disks.
   This is the most disks that libguestfs up to 1.36 supported.

 - test-add-lots-of-disks: Add ‘a lot’ of disks and exit (without
   any further testing).  This is meant to try to exercise > 255
   disk case but without being as slow as a test of the max number
   of disks (which takes ages, even for as few as 4000 disks).

 - test-max-disks: Test the maximum possible number of disks.
   The maximum depends on several factors, notably which backend
   is in use, and the limit on the number of open files.

   ‘test-max-disks’ is a slow test.
2017-04-21 15:20:16 +01:00
Richard W.M. Jones
ee206d7ba8 Use Unicode single quotes ‘’ in place of short single quoted strings throughout.
Only in end-user messages and documentation.  This change was done
mostly mechanically using the Perl script attached below.

I also changed don't -> don’t etc and made some other simple fixes.

See also: https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html

----------
 #!/usr/bin/perl -w

use strict;
use Locale::PO;

my $re = qr{'([-\w%.,=?*/]+)'};

my %files = ();

foreach my $filename ("po/libguestfs.pot", "po-docs/libguestfs-docs.pot") {
    my $poref = Locale::PO->load_file_asarray($filename);

    foreach my $po (@$poref) {
        if ($po->msgid =~ $re) {
            my @refs = split /\s+/, $po->reference;
            foreach my $ref (@refs) {
                my ($file, $lineno) = split /:/, $ref, 2;
                $file =~ s{^\.\./}{};
                if (exists $files{$file}) {
                    push @{$files{$file}}, $lineno;
                } else {
                    $files{$file} = [$lineno];
                }
            }
        }
    }
}

foreach my $file (sort keys %files) {
    unless (-w $file) {
        warn "warning: $file is probably generated\n"; # have to edit generator
        next;
    }
    my @lines = sort { $a <=> $b } @{$files{$file}};

    #print "editing $file at lines ", join (", ", @lines), " ...\n";
    open FILE, "<$file" or die "$file: $!";
    my @all = ();
    push @all, $_ while <FILE>;
    close FILE;

    my $ext = $file;
    $ext =~ s/^.*\.//;

    foreach (@lines) {
        # Don't mess with verbatim sections in POD files.
        next if $ext eq "pod" && $all[$_-1] =~ m/^ /;

        unless ($all[$_-1] =~ $re) {
            # this can happen for multi-line strings, have to edit it
            # by hand
            warn "warning: $file:$_ does not contain expected content\n";
            next;
        }
        $all[$_-1] =~ s/$re/‘$1’/g;
    }

    rename "$file", "$file.bak";
    open FILE, ">$file" or die "$file: $!";
    print FILE $_ for @all;
    close FILE;
    my $mode = (stat ("$file.bak"))[2];
    chmod ($mode & 0777, "$file");
}
2017-04-04 18:47:37 +01:00
Richard W.M. Jones
8c58b62f9d Replace possessive ASCII apostrophe ('s) with Unicode apostrophe (’s).
Only replaced in end-user messages and documentation, not in code,
comments, or anything else that's not end-user visible.

See: https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
2017-03-31 10:38:04 +01:00
Pino Toscano
12c4cc7a6b automake2junit.ml: escape text in message of <skipped>
Escape XML characters in the logs to use as message for <skipped>, so
special characters such as &, ", and < do not make the whole XML
invalid.
2017-03-29 15:57:40 +02:00
Richard W.M. Jones
327caa1f08 test-data: Use another name for boot and root MD devices.
mdadm 4.0 no longer lets you create devices called literally "boot" or
"root", giving a very obscure error message:

https://bugzilla.redhat.com/show_bug.cgi?id=1433575

Work around this by calling them something else.
2017-03-18 10:24:12 +00:00
Richard W.M. Jones
80d3e05483 tests: Add infrastructure for running certain tests as root.
'[sudo] make check-root' is analogous to 'make check-slow'.
2017-03-13 15:01:12 +00:00
Richard W.M. Jones
e5474df1ac Use gnulib set_cloexec_flag in a few places. 2017-03-06 10:52:35 +00:00
Richard W.M. Jones
50f544d971 tests: regressions: Move another test to use $TEST_FUNCTIONS.
Omitted from commit a1b3d8d04b.
2017-02-25 17:12:29 +00:00
Richard W.M. Jones
45e046dac9 tests: Disable some tests so they don't break when ./configure --without-libvirt 2017-02-23 13:59:38 +00:00
Richard W.M. Jones
a7bd499244 tests: regressions: Ignore SIGPIPE in test.
The test tests/regressions/rhbz914931.c works by causing the daemon to
segfault while writing to it.

For reasons unknown, when configured --without-libvirt, this causes
the test to fail receiving SIGPIPE (exit code 141).  We can prevent
this by installing a signal handler to ignore SIGPIPE, so the signal
is converted to EPIPE which the code handles properly.
2017-02-23 13:59:22 +00:00
Richard W.M. Jones
a1b3d8d04b tests: Extend $TEST_FUNCTIONS with predefined functions for skipping tests etc.
Apply this change across all the shell scripts containing tests.

Additionally this defines the environment variables $abs_srcdir,
$abs_builddir, $top_srcdir, $top_builddir, $abs_top_srcdir and
$abs_top_builddir which can now be used throughout test scripts.
2017-02-21 17:23:22 +00:00
Richard W.M. Jones
e66be44016 tests: Add $TEST_FUNCTIONS.
This macro(?) expands to some shell script to source the
tests/test-functions.sh file from its correct location.  The intention
is to use this in all tests, but in this commit only the existing
tests which already include test-functions.sh are modified.
2017-02-21 17:23:22 +00:00
Richard W.M. Jones
51a703775c tests: Rename test-data/test-utils.sh -> tests/test-functions.sh.
This is pure code motion.
2017-02-21 17:23:22 +00:00
Richard W.M. Jones
3feb957c8a 9p: Update test for virtio-pci on aarch64.
Fixes commit 4a9af91e36.
2017-02-20 12:06:14 +00:00
Richard W.M. Jones
74ded0dbc1 RHEL 5: tests: Don't use 'truncate' command.
The coreutils 'truncate' command does not exist in RHEL 5.  Replace
use of this command in tests with the guestfish 'disk-create' command.
2017-02-07 18:51:53 +00:00
Richard W.M. Jones
535e6f5ebb tests/mount-local, tests/parallel: Use srandom (time (NULL) + getpid ()).
If two instances of the test start at exactly the same time, they
would have the same random number seed.
2017-01-27 09:42:01 +00:00
Richard W.M. Jones
db48870cf3 df: Move framework for processing domains in parallel to common/parallel.
Just code motion.
2017-01-26 15:05:47 +00:00
Richard W.M. Jones
f161c9ea57 Rename src/ to lib/ 2017-01-26 15:05:46 +00:00
Richard W.M. Jones
b53cec584d lib: Move utilities to new directory common/utils.
Just code motion.

This commit makes it clearer what is a utility and what is part of the
library.  It also makes it clear that we should rename:

  guestfs-internal-frontend.h -> utils.h
  guestfs-internal-frontend-cleanups.h -> cleanups.h (?)

but this commit does not make that change.
2017-01-26 15:05:46 +00:00
Richard W.M. Jones
88c0ce2397 lib: Share common protocol and errnostring libraries with the library and daemon.
This commit, which is just code motion, moves the common XDR protocol
code (libprotocol) and the common errno handling (liberrnostring) into
libraries which are each built once and shared between the library and
daemon.
2017-01-26 15:05:46 +00:00
Tomáš Golembiovský
c96bcb4e24 tests: rename guestfs-hashsums.sh to test-utils.sh
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2017-01-04 10:41:48 +01:00
Pino Toscano
55bf7de97c Update copyright dates for 2017
Run the following command over the source:

  perl -pi.bak -e 's/(20[01][0-9])-2016/$1-2017/g' `git ls-files`

(Thanks Rich for the perl snippet, as used in past years.)
2017-01-03 16:48:21 +01:00
Richard W.M. Jones
d6c42a6c58 valgrind: Don't use "nested" run scripts.
When TESTS_ENVIRONMENT already uses 'run', the VG variable
doesn't also need to use 'run'.

The specific problem is that if the command contains newlines
then double invocations of the 'run' script fails (in libtool).
ie the following command failed causing errors in check-valgrind:

  $VG virt-builder phony-fedora \
      -v --no-cache --no-check-signature $no_network \
  ...
      --write '/etc/append4:line1
  ' \
  ...
2016-10-11 18:08:49 +01:00