summaryrefslogtreecommitdiff
path: root/test/test-functions
Commit message (Collapse)AuthorAgeFilesLines
* test: create a dummy LSan suppression file in the minimal imageFrantisek Sumsal2021-11-261-0/+4
| | | | | | | | | | | | | | | | | | | | | | otherwise gcc's ASan complains (unlike clang's) when the image is used - e.g. in TEST-29 or TEST-50. ``` [ 17.328705] testsuite-29.sh[361]: + portablectl --profile=trusted attach --now --runtime /usr/share/minimal_0.raw app0 ... [ 20.978649] systemd[1]: Starting app0-foo.service... [ 21.104844] kernel: loop0: detected capacity change from 0 to 24960 [ 20.999559] systemd[1]: Starting app0.service... [ 21.126022] kernel: loop1: detected capacity change from 0 to 24960 ... [ 21.861087] cat[422]: AddressSanitizer: failed to read suppressions file '/systemd-lsan.supp' [ 21.868634] cat[421]: AddressSanitizer: failed to read suppressions file '/systemd-lsan.supp' [ 21.877941] systemd[1]: app0.service: Control process exited, code=exited, status=1/FAILURE [ 21.878836] systemd[1]: app0.service: Failed with result 'exit-code'. [ 21.905712] systemd[1]: Failed to start app0.service. ``` Follow-up to f201f3447796a5424372d32b338bc3b907516c28.
* test: test new SYSEXT_SCOPE=/PORTABLE_PREFIXES= fields in TEST-29Lennart Poettering2021-11-231-1/+4
|
* test: suppress certain leaks reported by LSanFrantisek Sumsal2021-11-221-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | so we can run TEST-46 under sanitizers once again. `systemd-homed` runs fsck on home directories, which reports a memory leak we're not interested in. Let's introduce an LSan suppression file to get around this. Since the patterns in the suppression file are matched using basic substring match[0], they're a bit cumbersome, but should get the work one. [0] https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer#suppressions Example leaks (as reported by TEST-46): ``` systemd-homed[1333]: ================================================================= systemd-homed[1333]: ==1333==ERROR: LeakSanitizer: detected memory leaks systemd-homed[1333]: Direct leak of 24 byte(s) in 1 object(s) allocated from: systemd-homed[1333]: #0 0x7f0c8facccd1 in calloc (/usr/lib/clang/12.0.1/lib/linux/libclang_rt.asan-x86_64.so+0xf4cd1) systemd-homed[1333]: #1 0x558d9494ff67 (/usr/bin/fsck+0x3f67) systemd-homed[1333]: Direct leak of 6 byte(s) in 1 object(s) allocated from: systemd-homed[1333]: #0 0x7f0c8fa906c1 in strdup (/usr/lib/clang/12.0.1/lib/linux/libclang_rt.asan-x86_64.so+0xb86c1) systemd-homed[1333]: #1 0x558d949518fd (/usr/bin/fsck+0x58fd) systemd-homed[1333]: SUMMARY: AddressSanitizer: 30 byte(s) leaked in 2 allocation(s). systemd-homed[1337]: ==1337==WARNING: Symbolizer was blocked from starting itself! systemd-homed[1337]: ================================================================= systemd-homed[1337]: ==1337==ERROR: LeakSanitizer: detected memory leaks systemd-homed[1337]: Direct leak of 67584 byte(s) in 1 object(s) allocated from: systemd-homed[1337]: #0 0x7f01edb84b19 (/usr/lib/clang/12.0.1/lib/linux/libclang_rt.asan-x86_64.so+0xf4b19) systemd-homed[1337]: #1 0x7f01e8326829 (/usr/bin/../lib/libLLVM-12.so+0xb46829) systemd-homed[1337]: SUMMARY: AddressSanitizer: 67584 byte(s) leaked in 1 allocation(s). ``` With the suppression file: ``` systemd-homed[1339]: ----------------------------------------------------- systemd-homed[1339]: Suppressions used: systemd-homed[1339]: count bytes template systemd-homed[1339]: 2 30 /bin/fsck$ systemd-homed[1339]: ----------------------------------------------------- systemd-homed[1343]: ==1343==WARNING: Symbolizer was blocked from starting itself! systemd-homed[1343]: ----------------------------------------------------- systemd-homed[1343]: Suppressions used: systemd-homed[1343]: count bytes template systemd-homed[1343]: 1 67584 /lib/libLLVM systemd-homed[1343]: ----------------------------------------------------- ```
* test: fix a couple of "new" shellcheck-related issuesFrantisek Sumsal2021-11-221-3/+3
| | | | related to https://github.com/koalaman/shellcheck/wiki/SC2295
* test: support the new lvm udev autoactivationFrantisek Sumsal2021-11-011-2/+9
| | | | | Introduced in lvm 2.03.14. See: https://sourceware.org/git/?p=lvm2.git;a=commit;h=67722b312390cdab29c076c912e14bd739c5c0f6
* test: merge coverage reports from previous test runsFrantisek Sumsal2021-10-251-2/+13
| | | | Relevant mainly for tests which utilize both QEMU and nspawn.
* test: rename the global service override file for coverage runsFrantisek Sumsal2021-10-231-1/+1
| | | | | | Otherwise we break TEST-15-DROPIN, since it uses /usr/lib/systemd/system/service.d/override.conf in some of its sub-tests.
* test: disable ProtectHome= when collecting coverage as wellFrantisek Sumsal2021-10-231-3/+3
| | | | | | | | | | Depending on the location of the original build dir, either ProtectHome= or ProtectSystem= may get in the way when creating the gcov metadata files. Follow-up to: * 02d7e73013a92c5580023e4e548d19adbc254dbe * 6c9efba67715cd1ced170ac46c04d47934ad276a
* test: make the coverage check safer for non-compiled buildsFrantisek Sumsal2021-10-211-1/+9
|
* test: loosen sandbox restrictions for integration tests as wellFrantisek Sumsal2021-10-211-4/+12
| | | | | | Otherwise we miss quite a lot of coverage (mainly from logind, hostnamed, networkd, and possibly others), since they can't write their reports with `ProtectSystem=strict`.
* test: collect coverage in a couple more codepathsFrantisek Sumsal2021-10-201-0/+2
| | | | | | | Otherwise we'd miss coverage from TEST-{02,24,61}, since they don't go through the "standard" `check_result_common` hook. Follow-up to 7bf20e48bd7d641a39a14a7feb749b7e8b0fc0f6.
* test: create and merge code coverage reports in integration testsLuca Boccassi2021-10-041-0/+36
| | | | | | | If -Db_coverage=true is used at build time, then ARTIFACT_DIRECTORY/TEST-XX-FOO.coverage-info files are created with code coverage data, and run-integration-test.sh also merges them into ARTIFACT_DIRECTORY/merged.coverage-info since the coveralls.io helpers accept only a single file.
* licensing: add forgotten spdx headersZbigniew Jędrzejewski-Szmek2021-10-011-1/+3
| | | | | Those are all "our" files, but we forgot to add the headers, most likely because of non-standard file extensions.
* test: shellcheck-ify test scriptsFrantisek Sumsal2021-09-301-4/+7
|
* test: explicitly report if we fail to install a file into the imageFrantisek Sumsal2021-09-291-0/+2
|
* test: add an iSCSI helperFrantisek Sumsal2021-09-291-0/+39
|
* Merge pull request #20806 from fbuihuu/test-make-debug-tools-optionalLuca Boccassi2021-09-221-1/+2
|\ | | | | test: make the installation of the debug tools optional in the image
| * test: wc is needed by test/units/testsuite-50.shFranck Bui2021-09-221-0/+1
| |
| * test: make the installation of the debug tools optional in the imageFranck Bui2021-09-221-1/+1
| |
* | Merge pull request #20690 from DaanDeMeyer/oomd-user-servicesLuca Boccassi2021-09-211-0/+3
|\ \ | | | | | | oom: Support for user services
| * | oom: Add support for user unit ManagedOOM property updatesDaan De Meyer2021-09-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Compared to PID1 where systemd-oomd has to be the client to PID1 because PID1 is a more privileged process than systemd-oomd, systemd-oomd is the more privileged process compared to a user manager so we have user managers be the client whereas systemd-oomd is now the server. The same varlink protocol is used between user managers and systemd-oomd to deliver ManagedOOM property updates. systemd-oomd now sets up a varlink server that user managers connect to to send ManagedOOM property updates. We also add extra validation to make sure that non-root senders don't send updates for cgroups they don't own. The integration test was extended to repeat the chill/bloat test using a user manager instead of PID1.
* | | test: add a btrfs helperFrantisek Sumsal2021-09-181-0/+8
| |/ |/|
* | test: add an LVM helperFrantisek Sumsal2021-09-141-0/+14
| |
* | test: install dmevent service and socketFrantisek Sumsal2021-09-141-0/+1
| |
* | test: specify the rootfs by labelFrantisek Sumsal2021-09-141-3/+3
|/ | | | | otherwise the boot might fail when attaching multiple SATA devices to the VM.
* test: add a multipath helperFrantisek Sumsal2021-09-121-0/+26
|
* test: rename `dracut_install` to `image_install`Frantisek Sumsal2021-09-081-26/+26
| | | | | | The `dracut_install` is a misnomer, since the systemd integration test suite is based on the original dracut's test suite, and not all the references to dracut has been edited out. Let's fix that.
* test: make sure to include all haveged unit filesFranck Bui2021-09-011-2/+4
| | | | Recent versions of haveged relies on haveged-switch-root.service too.
* test-execute: add a testcase for MountAPIVFS=noYu Watanabe2021-08-261-0/+1
|
* test: make sure test timeout has a higher priority than a passFrantisek Sumsal2021-08-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | otherwise we might mark tests where something crashes during shutdown as successful, as happened in one of the recent TEST-01-BASIC runs: ``` testsuite-01.service: About to execute rm -f /failed /testok testsuite-01.service: Forked rm as 606 testsuite-01.service: Executing: rm -f /failed /testoktestsuite-01.service: Changed dead -> start-pre Starting TEST-01-BASIC... ... Child 606 (rm) died (code=exited, status=0/SUCCESS) testsuite-01.service: Child 606 belongs to testsuite-01.service. testsuite-01.service: Control process exited, code=exited, status=0/SUCCESS (success) testsuite-01.service: Got final SIGCHLD for state start-pre. testsuite-01.service: Passing 0 fds to service testsuite-01.service: About to execute sh -e -x -c "systemctl --state=failed --no-legend --no-pager >/failed ; systemctl daemon-reload ; echo OK >/testok" testsuite-01.service: Forked sh as 607 testsuite-01.service: Changed start-pre -> start testsuite-01.service: Executing: sh -e -x -c "systemctl --state=failed --no-legend --no-pager >/failed ; systemctl daemon-reload ; echo OK >/testok"systemd-journald.service: Got notification message from PID 560 (FDSTORE=1)S ... testsuite-01.service: Child 607 belongs to testsuite-01.service. testsuite-01.service: Main process exited, code=exited, status=0/SUCCESS (success) testsuite-01.service: Deactivated successfully. testsuite-01.service: Service will not restart (restart setting) testsuite-01.service: Changed start -> dead testsuite-01.service: Job 207 testsuite-01.service/start finished, result=done [ OK ] Finished TEST-01-BASIC. ... end.service: About to execute /bin/sh -x -c "systemctl poweroff --no-block" end.service: Forked /bin/sh as 623end.service: Executing: /bin/sh -x -c "systemctl poweroff --no-block" ... end.service: Job 213 end.service/start finished, result=canceled Caught <SEGV>, dumped core as pid 624. Freezing execution. CentOS Linux 8 Kernel 4.18.0-305.12.1.el8_4.x86_64 on an x86_64 (ttyS0) H login: qemu-kvm: terminating on signal 15 from pid 80134 (timeout) E: Test timed out after 600s Spawning getter /root/systemd/build/journalctl -o export -D /var/tmp/systemd-test.0UYjAS/root/var/log/journal/ca6031c2491543fe8286c748258df8d1... Finishing after writing 15125 entries Spawning getter /root/systemd/build/journalctl -o export -D /var/tmp/systemd-test.0UYjAS/root/var/log/journal/remote... Finishing after writing 0 entries -rw-r-----. 1 root root 25165824 Aug 20 12:26 /var/tmp/systemd-test.0UYjAS/system.journal TEST-01-BASIC RUN: Basic systemd setup [OK] ...
* Merge pull request #18385 from kinvolk/mauricio/restrict-network-interfacesLennart Poettering2021-08-201-0/+1
|\ | | | | Add RestrictNetworkInterfaces=
| * tests: add integration test for RestrictNetworkInterfaces=Mauricio Vásquez2021-08-191-0/+1
| | | | | | | | Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
* | Merge pull request #20436 from fbuihuu/add-no-build-support-on-opensuseLuca Boccassi2021-08-191-16/+65
|\ \ | |/ |/| Add no build support on opensuse
| * test: if haveged is part of initrd it needs to be installed in the image tooFranck Bui2021-08-181-0/+11
| | | | | | | | | | Otherwise haveged won't survive when switching root from initrd to host making haveged service in host fail.
| * test: adapt install_pam() for openSUSEFranck Bui2021-08-181-1/+8
| | | | | | | | | | | | On openSUSE the default pam config files are shipped in /usr/etc/pam.d. Also empty password is not allowed by default.
| * test: don't try to find BUILD_DIR when NO_BUILD is setFranck Bui2021-08-181-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | NO_BUILD=1 indicates that we want to test systemd from the local system and not the one from the local build. Hence there should be no need to call find-build-dir.sh when NO_BUID=1 especially since it's likely that the script will fail to find a local build in this case. This avoids find-build-dir.sh to emit 'Specify build directory with $BUILD_DIR' message when NO_BUILD=1 and no local build can be found. This introduces a behavior change though: systemd from the local system will always be preferred when NO_BUILD=1 even if a local build can be found.
| * test: add support for NO_BUILD=1 on openSUSEFranck Bui2021-08-181-8/+41
| |
* | extension-release: search for other files if expected name not foundLuca Boccassi2021-08-171-3/+4
|/ | | | | | | | | | | | In some cases image names are unpredictable - some orchestrators/deployment tools like to mangle names to suit their internal formats. In these cases, the requirement that the extension-release file matches exactly the image name where it's contained cannot work. Allow falling back to loading the first regular file which name starts with 'extension-release' located in /usr/lib/extension-release.d/ and tagged with a user.extension-release.strict extended attribute with a true value, if the one with the expected name cannot be found.
* test: use a correct kernel binary on ppc64le machinesFrantisek Sumsal2021-08-091-5/+7
| | | | | | | Ubuntu calls the kernel binary as `vmlinux-*`, but RHEL/CentOS uses the "standard" `vmlinuz-` prefix. Follow-up to eaa602cb14217f2623c9c8c44b6f3012dc4d0b24.
* Merge pull request #20399 from mrc0mmand/test-tweaksZbigniew Jędrzejewski-Szmek2021-08-091-2/+1
|\ | | | | test: yet another fix for ASan detection
| * test: make busybox TEST-13-only dependencyFrantisek Sumsal2021-08-081-1/+0
| | | | | | | | | | to make running other tests a bit easier on distributions which don't have busybox in repositories (CentOS).
| * test: yet another fix for ASan detectionFrantisek Sumsal2021-08-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This time for ppc64le: ``` 100737c4: 5d 55 f9 4b bl 10008d20 <00000024.plt_call.__asan_report_load8> 100737f4: 4d 55 f9 4b bl 10008d40 <00000024.plt_call.__asan_handle_no_return> 10073884: 5d 50 f9 4b bl 100088e0 <00000024.plt_call.__asan_init> 1007388c: 75 54 f9 4b bl 10008d00 <00000024.plt_call.__asan_version_mismatch_check_v8> 100738a0: 41 36 f9 4b bl 10006ee0 <00000024.plt_call.__asan_register_globals> 100738f0: 71 4c f9 4b bl 10008560 <00000024.plt_call.__asan_unregister_globals> ```
* | test: skip a harmless ldd error when installing test libsFrantisek Sumsal2021-08-091-0/+5
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | Skip a harmless error when running the tests on a system with a significantly older systemd version (ldd tries to resolve the unprefixed RPATH for libsystemd.so.0, which is in this case older than the already installed libsystemd.so.0 in $initdir). The issue is triggered by installing test dependencies in install_missing_libraries(). Spotted on CentOS 8. ``` $ ldd /var/tmp/systemd-test.nZO11F/root/lib/systemd/tests/test-sd-device-thread /var/tmp/systemd-test.nZO11F/root/lib/systemd/tests/test-sd-device-thread: /lib64/libsystemd.so.0: version `LIBSYSTEMD_240' not found (required by /var/tmp/systemd-test.nZO11F/root/lib/systemd/tests/test-sd-device-thread) linux-vdso64.so.1 (0x00007fffb79d0000) libclang_rt.asan-powerpc64le.so => /usr/lib64/clang/11.0.0/lib/linux/libclang_rt.asan-powerpc64le.so (0x00007fffb6ef0000) libsystemd.so.0 => /lib64/libsystemd.so.0 (0x00007fffb6d20000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fffb6cd0000) libc.so.6 => /lib64/libc.so.6 (0x00007fffb6ab0000) $ LD_LIBRARY_PATH=/var/tmp/systemd-test.nZO11F/root/lib64/ ldd /var/tmp/systemd-test.nZO11F/root/lib/systemd/tests/test-sd-device-thread linux-vdso64.so.1 (0x00007fffaba80000) libclang_rt.asan-powerpc64le.so => /usr/lib64/clang/11.0.0/lib/linux/libclang_rt.asan-powerpc64le.so (0x00007fffaafa0000) libsystemd.so.0 => /var/tmp/systemd-test.nZO11F/root/lib64/libsystemd.so.0 (0x00007fffaa5f0000) libpthread.so.0 => /var/tmp/systemd-test.nZO11F/root/lib64/libpthread.so.0 (0x00007fffaa5a0000) libc.so.6 => /var/tmp/systemd-test.nZO11F/root/lib64/libc.so.6 (0x00007fffaa380000) ```
* test: attempt to install only kernel modules for each subsystemFrantisek Sumsal2021-08-081-1/+1
| | | | | | | | | | | | | | | | | | | | When `linux-headers` is installed on Arch Linux, it stores the module source tree in the kernel module directory, which is then picked up by `find` and we get a lot of harmless but annoying errors: ``` ... modprobe: FATAL: Module Kconfig.iosched not found in directory /lib/modules/5.13.7-arch1-1 modprobe: FATAL: Module Kconfig not found in directory /lib/modules/5.13.7-arch1-1 modprobe: FATAL: Module Kconfig not found in directory /lib/modules/5.13.7-arch1-1 modprobe: FATAL: Module dm-mpath.h not found in directory /lib/modules/5.13.7-arch1-1 modprobe: FATAL: Module dm-bio-prison-v2.h not found in directory /lib/modules/5.13.7-arch1-1 modprobe: FATAL: Module raid0.h not found in directory /lib/modules/5.13.7-arch1-1 ... ``` Let's fix this by trying to install only kernel modules (*.ko files with an optional compression).
* test: correctly detect ASan on s390xFrantisek Sumsal2021-07-291-1/+1
| | | | | | | | | | | | | | | | | | s390x uses BRAS(L) instead of CALL(Q), e.g.: ``` 1009528: c0 e5 ff ff f8 a0 brasl %r14,1008668 <__asan_report_load1@plt> 10095f0: c0 e5 ff ff ea ec brasl %r14,1006bc8 <__asan_stack_malloc_4@plt> 10097f8: c0 e5 ff ff f8 f8 brasl %r14,10089e8 <__asan_report_load8@plt> ``` x86_64 for reference: ``` 4011f3: e8 48 fe ff ff callq 401040 <__asan_report_load1@plt> 401227: e8 24 fe ff ff callq 401050 <__asan_report_load8@plt> 401251: e8 da fd ff ff callq 401030 <__asan_init@plt> ```
* test: don't explicitly disable SELinuxFrantisek Sumsal2021-07-141-1/+0
| | | | | We don't install any policies by default, so it shouldn't interfere with anything (and it would save me some headache).
* test: strip binaries by defaultFrantisek Sumsal2021-07-091-0/+1
| | | | | Since 23f8e01 we always kept binaries unstripped, since $STRIP_BINARIES is unset by default.
* test: unify handling of boolean valuesFrantisek Sumsal2021-07-041-61/+81
| | | | | | | Let's unify handling of the boolean values throughout the test-functions code, since we use 0/1, true/false, and yes/no almost randomly in many places, so picking the right values during CI configuration can be a real pain.
* test: optionally, only save test journal for failing testsDan Streetman2021-07-031-9/+26
| | | | | | Saving the journal for passing tests creates a huge amount of unneeded data stored for each full test run. Add a env var to allow saving the journal only for failed tests.
* test: correctly mask supporting services in tests, take #2Frantisek Sumsal2021-06-241-1/+7
| | | | | | | | | Due to a little misunderstanding the last patch doesn't work as expected, since test_create_image() is called only for the first image (usually TEST-01-BASIC), and all subsequent images are then (possibly) modified with test_append_files(). Follow-up to 179ca4d2b1b5579014773a128462475f99b7a91b.