32 Commits

Author SHA1 Message Date
Richard W.M. Jones
72cfaff5c5 Update copyright dates for 2025
Automated using this command:

perl -pi.bak -e 's/(20[012][0-9])-20[12][01234]/$1-2025/g' `git ls-files`
2025-02-16 17:00:46 +00:00
Richard W.M. Jones
e2c7bddf10 Update copyright dates for 2023
Run this command across the source:

  perl -pi.bak -e 's/(20[012][0-9])-20[12][012]/$1-2023/g' `git ls-files`

and remove changes to po{,-docs}/*.po{,t} (these will be regenerated
later when we run 'make dist').
2023-02-07 10:50:48 +00:00
Richard W.M. Jones
6d32773e81 tests: Run the tests in parallel.
Before this change the tests ran in about 12m34 and afterwards in
about 6m20, although the real change is more dramatic if you only run
tests from the tests/ subdirectory (as language tests still run serially).

This breaks valgrinding for now, which I intend to fix properly later.
2021-03-18 16:28:55 +00:00
Richard W.M. Jones
82493579f3 Port libguestfs to use pcre2 instead of pcre.
https://bugzilla.redhat.com/show_bug.cgi?id=1938982
2021-03-16 11:24:37 +00:00
Richard W.M. Jones
0e17236d7d Update copyright dates to 2020. 2020-03-06 19:32:32 +00:00
Pino Toscano
9d1fc91cca build: stop using GUESTFS_WARN_DEPRECATED
This is no more used now, as compiler deprecation warnings are triggered
by default.
2019-04-23 18:08:19 +02:00
Richard W.M. Jones
05d4fcb64d Update copyright dates for 2019.
This command run over the source:

perl -pi.bak -e 's/(20[01][0-9])-2018/$1-2019/g' `git ls-files`
2019-01-08 11:58:30 +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
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
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
d5a8f82887 Use 'const' for stack integers where possible.
May improve optimization possibilities in a few cases.
2016-07-26 10:43:45 +01:00
Richard W.M. Jones
fdfedcb4ef Use 'error' function for fprintf followed by exit.
Like with the previous commit, this replaces instances of:

  if (something_bad) {
    fprintf (stderr, "%s: error message\n", guestfs_int_program_name);
    exit (EXIT_FAILURE);
  }

with:

  if (something_bad)
    error (EXIT_FAILURE, 0, "error message");

(except in a few cases were errno was incorrectly being ignored, in
which case I have fixed that).

It's slightly more complex than the previous commit because we must be
careful to:

 - Remove the program name (since error(3) prints it).

 - Remove any trailing \n character from the message.

Candidates for replacement were found using:

  pcregrep --buffer-size 10M -M '\bfprintf\b.*\n.*\bexit\b' `git ls-files`
2016-04-04 17:57:38 +01:00
Richard W.M. Jones
129e4938ba Use 'error' function consistently throughout.
Wherever we had code which did:

  if (something_bad) {
    perror (...);
    exit (EXIT_FAILURE);
  }

replace this with use of the error(3) function:

  if (something_bad)
    error (EXIT_FAILURE, errno, ...);

The error(3) function is supplied by glibc, or by gnulib on platforms
which don't have it, and is much more flexible than perror(3).  Since
we already use error(3), there seems to be no downside to mandating it
everywhere.

Note there is one nasty catch with error(3): error (EXIT_SUCCESS, ...)
does *not* exit!  This is also the reason why error(3) cannot be
marked as __attribute__((noreturn)).

Because the examples can't use gnulib, I did not change them.

To search for multiline patterns of the above form, pcregrep -M turns
out to be very useful:

  pcregrep --buffer-size 10M -M '\bperror\b.*\n.*\bexit\b' `git ls-files`
2016-04-04 13:14:26 +01:00
Pino Toscano
fcf1884932 tests: reduce sizes of scratch disks to 2 GB
1 GB should be enough to create a btrfs filesystem, even with 64K page
size; hence, make the /dev/sda and /dev/sdb test devices smaller so
there is less space taken during the test run.

Followup of commit 8ffad75e5b and
commit 9e9b648770.
2016-02-08 17:22:48 +00:00
Richard W.M. Jones
8ffad75e5b tests: Increase the size of the /dev/sda and /dev/sdb test devices.
Previously these were rather small - just 500 MB.  This is too small
to create a btrfs device on aarch64 (where page size may be 64K), and
barely enough even on x86-64.  This change makes both these devices
10 GB, and adjusts a few tests so they continue to pass.
2016-02-03 17:26:34 +00:00
Richard W.M. Jones
307c83177c Update copyright dates for 2016.
Run the following command over the source:

  perl -pi.bak -e 's/(20[01][0-9])-2015/$1-2016/g' `git ls-files`
2016-01-02 21:19:51 +00:00
Richard W.M. Jones
dc1d0880b0 tests: Move the tests/data and tests/guests directories to test-data.
Create a new top-level directory called test-data, which will carry
all the test data which is large and/or shared between multiple tests.

There are actually several new subdirectories created:

test-data/binaries: The pre-built binary and library files for random
architectures that we use to test various architecture detection
features (was part of tests/data).

test-data/blank-disks: The blank disks which are used for disk format
detection (was part of tests/data).

test-data/files: Other miscellaneous test files from tests/data that
are not included in the above.

test-data/phony-guests: The phony guests (was tests/guests).

test-data: The top-level directory builds the 'test.iso' image file
that is used for testing the C API and in miscellaneous other tests.
2015-10-30 16:07:32 +00:00
Richard W.M. Jones
c5800dc97d Update copyright dates for 2015. 2015-01-17 09:08:15 +00:00
Pino Toscano
349536bf70 tests/c-api: add a way to skip test when host and appliance differ
Add a IfNotCrossAppliance prereq for tests, so a test using it can only
be run when the appliance is a copy of the running host system; this can
help marking tests which run stuff (usually built in the host) inside
the appliance.
2014-10-23 19:03:12 +02:00
Pino Toscano
4a4256b807 tests: make the scratch disk used for scratch much larger
50M can be not enough when uploading various copies of unstripped
static binaries from the system, which can fill up such a small disk.
2014-08-19 17:11:05 +02:00
Pino Toscano
fef0881b3a tests: c-api: do not crash w/ missing hash entry
If an hash does not have the requested key, just error out cleanly
instead of crashing when trying to compare a null string.
2014-08-08 14:56:27 +02:00
Richard W.M. Jones
6c971faecf Update copyright dates for 2014. 2014-01-02 16:53:34 +00:00
Richard W.M. Jones
8b43767b7c tests: c-api: Fix device name comparison when using User-Mode Linux.
This updates commit 858d6e7176.
2013-08-12 14:27:01 +01:00
Richard W.M. Jones
0f7642674b tests/c-api: Use guestfs_add_drive_scratch API to create scratch drives.
Replaces the old custom code for making and deleting the drives.
2013-07-20 16:31:42 +01:00
Richard W.M. Jones
8a3ecfc04e tests/c-api: Remove 'GETKEY:' hack since it's no longer used anywhere. 2013-07-20 16:31:42 +01:00
Richard W.M. Jones
5faba45fe1 tests/c-api: Various code refactorings.
- Don't use fixed names for the disks.  This will allow us to
  parallelize this test.

- Add a new "GETKEY:<key>" String parameter which can retrieve keys
  from the handle.  The temporary disk names are stored as keys.

- Don't test the close callback.  However this uses the close callback
  mechanism to delete the temporary disks, and in any case close
  callbacks are well tested by the language binding tests.

- The generated code now produces a static array of tests (instead of
  a 'perform_tests' function), making it possible to parallelize.
2013-05-01 11:13:31 +01:00
Richard W.M. Jones
f003c50c52 tests/c-api: Remove global guestfs handle.
This will allow us to parallelize these tests.
2013-05-01 09:34:39 +01:00
Richard W.M. Jones
76950a0e8d tests/c-api: Warn about deprecated functions in main program.
And replace deprecated guestfs_set_close_callback with
non-deprecated guestfs_set_event_callback.
2013-05-01 09:33:51 +01:00
Richard W.M. Jones
9d5236d73c tests/c-api: Factor out common init_* into separate functions. 2013-05-01 09:09:55 +01:00
Richard W.M. Jones
b7da435003 tests/c-api: Allow FileIn paths to be prefixed by "$srcdir".
Since tests involving FileIn will often wish to read from local files,
it makes sense that they would want to open files in $srcdir.

Therefore allow such paths to be prefixed by "$srcdir" which is
substituted at run time by the same named environment variable (set by
automake).

This fixes separated builds in tests/c-api directory.
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
288a24eebe tests: Split C API tests into regular C file + generated tests file. 2013-04-13 07:26:46 +01:00