Commit Graph

48 Commits

Author SHA1 Message Date
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
0e784824e8 daemon: Add zstd support to guestfs_file_architecture
This is required so we can determine the file architecture of
zstd-compressed Linux kernel modules as used by OpenSUSE and maybe
other distros in future.

Note that zstd becomes a required package, but it is widely available
in current Linux distros.

The package names come from https://pkgs.org/download/zstd and my own
research.
2022-08-09 19:04:41 +01:00
Laszlo Ersek
3221133140 tests: add LUKS-on-LVM test
Create a new (fake) Fedora disk image with two partitions. /dev/sda1 is
the boot partition as usual, /dev/sda2 is used as an LVM PV. The VG has
four LVs, Root and LV1 through LV3.

Each LV holds a LUKS device (with a different key). Each decrypted LUKS
device holds an ext2 filesystem, with "/dev/mapper/Root-luks" holding the
root filesystem.

Each filesystem has a dedicated label (ROOT, LV1, LV2, LV3).

In the test case, run guestfish in inspector mode, twice.

In the first invocation, provide the LUKS passphrases by LV name. Also
specific to the first invocation, fetch the LUKS UUIDs by LV name.

In the second invocation, provide the LUKS passphrases by UUID.

In both invocations, after decryption, check the filesystem labels, the
/dev/mapper/* names generated for the decrypted LUKS block devices, and
the existence of "/etc/fedora-release" on the root filesystem.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1658126
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220223162120.16729-3-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2022-02-28 13:12:21 +01:00
Laszlo Ersek
39a5bb6fda tests: rename "luks" to "lvm-on-luks"
Clarify that our current usage of "luks" stands for "lvm-on-luks" (IOW,
that the decrypted LUKS devices are Physical Volumes for LVM).

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1658126
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220223162120.16729-2-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2022-02-28 13:11:56 +01:00
Richard W.M. Jones
0b223a2877 test-data: Replace deprecated luks_open with cryptsetup_open.
The two calls are identical, so this simply avoids a deprecation
warning.
2021-05-27 17:21:16 +01:00
Richard W.M. Jones
2216ab2e32 tests: Prefer xorriso over genisoimage to generate test.iso
This Debian page explains the upstream situation:
https://wiki.debian.org/genisoimage

On Fedora, xorriso provides a compatibility program called "mkisofs".
However this is not present in Debian.  Hence the choice to look for
the program called "xorrisofs".
2021-03-30 13:57:30 +01:00
Richard W.M. Jones
42e5e7cfdb test-data/phony-guests: Fix phony RPM database, fix virt-inspector test.
libguestfs 1.45.3 now reads the RPM database using librpm, which means
our old phony database created by db_dump can no longer work.  Instead
provide a real (but very minimal) sqlite database.

This commit also fixes the virt-inspector test since the RPM database
contents are now different.
2021-03-29 17:26:43 +01:00
Richard W.M. Jones
0e17236d7d Update copyright dates to 2020. 2020-03-06 19:32:32 +00:00
Richard W.M. Jones
815eab8a66 tests: Use explicit backing format for all backing disks.
Libvirt 6.0 now requires that every disk in the backing chain has an
explicit backing format.  For example this will be rejected by
libvirt:

  qemu-img create -f qcow2 -b backing-disk disk.qcow2

with the error:

  Original error from libvirt: Requested operation is not valid:
  format of backing image 'backing-disk' of image 'disk.qcow2' was not
  specified in the image metadata (See
  https://libvirt.org/kbase/backing_chains.html for troubleshooting)
  [code=55 int1=-1]

Instead you have to use the -F option to specify the format, eg:

  qemu-img create -f qcow2 -b backing-disk -F raw disk.qcow2
2020-02-06 16:06:19 +00:00
Richard W.M. Jones
85c99edec1 v2v: Remove virt-v2v.
It has moved to a new repository:
https://github.com/libguestfs/virt-v2v
2019-11-13 12:49:55 +00:00
Pino Toscano
8bbf8e8900 test-data: switch away from deprecated APIs
Adapt make-fedora-img.pl to not use deprecated APIs anymore:
- set_e2uuid -> set_uuid
- txz_in -> tar_in + compress:xz

This causes no changes in the generated test images.
2019-05-02 18:34:18 +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
ed3ff51df9 test-data: Allow tests to be run when Btrfs is not available.
Create the fedora-btrfs.img as an empty file.

The only place this is used explicitly is tests/mountable/
test-mountable-inspect.sh, but that test already skips if !btrfs.

Also this is used via guests-all-good.xml, but the script that creates
this XML skips the file if it has zero size.
2018-11-20 15:40:10 +00:00
Richard W.M. Jones
df54c75d4c test-data: Fix indentation in make-fedora-img.pl.
Only a whitespace change.
2018-11-14 18:20:24 +00:00
Richard W.M. Jones
16e64b8988 test-data/phony-guests: Add Fedora LUKS phony image for testing.
This is not added to guests-all-good since it cannot be used in
automated tests -- a password must be supplied.
2018-07-26 12:02:59 +01:00
Richard W.M. Jones
3a87c4bb44 test-data/phony-guests: Add comment to Makefile above Fedora btrfs image.
Fixes commit 754e819438.
2018-07-18 13:15:47 +01: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
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
c72be578c1 debian: Old qemu-img does not support -f raw -o preallocation=off
The old version of qemu-img available in Debian 8 doesn't support the
preallocation option for raw format.  However this doesn't matter
because the default is preallocation=off (ie. sparse) for old and new
versions of qemu-img so we can just omit this parameter.

Fixes commit 53317e3f07
and commit fa83b47876
and commit 74ded0dbc1.
2017-02-23 13:52:25 +00:00
Richard W.M. Jones
cf85da5b7e v2v: Add fake test-data/fake-virt-tools/pnp_wait.exe for testing.
Analogous to commit f5c9357c8e.
2017-02-23 09:10:15 +00:00
Richard W.M. Jones
f5c9357c8e v2v: Add fake test-data/fake-virt-tools/vmdp.exe for testing. 2017-02-22 21:16:07 +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
53317e3f07 test-data: Use qemu-img instead of guestfish to create blank disks.
Since this step runs during make (not make check), guestfish
hasn't been built yet.

Fixes commit fa83b47876
and commit 74ded0dbc1.
2017-02-11 09:07:09 +00:00
Richard W.M. Jones
fa83b47876 test-data: Use ./run script to run 'guestfish disk-create'.
Commit 74ded0dbc1 changes existing calls
to truncate to run 'guestfisk disk-create' instead.  However this
fails if guestfish has not been installed.  By using the ./run script,
we can use the just-built guestfish instead.

Fixes commit 74ded0dbc1.
2017-02-10 22:41:55 +00:00
Richard W.M. Jones
0a8f95a222 v2v: ova: Further fix test cases.
Updates commit 7461a8fab1.
Fixes and partly reverts commit 8f91d3a9b0.
2017-02-10 12:56:08 +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
Tomáš Golembiovský
8f91d3a9b0 v2v: ova: don't extract files from OVA if it's not needed
We don't have to always extract all files from the OVA archive. The OVA,
as defined in the standard, is plain tar. We can work directly over the
tar archive if we use correct 'offset' and 'size' options when defining
the backing file for QEMU. This puts much lower requirement on available
disk space.

Since the virt-v2v behaviour for OVA input now depends on QEMU version
available this affects some of the tests. Expected result of the
affected also has to depend on the QEMU used thus such tests will have
two *.expected files.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2017-02-04 15:13:29 +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
c08788ef1b filearch: Add s390 and s390x detection and tests.
Unfortunately I was unable to build s390 binaries since multilib was
dropped in Fedora 24 on s390x.  Going from the source of the 'file'
command it seems as if it prints "32-bit" (the architecture is really
31 bit).
2016-11-13 18:32:21 +00:00
Tomáš Golembiovský
52a8202635 v2v: ova: support SHA256 hashes in manifest
The OVF standard allows the use of SHA256 hashes in the manifest file.
Adding support for this.

One of the tests was updated to put SHA256 into manifest file.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2016-10-07 14:33:48 +02:00
Richard W.M. Jones
c3bbd129ab Add riscv64 test binaries, and new tests of guestfs_file_architecture. 2016-09-15 15:19:11 +01:00
Richard W.M. Jones
76c0a67d30 build: Add common CLEANFILES and DISTCLEANFILES to common-rules.mk.
By adding common CLEANFILES and DISTCLEANFILES variables to
common-rules.mk, we can remove these from most other Makefiles, and
also clean files more consistently.

Note that bin_PROGRAMS are already cleaned by 'make clean', so I
removed cases where these were unnecessarily added to CLEANFILES.
2016-08-25 16:54:34 +01:00
Pino Toscano
64bb9edd52 tests: specify the image format when possible
When possible, make the disk image format explicit when invoking tools
or using add-drive. This avoids warnings from qemu about the unspecified
format for the image, and also makes qemu slightly faster (skipping the
disk image probing).
Tests checking the image probing are not touched.

This changes also:
- old-style invocations of tools (`$tool $filename`) into new style
  (`$tool -a $filename`)
- add-drive-ro/add-drive-with-if guestfish commands into add/add-drive
  with explicit readonly/iface arguments

There should be no change in the tests results.
2016-05-19 19:06:00 +02:00
Pino Toscano
d2e81b42e7 inspect: use os-release for CoreOS
Look for /lib/os-release in the /usr partition and try to use it, if
present, before using lsb-release later on.  This should not change the
final result of the inspection, while using the os-release detection
method also for CoreOS.

Update the phony CoreOS image to use os-release instead, uploading the
version found in the current stable version.
2016-03-31 11:38:00 +02:00
Roman Kagan
ad5bb4f6bd v2v: collect source network and video adapter types
Those will be useful when making decisions about what configuration to
set on output.

The data is also included in --print-source so the tests are adjusted
accordingly.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: "Richard W.M. Jones" <rjones@redhat.com>
2016-03-24 15:07:01 +03:00
Pino Toscano
8aee5726d3 v2v: tests: isolate SHA1 calculation in an own shared function
sha1sum(1) does not exist everywhere, so wrap it in an own function so
the right implementation can be chosen on each OS.  Also, wrapping it
avoid using awk everytime.
2016-03-22 09:45:41 +01:00
Pino Toscano
41795a1c98 tests: move guestfs-md5.sh to test-data
Move it to the test-data directory, giving it a more generic name so it
can be used also for more than just md5; adjust qemu tests accordingly.

This is just code motion, no behaviour change.
2016-03-22 09:45:41 +01: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
c5237e28c5 test-data: Copy DriverVer from real *.inf files to fake *.inf files.
We want to test if virt-v2v can find drivers using the *.inf files.
For this to work, one field is important:

  [Version]
  DriverVer = 07/17/2013,6.1.0.10018

Copy the [Version] section header and DriverVer field from the real
*.inf files to our fake *.inf files, which is enough for testing.

See also:
https://www.redhat.com/archives/libguestfs/2015-October/msg00352.html

Note that the fields are case insensitive and may or may not contain
spaces.
2015-11-05 16:23:10 +00:00
Richard W.M. Jones
8c735a84c7 test-data: Make fake virtio-win ISO.
The virtio-win ISO has a different layout and superset of drivers
compared to the virtio-win RPM directory.  Previously we simply put
all the RPM files into the fake ISO.  Instead create a fake ISO which
has the same layout and (fake) drivers as the real ISO.
2015-11-05 16:23:10 +00:00
Richard W.M. Jones
b99a57a631 test-data: Add further (all fake) virtio-win driver files. 2015-11-05 16:23:10 +00:00
Richard W.M. Jones
f933a3c9c7 v2v: Move fake-virtio-win and fake-virt-tools under test-data.
There is no change, this just moves the test files.
2015-11-05 16:23:10 +00:00
Richard W.M. Jones
8a72616bf7 test-data: phony-guests: Don't use *.tmp.* temporary files. 2015-11-05 13:46:05 +00:00
Richard W.M. Jones
a2edda266e build: Make 'make clean' remove more files.
Remove man pages and other pages which 'make clean' did not remove
before.

To evaluate which pages could be removed, I did a full build and
check, and then ran 'make clean' followed by 'git clean -xdf'.  By
examining the output of the git clean command I could see which files
were being missed.

Files that are _not_ removed by make clean or make distclean:

 - generator-built files

 - Makefile, Makefile.in, .deps, .depend

 - any ./configure output files (maybe they should be?)
2015-11-03 13:53:37 +00:00
Richard W.M. Jones
877c69bef7 build: Reorder build sequence.
When I conceived commit dc1d0880b0, I
thought it would be a good idea to build test-data files, including
the phony guest images, during the 'make' phase.  Previously these
were built early in the 'make check' phase.

However this has two disadvantages: (a) We run the appliance
unnecessarily during builds.  For example, it is not necessary to
build the phony guests if we are going to do an 'installcheck'.
(b) Even if we are testing, the critical first time we run the
appliance is not in 'quickcheck' or 'tests/qemu', but some random
guest build.

Reorder the build sequence to fix this, and also a few other things.

This updates commit dc1d0880b0.
2015-10-30 22:06:18 +00:00
Richard W.M. Jones
dd5f5ffb48 test-data: Remove bogus comment.
The way we now build the blank guest images is safe to be run in
parallel.
2015-10-30 21:39:54 +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