summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* test-execute: use bash instead of perlZbigniew Jędrzejewski-Szmek2023-05-091-1/+1
| | | | I think this is easier to grok too.
* test-udev: skip test on python3.6Zbigniew Jędrzejewski-Szmek2023-05-091-1/+1
|
* test/run-unit-tests, TEST-02: skip tests where the interpeter is not installedZbigniew Jędrzejewski-Szmek2023-05-092-2/+5
| | | | | | | | | | | | | | | | | | | | When the interpeter is missing, we get an exit code of 127. Let's treat those tests as skipped too. If we could run the test far enough so that it could do the check itself, it would return 77 anyway. $ test/asdf; echo $? exec: Failed to execute process 'test/asdf': The file specified the interpreter '/bin/asdf', which is not an executable command. 127 $ test/asdf; echo $? /usr/bin/env: ‘/bin/asdf’: No such file or directory 127 This should resolve the problem that TEST-02 fails or Debian's 'unit-tests' fail when python3 is not installed. Installing python3 via the mechanism that is used to construct TEST images, i.e. the dracut dependency chasing scheme, would be a lot of work for python with its modules in multiple locations and hundreds of little files. So I think it OK to just skip the test there, and also in other cases where python is not available.
* test: rework how udev-test is invokedZbigniew Jędrzejewski-Szmek2023-05-092-31/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As part of the build, we would populate build/test/sys/ using sys-script.py, and then udev-test.p[ly] would create a tmpfs instance on build/test/tmpfs and copy the sys tree to build/test/tmpfs/sys. Also, we had udev-test.p[ly] which called test-udev. test-udev was marked as a manual test and installed, but neither udev-test.p[ly] or sys-script.py were. test-udev is renamed to udev-rule-runner, which reduces confusion and frees up the test-udev name. udev-test.py is renamed to test-udev.py. All three files are now installed. test-udev.py is modified to internally call sys-script.py to set up the sys tree. Copying and creating it from scratch should take the same amount of time. We avoid having a magic directory, everything is now done underneath a temporary directory. test-udev.py is now a normal installed test, and run-unit-tests.py will pick it up. When test-udev.py is invoked from meson, the path to udev-rule-runner is passed via envvar; when it is invoked via run-unit-tests.py or directly, it looks for udev-rule-runner in a relative path. The goal of this whole change is to let Debian drop the 'udev' test. It called sys-script.py and udev-test.pl from the source directory and had to recreate a bunch of the logic. Now test-udev.py will now be called via 'upstream'.
* test: drop udev-test.plZbigniew Jędrzejewski-Szmek2023-05-092-2923/+1
|
* test: rewrite udev-test.pl in PythonZbigniew Jędrzejewski-Szmek2023-05-092-1/+2416
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I tried to keep this a 1:1 rewrite with the same field names. Nevertheless, some changes were made: - exp_add_error and exp_rem_error are dropped. Those fields meant that "./test-udev add <devpath>" actually succeeded, but symlinks were not created, and exp_links was ignored and could contain bogus content. Instead, exp_links and not_exp_links are adjusted to not contain garbage and the tests check that "./test-udev add" succeeds and that the links are as expected from exp_links and not_exp_links. - cleanup was only used in one rule, and that rule was expected to fail, so cleanup wasn't actually necessary. So the cleanup field and the logic to call cleanup from individual tests is removed. - a bunch of fields were set, but didn't seem to be connected to any implementation: not_exp_name, not_exp_test. e62acc3159935781f05fa59c48e5a74e85c61ce2 did a rewrite of some of the tests and it seems that not_exp_test was added by mistake and not_exp_name was left behind by mistake. In Python, the field list is declared in the class, so it's harder to assign an unused attribute. Those uses were converted to not_exp_links. - in most rules, r"""…""" is used, so that escaping is not necessary. - the logic to generate devices was only used in one place, and the generator function also had provisions to handle arguments that were never given. all_block_devs() is made much simpler. - Descriptions that started with a capital letter were shortened and lowercased. - no special test case counting is done. pytest just counts the cases (Rules objects). - the output for failures is also removed. If something goes wrong, the user can use pytest --pdb or such to debug the issue. - perl version used a semaphore to manage udev runners, and would fork, optionally wait a bit, and then start the runner. In the python version, we just spawn them all and wait for them to exit. It's not very convenient to call fork() from python, so instead the runner was modified (in previous commit) to wait. The test can be called as: (cd build && sudo pytest -v ../test/udev-test.py) sudo meson test -C build udev-test.py -v I think this generally provides functionality that is close to the perl version. It seems some of the checks are now more fully implemented. Support for strace/gdb/valgrind is missing. Runtime goes down: 8.36 s → 5.78 s.
* test: add a test case for #27521Frantisek Sumsal2023-05-051-0/+0
| | | | Which got resolved by e652663a04.
* core: check the unit type more thoroughly when deserializingFrantisek Sumsal2023-05-051-0/+4
| | | | Resolves: #27523
* shared: refuse fd == INT_MAXFrantisek Sumsal2023-05-051-0/+3
| | | | | | | Since we do `FD_TO_PTR(fd)` that expands to `INT_TO_PTR(fd) + 1` which triggers an integer overflow. Resolves: #27522
* test: clean up the test script even furtherFrantisek Sumsal2023-05-032-90/+66
| | | | | | | Most notably: - use `systemd-id128 new` instead of `journalctl --new-id128` - move all temporary files to /tmp - wrap repetitive checks in a function
* test: vacuum the journal after the "stress test"Frantisek Sumsal2023-05-031-0/+1
| | | | To make the rest of the test significantly faster.
* test: slightly extend checks on corrupted journalsFrantisek Sumsal2023-05-031-8/+14
|
* test: further extend our collection of corrupted journalsFrantisek Sumsal2023-05-032-0/+4
| | | | | | And make adding them slightly easier. Provides coverage for b5335da7a5.
* Merge pull request #27504 from mrc0mmand/fuzz-manager-serializeYu Watanabe2023-05-034-0/+259
|\ | | | | test: add a simple fuzzer for manager serialization
| * shared: reject empty attachment pathFrantisek Sumsal2023-05-031-0/+11
| |
| * shared: ignore invalid valink socket fd when deserializingFrantisek Sumsal2023-05-031-0/+5
| |
| * core: fix NULL pointer dereference during deserializationFrantisek Sumsal2023-05-031-0/+10
| |
| * test: add a simple fuzzer for manager serializationFrantisek Sumsal2023-05-031-0/+233
| |
* | test: replace sleep with timeoutYu Watanabe2023-05-021-2/+2
| | | | | | | | | | If the test environment is too slow, then sleeping 2 seconds may not be sufficient.
* | test-network: add workaround for bug in iproute2 v6.2.0Yu Watanabe2023-05-011-4/+8
|/ | | | Closes #27473.
* test: test journalctl with corrupted journalsFrantisek Sumsal2023-05-012-0/+35
| | | | | | | | | | Last month I monkey-patched journald to produce a small (64K) but valid journal and used that as an input to four AFL fuzzers. After a month it generated quite a nice corpora (4738 test cases) and after filtering and minimizing it I was left with 619 unique journals with various levels of corruption that probe the journal code. It seems to detect past issues like systemd#26567, etc.
* test: clean up the test script a bitFrantisek Sumsal2023-05-018-11/+10
|
* test: make sure the test units have a `test-` prefixFrantisek Sumsal2023-04-291-3/+3
| | | | | | | So when collecting coverage the test-.service dropin works as expected. Follow-up to 969f5f3cea.
* test: match all messages with the FILE fieldFrantisek Sumsal2023-04-291-4/+4
| | | | | | | | | | As the systemd-pstore process is quite short lived, it might sometimes lack the necessary metadata to make matching against a unit or a syslog tag work. Since we already use a cursor file to make the matching window small as possible, let's just drop the unit match completely and hope for the best. Resolves: #27453
* test: add tests for "systemctl stop" vs triggering by path unitYu Watanabe2023-04-294-0/+54
|
* test: create temporary units under /runYu Watanabe2023-04-291-4/+4
|
* Merge pull request #27437 from mrc0mmand/pstoreLuca Boccassi2023-04-281-0/+221
|\ | | | | test: add a couple of tests for systemd-pstore
| * test: add a couple of tests for systemd-pstoreFrantisek Sumsal2023-04-281-0/+221
| |
* | test: dont use anchor char '$' to match a part of a stringFranck Bui2023-04-271-2/+2
| | | | | | | | | | When anchoring the pattern using '$' regular expression operator it forces '=~' operator to match the entire string.
* | Merge pull request #25622 from YHNdnzj/tmpfiles-X-bit-supportMike Yuan2023-04-273-0/+62
|\ \ | | | | | | tmpfiles: add conditionalized execute permission (X) support
| * | test: tmpfiles: add tests on conditionalized execute bitMike Yuan2023-04-273-0/+62
| | |
* | | test: extend test 19 to also verify DelegateSubgroup= worksLennart Poettering2023-04-271-0/+18
|/ /
* | Merge pull request #27355 from fbuihuu/kbd-improve-vc2x11-conversionLuca Boccassi2023-04-261-8/+8
|\ \ | | | | | | locale: improve vc -> x11 keyboard conversion
| * | locale: when no xvariant match select the entry with an empty xvariantFranck Bui2023-04-261-8/+8
| | | | | | | | | | | | | | | | | | When doing a conversion and the specified 'xc->xvariant' has no match, select the x11 layout entry with a matching layout and an empty xvariant if such entry exists. It's still better than no conversion at all.
* | | Merge pull request #27421 from bluca/coredump_filterLuca Boccassi2023-04-261-0/+3
|\ \ \ | | | | | | | | CoredumpFilter: fix stack overflow and invalid assignment with 'all'
| * | | test: add coverage for CoredumpFilter=allLuca Boccassi2023-04-261-0/+3
| | |/ | |/|
* | | Merge pull request #27415 from DaanDeMeyer/verity-minimizeDaan De Meyer2023-04-261-0/+2
|\ \ \ | | | | | | | | repart: Add Minimize= support for verity hash partitions
| * | | repart: Add Minimize= support for verity hash partitionsDaan De Meyer2023-04-261-0/+2
| | | | | | | | | | | | | | | | Fixes #27414
* | | | Merge pull request #27398 from yuwata/udev-rule-negative-matchZbigniew Jędrzejewski-Szmek2023-04-261-3/+8
|\ \ \ \ | |_|/ / |/| | | udev-rule: fix negative match
| * | | test: add test case of negative match for SYMLINK and TAGYu Watanabe2023-04-261-3/+8
| | | |
* | | | test: tell dfuzzer to skip Reexecute()Frantisek Sumsal2023-04-261-0/+9
| |/ / |/| | | | | | | | | | | | | | | | | As described in systemd/systemd#27204 reexecuting the daemon while running in a systemd-run "session" causes the session end prematurely. Let's skip the Reexecute() method in dfuzzer and trigger it manually until the issue is resolved.
* | | test: add a couple of sanity tests for systemd-credsFrantisek Sumsal2023-04-251-0/+146
|/ /
* | test: use idiomatic bash loop iterationZbigniew Jędrzejewski-Szmek2023-04-2411-35/+33
| | | | | | | | | | In a few cases, also avoid a sleep in the last (failed) iteration of the loop. It doesn't matter too much, but it's still ugly.
* | testsuite-54: drop unnecessary pipeZbigniew Jędrzejewski-Szmek2023-04-241-1/+1
| |
* | testsuite-70: drop unnecessary envZbigniew Jędrzejewski-Szmek2023-04-241-9/+8
| |
* | test: drop uses of "&& { echo 'unexpected success'; exit 1; }"Zbigniew Jędrzejewski-Szmek2023-04-2421-243/+219
| | | | | | | | Brief is sweet.
* | testsuite-04: remove unnecessary conditionalZbigniew Jędrzejewski-Szmek2023-04-241-5/+1
| |
* | testsuite-04: remove redirection, drop whitespace after redirection opZbigniew Jędrzejewski-Szmek2023-04-241-2/+2
|/
* Merge pull request #27349 from mrc0mmand/codespellLuca Boccassi2023-04-203-3/+3
|\ | | | | tree-wide: code spelling fixes
| * tree-wide: code spelling fixesFrantisek Sumsal2023-04-203-3/+3
| | | | | | | | As reported by Fossies.