Commit graph

13 commits

Author SHA1 Message Date
Lars Karlitski
82a2be53d4 pipeline: return logs in --json mode
A pipeline run only returned logs in the `StageFailed` and
`AssemblerFailed` exceptions. Remove those and always return structured
data instead.

It only returns data for stages that actually ran (i.e., didn't come
from the cache). This is similar to the output in interactive mode.

Also change osbuildtest to be able to deal with output that is larger
than the pipe buffer by using subprocess.communicate().
2019-12-14 13:49:24 +01:00
Lars Karlitski
64713449ce Introduce runners
We've been using a generic `osbuild-run`, which sets up the build
environment (and works around bugs) for all build roots. It is already
getting unwieldy, because it tries to detect the OS for some things it
configures. It's also about to cause problems for RHEL, which doesn't
currently support a python3 shebang without having /etc around.

This patch changes the `build` key in a pipeline to not be a pipeline
itself, but an object with `runner` and `pipeline` keys. `pipeline` is
the build pipeline, as before. `runner` is the name of the runner to
use. Runners are programs in the `runners` subdirectory.

Three runners are included in this patch. They're copies of osbuild-run
for now (except some additions for rhel82). The idea is that each of
them only contains the minimal setup code necessary for an OS, and that
we can review what's needed when updating a build root.

Also modify the `--build-pipeline` command line switch to accept such a
build object (instead of a pipeline) and rename it accordingly, to
`--build-env`.

Correspondingly, `OSBUILD_TEST_BUILD_PIPELINE` → `OSBUILD_TEST_BUILD_ENV`.
2019-11-25 13:05:22 +01:00
Ondřej Budai
dff8d6591b tests: fix ResourceWarning: unclosed file when running osbuild
We don't close osbuild's stdin when no input is given. Don't open stdin
at all when no input is specified.
2019-10-17 16:07:03 +01:00
Lars Karlitski
8d62bed7e4 test: give osbuild time to clean up on SIGINT
When the test runner receives SIGINT, osbuild's mounts stay around.
osbuild handles SIGING correctly, but it doesn't have time before being
killed because it's parent went away.

Fix this by waiting on it explicitly in the test runner.

Fixes #119
2019-10-11 18:02:04 +02:00
Lars Karlitski
3e00117d35 test: prefix temporary directory with osbuild-test-
This makes it easier to spot which process temporary files are coming
from.
2019-10-11 18:02:04 +02:00
Ondřej Budai
2be0530047 tests: Use one store per class instead of per test method
For stages testing it is too slow to rebuild the a image containing
@Core packages every time. Let's just reuse the a image for all tests.
This should speed up the test running time a LOT.
2019-10-08 21:39:35 +02:00
Ondřej Budai
85ebb084b5 tests: introduce stage testing
The stage testing is based on an output from the tree-diff tool. During
one test two pipelines are run and their outputs are compared using
tree-diff. The diff is then compared with expected diff included in
the repository.
2019-10-08 21:39:35 +02:00
Ondřej Budai
e12f55aa21 tests: print stdout from osbuild when it fails 2019-10-07 10:10:51 +02:00
Lars Karlitski
9fbe80722b assemblers: add org.osbuild.rawfs
This assembler outputs an image file which only contains the file
system.
2019-10-07 10:10:51 +02:00
Lars Karlitski
ff56cb7f6a test: introduce OSBUILD_TEST_STORE
The testosbuild.TestCase class creates a fresh store for each test,
because tests should run independent of each other.

This can lead to long waiting times while developing a new test case.

Allow overriding the store used with OSBUILD_TEST_STORE. This should
never be used where tests are actually run. It is a development-only
feature.
2019-10-07 00:06:23 +02:00
Lars Karlitski
db6e933cb8 test: add docstring to osbuildtest.TestCase 2019-09-30 08:36:50 +02:00
Lars Karlitski
2205e972d3 test: move temporary store to osbuildtest.TestCase
All tests will need a store. There's no need for each to create a
temporary directory.
2019-09-30 08:36:50 +02:00
Lars Karlitski
2ab9ba4e33 test: refactor boot test
Use the unittest module from the standard library. Also, ensure that
separate runs of this test don't share a osbuild store and clean up
after themselves.

With contributions from Ondřej Budai and Tom Gundersen.
2019-09-26 19:20:47 +02:00