Commit graph

24 commits

Author SHA1 Message Date
Lars Karlitski
e7ae3b4c47 test: move image-info tests to test/
These tests (will) test more than just image-info: they'll take a
blueprint, verify that `osbuild-pipeline` generates the correct
pipeline, run osbuild with that pipeline and verify that the resulting
image has the expected image-info output.

This change only includes the latter half (i.e., only moves the already
existing tests).

Also drop python's unittest. It was hard to control output (important
for quickly spotting failures and to make travis happy). This introduces
test/run, which runs all test cases in test/cases or the ones given on
the command line.

When a failure occurs, it prints a diff of the actual and the expected
image info.
2019-10-30 01:25:44 +01:00
Lars Karlitski
fabd40da1c blueprint: always run selinux stage last
A few output types had it before the fix-bls stage.
2019-10-29 16:01:37 +01:00
Lars Karlitski
6a6144c2d9 blueprint: always exclude the rescue kernel
Its BLS entry always expects a separate boot partition. Skip it on all
images until the rescue kernel package is usable.
2019-10-29 16:01:37 +01:00
Lars Karlitski
930347c56e blueprint: move vmdk towards lorax parity
The main difference (according to image-info) is an additional package
containing a gpg key which was used to verify packages. The one
generated by lorax-composer doesn't have this, because it doesn't verify
signatures.

Also, lorax generates an image with a separate /boot partition. This is
not yet addressed here, because osbuild doesn't support it yet.
2019-10-29 16:01:37 +01:00
Lars Karlitski
cde1325bc3 blueprint: move tar towards lorax parity
The main difference (according to `rpm -qa`) is an additional package
containing a gpg key which was used to verify packages. The one
generated by lorax-composer doesn't have this, because it doesn't verify
signatures.
2019-10-29 16:01:37 +01:00
Lars Karlitski
d4e1ecea7e blueprint: move partitioned-disk towards lorax parity
The main difference (according to image-info) is an additional package
containing a gpg key which was used to verify packages. The one
generated by lorax-composer doesn't have this, because it doesn't verify
signatures.

Also, lorax generates an image with a separate /boot partition. This is
not yet addressed here, because osbuild doesn't support it yet.
2019-10-29 16:01:37 +01:00
Lars Karlitski
fe46fd3a89 blueprint: move ext4-filesystem towards lorax parity
The main difference (according to image-info) is an additional package
containing a gpg key which was used to verify packages. The one
generated by lorax-composer doesn't have this, because it doesn't verify
signatures.
2019-10-29 16:01:37 +01:00
Tom Gundersen
e8bd3cba45 image-info: add expected image info
This is the output of disk info ran against the images produced
by the specified pipelines.

Skip the actual test for now, because it is taking too long to run.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-10-29 16:01:37 +01:00
Tom Gundersen
8c0561c054 blueprint/test: express test-cases in json
A test case is now expressed purely by dropping in a json document in
`tools/test_image_info/pipelines`. It should contain the input compose
(output format and blueprint) as well as the expected pipeline. All the
existing tests are moved over to this format.

This shares the same infrastructure as the image tests, ideally we want
to run the blueprint tests and the image tests against the same pipelines.

For now, test cases are skipped from the blueprint tests if they do not
contain a 'compose' section, and from the image tests if they do not
cotain an 'expected' section. In the future we may want to make both
mandatory.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-10-28 17:32:45 +01:00
Lars Karlitski
fd50ef4a73 test/image-info: print osbuild output on failure 2019-10-28 14:37:36 +01:00
Tom Gundersen
2e0deff629 submodule: bump to current head
Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-10-28 14:14:09 +01:00
Tom Gundersen
18934d4249 tools/image-info: add support for naked partitions
In case there is no partition table, we assume the whole image is
one big partition and treat is as such.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-10-25 11:46:25 +02:00
Lars Karlitski
329964f2ab image-info: add test
Add two kinds of tests, with one case each:

1. Run image-info against an osbuild pipeline. Uses osbuild
from a submodule to make an image from the pipeline.

2. Run image-info against an existing image, fetched from the internet.
2019-10-05 14:47:35 +02:00
Lars Karlitski
2854b2938e image-info: don't use rpm --verify with --root
RPM uses the host's passwd instead of that in the target to get uid
and gid mappings.

Run it in a chroot to work around this bug.
2019-10-05 14:47:35 +02:00
Lars Karlitski
5040e6b427 image-info: sort bootmenu entries
The order doesn't matter, but should be the same between different runs
of image-info.
2019-10-04 01:51:07 +02:00
Tom Gundersen
41c6f5dd0b image-info: include partition table id
Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-10-03 12:35:51 +02:00
Lars Karlitski
b170ea036c image-info: include output from rpm --verify
This shows the changes an image has relative to what its rpm database
thinks is installed. Output is:

    "rpm-verify": {
        "missing": [ <missing files> ],
        "changed": { <map from filename to rpm attribute octet > }
    }

Alas, this makes running image-info slower.
2019-10-01 17:05:10 +02:00
Lars Karlitski
01b7402ce2 image-info: include partition label and uuid 2019-09-30 22:28:28 +02:00
Lars Karlitski
9867846ff4 tools/image-info: consistent use of - over _
And remove a stray comment and whitespace.
2019-09-30 22:28:28 +02:00
Tom Gundersen
e43955a4c5 image-info: include the image format
Use qemu-img to query the image format and include that in the report.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-09-30 15:15:14 +02:00
Lars Karlitski
bf3d7fcdca image-info: add basic support for multiple partitions
For each partition, find out if its the root or boot partition and
gather only the relevant information. Make sure that we don't get
information from /boot twice.
2019-09-30 13:32:53 +02:00
Lars Karlitski
172a23bdb2 image-info: bootloader=unknown instead of creashing 2019-09-30 13:32:53 +02:00
Lars Karlitski
457f5f697e image-info: assume bootable=False if key is not present
sfdisk doesn't include the "bootable" key in its output when a partition
is not marked as bootable.
2019-09-30 13:32:53 +02:00
Lars Karlitski
5fbc734a15 tools: add image-info
Rough draft of image-info, a tool that extracts high-level information
about an os image. It prints this information in JSON form on stdout.
Run it like this:

  $ tools/image-info <image>

It supports all images that qemu-ndb supports.
2019-09-29 13:44:56 +02:00