summaryrefslogtreecommitdiffstats
path: root/src/ukify/test (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #28743 from mrc0mmand/lint-python-scriptsLuca Boccassi2023-08-101-2/+1
|\ | | | | tools: lint Python scripts
| * Add .pylintrc to globally suppress warnings we don't really care aboutFrantisek Sumsal2023-08-101-2/+1
| | | | | | | | Also, drop the respective disable directives from existing files.
* | test: use pytest.raises wrapperZbigniew Jędrzejewski-Szmek2023-08-091-3/+1
|/ | | | | | | This way we check that the appropriate exception is raised, not just ignore it. Follow-up for e3c04a5c84af5a39794a0a4963bc9916787aa5b4.
* meson: set suite for all tests, and adjust suite for some testsYu Watanabe2023-08-031-1/+2
|
* test-ukify: add tests for an empty argumentYu Watanabe2023-07-291-0/+5
|
* Merge pull request #27621 from esposem/ukify_readLuca Boccassi2023-07-281-0/+53
|\ | | | | ukify: add an option to read the PE sections
| * ukify/test_ukify: test display verbEmanuele Giuseppe Esposito2023-07-151-0/+53
| | | | | | | | Co-authored-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
* | test-ukify: use systemd-measure and bootctl in build directoryYu Watanabe2023-07-211-3/+18
| | | | | | | | | | And skip tests if systemd-measure is not found. Then, we can safely run test_ukify.py directly.
* | test: fix a syntax error in test-ukifyYu Watanabe2023-07-201-4/+5
| | | | | | | | | | | | Follow-up for d7d36252e5fdc345b110f824031e20f41ee75e86. Fixes #28464.
* | ukify: Derive public key from private key if not specifiedDaan De Meyer2023-07-131-37/+39
|/
* ukify: enable --sbat for UKIs tooLuca Boccassi2023-07-051-1/+20
| | | | | | For confidential computing they want to be able to revoke initrds too, so allow passing a specific --sbat section when building a UKI too, not just an addon. Merge it with the stub and kernel sections.
* test_ukify: skip test requiring cryptographyZbigniew Jędrzejewski-Szmek2023-06-141-0/+3
| | | | | I'll add the dep in Fedora spec so it does get tested at least in some cases.
* test_ukify: cleanups suggested by pylintZbigniew Jędrzejewski-Szmek2023-06-141-4/+5
|
* ukify: add 'genkey' verbZbigniew Jędrzejewski-Szmek2023-06-141-0/+52
| | | | | | | | | | | | | | | | | The idea is to make it easy to generate all the signing key and certs that can be used for local signing. The verb is the modeled after 'mkosi genkey', but there are some important differences: we generate the keys to the paths where they will be read from, both pcr signing keys and the SecureBoot certificate+key. If any of the outputs exist, operation is refused. Maybe we could add a --force option in the future, but this operation should be rare, so I think it's better to refuse to overwrite anything initially. I'm only doing a token man page change here. https://github.com/systemd/systemd/pull/27621 reworks the man page, and the changes done here would conflict heavily with that work. I'll submit a follow-up patch later.
* ukify: move verb mangling to finalize_options()Zbigniew Jędrzejewski-Szmek2023-06-121-1/+1
| | | | | | | This simplifies the logic: finalize_options() is the step that does the checks and the mangling. The checks for consistency are done in more places, so we need to pass a verb (we only have 'build', but once we add other verbs, any would do).
* man,test: root or hardware is not needed for ukifyZbigniew Jędrzejewski-Szmek2023-06-121-2/+2
|
* ukify: add 'build' verbZbigniew Jędrzejewski-Szmek2023-06-061-9/+82
| | | | | | | | | The old syntax with linux + initrds as positional arguments is still accepted, but a warning is emitted. We should remove the support for this after the next release or so. Adding a single verb by itself is not very useful, but opens the door to adding other verbs.
* test_ukify: pass through path to addon stubZbigniew Jędrzejewski-Szmek2023-06-061-3/+9
| | | | | | Without this, the tests would generally be skipped, since we haven't made a release with the addon stub yet. But even if the file is there, we always want to test the freshly-built item.
* test_ukify: no stinky root needed for signingZbigniew Jędrzejewski-Szmek2023-06-061-8/+0
| | | | C.f. b2efe286587e11e2aa4a6c7e4a2c15da3bb58a2a.
* ukify: simplify creation of parserZbigniew Jędrzejewski-Szmek2023-06-061-4/+4
| | | | | 00e5933f57c6e336ebed18601299acc6855bb3c2 made all the positional arguments optional, so let's take advantage of this to simplify variuos callers.
* Merge pull request #27539 from esposem/ukify_pesignLuca Boccassi2023-05-111-3/+54
|\ | | | | ukify: support pesign as alternative to sbsign
| * src/ukify/test/test_ukify: fix skipped testsEmanuele Giuseppe Esposito2023-05-101-1/+1
| | | | | | | | | | | | | | | | | | Some tests are skipped because initrd extracted from bootctl is "/boot/initramfs-5.14.0-284.el9.x86_64.img $tuned_initrd" and not just "/boot/initramfs-5.14.0-284.el9.x86_64.img". Therefore split and remove the additional garbage. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
| * src/ukify/test/test_ukify: add pesign unit testEmanuele Giuseppe Esposito2023-05-101-2/+53
| | | | | | | | Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
* | test_ukify: print message when skipping whole test fileZbigniew Jędrzejewski-Szmek2023-05-091-2/+4
|/
* test_ukify: add test for combining config and cmdlineZbigniew Jędrzejewski-Szmek2023-05-051-0/+80
|
* test_ukify: rework how --flakes argument is appendedZbigniew Jędrzejewski-Szmek2023-05-053-6/+16
| | | | | | | | | | | | | | | | | | | | The usual approach is to put 'addopts = --flakes' in setup.cfg. Unfortunately this fails badly when pytest-flakes is not installed: ERROR: usage: test_ukify.py [options] [file_or_dir] [file_or_dir] [...] test_ukify.py: error: unrecognized arguments: --flakes pytest-flakes is not packaged everywhere, and this test is not very important, so let's just do it only if pytest-flakes is available. We now detect if pytest-flakes is available and only add '--flakes' conditionally. This unfortunately means that when invoked via 'pytest' or directly as 'src/ukify/test/test_ukify.py', '--flakes' will not be appended automatically. But I don't see a nice way to achieve previous automatic behaviour. (I first considered making 'setup.cfg' templated. But then it is created in the build directory, but we would need it in the source directory for pytest to load it automatically. So to load the file, we'd need to give an argument to pytest anyway, so we don't gain anything with this more complex approach.)
* test_ukify: propagate failureZbigniew Jędrzejewski-Szmek2023-05-051-1/+1
| | | | | Oops. This explains why the tests were "passing" in CI even though a direct pytest invocation would fail.
* test_ukify: add tests for the new functionalityZbigniew Jędrzejewski-Szmek2023-05-051-0/+88
|
* test_ukify: fix two failing testsZbigniew Jędrzejewski-Szmek2023-05-031-4/+1
| | | | | | | | | | | Fixup for 22ad038ac6e4fe5e4a68555f0e70bd0a16fb5616 and 3fc5eed47091363247012454df458e1a3303bf12. It seems that the tests are not executed properly in CI. Nevertheless, test-ukify appears in logs: rpm-build:fedora-rawhide-x86_64: 409/1191 systemd / test-ukify OK 0.16s This is strange.
* test_ukify: fix loop iterationZbigniew Jędrzejewski-Szmek2023-05-031-1/+1
| | | | We'd try to access 'linux' or 'initrd' after failing to set it.
* ukify: allow building PE addonLuca Boccassi2023-04-261-0/+21
| | | | | Make the kernel optional too, so that we can easily build and sign a PE addon, that can be used to carry extra command line options.
* tree-wide: Use correct SPDX license identifierJan Janssen2023-02-241-1/+1
|
* ukify: allow multiple initrdsZbigniew Jędrzejewski-Szmek2022-12-071-6/+12
| | | | | | | | | If given, multiple initrds are concatenated into a temporary file which then becomes the .initrd section. It is also possible to give no initrd. After all, some machines boot without an initrd, and it should be possible to use the stub without requiring an initrd. (The stub might not like this, but this is something to fix there.)
* ci: install pefileZbigniew Jędrzejewski-Szmek2022-12-071-0/+6
|
* ukify: try to find the uname string in the linux image if not specifiedZbigniew Jędrzejewski-Szmek2022-12-071-0/+8
| | | | | | | | | | | | | | | The approach is based on mkinicpio's autodetection. This is hacky as hell. Some cases are actually fairly nice: ppc64el images have a note that contains 'uname -r'. (The note is not uniquely labeled at all, and only contains the release part instead of the full version-hostname-release string, and we don't actually care about ppc, and it's very hard to read the note from Python, but in general that'd be the approach I'd like.) I opted to simply read and decompress the full linux binary in some cases. Python doesn't make it easy to do streaming decompression with regexp matching, and it doesn't seem to matter much: the image decompresses in a fraction of a second.
* tests: add pytest tests for ukifyZbigniew Jędrzejewski-Szmek2022-12-079-0/+510
Some gymnastics were needed to import ukify as a module. Before the file was templated, this was trivial: insert the directory in sys.path, call import. But it's a real pain to import the unsuffixed file after processing. Instead, the untemplated file is imported, which works well enough for tests and is very simple. The tests can be called via pytest: PATH=build/:$PATH pytest -v src/ukify/test/test_ukify.py or directly: PATH=build/:$PATH src/ukify/test/test_ukify.py or via the meson test machinery output: meson test -C build test-ukify -v or without verbose output: meson test -C build test-ukify Zekret files are obfuscated using base64.