summaryrefslogtreecommitdiff
path: root/src/test
Commit message (Collapse)AuthorAge
* path-util: some updates to path_make_relative()Lennart Poettering2017-11-22
| | | | | | | | | | Don't miscount number of "../" to generate, if we "." is included in an input path. Also, refuse if we encounter "../" since we can't possibly follow that up properly, without file system access. Some other modernizations.
* set: add new helper set_make() which is like set_new() + multiple set_put() ↵Lennart Poettering2017-11-22
| | | | in vararg
* fileio: return 0 from read_one_line_file on successZbigniew Jędrzejewski-Szmek2017-11-22
| | | | Fixup for f4b51a2d09. Suggested by Evgeny Vereshchagin.
* Add test for eBPF firewall codeDaniel Mack2016-11-03
|
* cgroup, unit, fragment parser: make use of new firewall functionsDaniel Mack2017-11-21
|
* Add abstraction model for BPF programsDaniel Mack2017-11-20
| | | | | This object takes a number of bpf_insn members and wraps them together with the in-kernel reference id. Will be needed by the firewall code.
* in-addr-util: add new helper call in_addr_prefix_from_string_auto()Lennart Poettering2017-11-20
| | | | | | This is much like in_addr_prefix_from_string(), but automatically determines whether IPv4 or IPv6 addresses are specified. Also adds a test for it.
* v235: Added missing updatesSven Eden2017-11-19
|
* test-conf-parser: add tests for the new long lines, including overflow handlingZbigniew Jędrzejewski-Szmek2017-09-25
|
* test-conf-parser: use _cleanup_Zbigniew Jędrzejewski-Szmek2017-09-21
|
* test-conf-parser: add some basic tests for config_parse()Zbigniew Jędrzejewski-Szmek2017-09-25
| | | | | | | This function is pretty important, but we weren't calling it directly even once in tests. v2: add a few tests for escaping and line continuations
* test-exec-util: add two test cases for scripts masked with empty fileZbigniew Jędrzejewski-Szmek2017-09-17
| | | | | | A test for #6831. Fails without the previous commit. Suggested by Evgeny Vereshchagin.
* exec-util,conf-files: skip non-executable files in execute_directories()Lennart Poettering2017-09-25
| | | | Fixes: #6787
* Prep v235: Apply pending upstream updates in src/test [4/4]Sven Eden2017-08-30
|
* Prep v235: Add missing includes and dependencies.Sven Eden2017-08-14
|
* Prep v235: Apply upstream fixes (9/10) [src/test]Sven Eden2017-08-14
|
* Prep v235: Remove superfluous .gitignore filesSven Eden2017-08-14
|
* tests: when running a manager object in a test, migrate to private cgroup ↵Lennart Poettering2017-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | subroot first (#6576) Without this "meson test" will end up running all tests in the same cgroup root, and they all will try to manage it. Which usually isn't too bad, except when they end up clearing up each other's cgroups. This race is hard to trigger but has caused various CI runs to fail spuriously. With this change we simply move every test that runs a manager object into their own private cgroup. Note that we don't clean up the cgroup at the end, we leave that to the cgroup manager around it. This fixes races that become visible by test runs throwing out errors like this: ``` exec-systemcallfilter-failing.service: Passing 0 fds to service exec-systemcallfilter-failing.service: About to execute: /bin/echo 'This should not be seen' exec-systemcallfilter-failing.service: Forked /bin/echo as 5693 exec-systemcallfilter-failing.service: Changed dead -> start exec-systemcallfilter-failing.service: Failed to attach to cgroup /exec-systemcallfilter-failing.service: No such file or directory Received SIGCHLD from PID 5693 ((echo)). Child 5693 ((echo)) died (code=exited, status=219/CGROUP) exec-systemcallfilter-failing.service: Child 5693 belongs to exec-systemcallfilter-failing.service exec-systemcallfilter-failing.service: Main process exited, code=exited, status=219/CGROUP exec-systemcallfilter-failing.service: Changed start -> failed exec-systemcallfilter-failing.service: Unit entered failed state. exec-systemcallfilter-failing.service: Failed with result 'exit-code'. exec-systemcallfilter-failing.service: cgroup is empty Assertion 'service->main_exec_status.status == status_expected' failed at ../src/src/test/test-execute.c:71, function check(). Aborting. ``` BTW, I tracked this race down by using perf: ``` # perf record -e cgroup:cgroup_mkdir,cgroup_rmdir … # perf script ``` Thanks a lot @iaguis, @alban for helping me how to use perf for this. Fixes #5895.
* Drop kdbus bitsZbigniew Jędrzejewski-Szmek2017-08-10
| | | | | | | | | Some kdbus_flag and memfd related parts are left behind, because they are entangled with the "legacy" dbus support. test-bus-benchmark is switched to "manual". It was already broken before (in the non-kdbus mode) but apparently nobody noticed. Hopefully it can be fixed later.
* test-hashmap: use $SYSTEMD_SLOW_TESTS variableZbigniew Jędrzejewski-Szmek2017-08-10
| | | | | test-hashmap is a very good test, but it gets in the way when one wants to compile and quickly test changes.
* General: Update build system to upstream support of meson+ninja.Sven Eden2017-08-04
| | | | | | | | Upstream thinks, that the auto tools are too 'legacy', or that they are at least no longer fitting. We follow, as the classic auto tools files have been removed, so no other choice here...
* Prep v234: Apply missing upstream fixes in src/test (6/6)Sven Eden2017-07-25
|
* Prep v234: Update root build files to upstream.Sven Eden2017-07-25
|
* test-fs-util: re-order test_readlink_and_make_absolute and ↵Mike Gilbert2017-07-25
| | | | | | | | | | | | | | | | | | | test_get_files_in_directory (#6288) test_readlink_and_make_absolute switches to a temp directory, and then removes it. test_get_files_in_directory calls opendir(".") from a directory that has been removed from the filesystem. This call sequence triggers a bug in Gentoo's sandbox library. This library attempts to resolve the "." to an absolute path, and aborts when it ultimately fails to do so. Re-ordering the calls works around the issue until the sandbox library can be fixed to more gracefully deal with this. Bug: https://bugs.gentoo.org/590084
* tests: add tests for environment serializationZbigniew Jędrzejewski-Szmek2017-07-25
|
* basic/path-util: allow flags for path_equal_or_files_sameZbigniew Jędrzejewski-Szmek2017-07-25
| | | | | No functional change, just a new parameters and the tests that AT_SYMLINK_NOFOLLOW works as expected.
* Use "dollar-single-quotes" to escape shell-sensitive stringsZbigniew Jędrzejewski-Szmek2017-07-25
| | | | | | | | | | | | | | | | | | | | | | | | | Also called "ANSI-C Quoting" in info:(bash) ANSI-C Quoting. The escaping rules are a POSIX proposal, and are described in http://austingroupbugs.net/view.php?id=249. There's a lot of back-and-forth on the details of escaping of control characters, but we'll be only using a small subset of the syntax that is common to all proposals and is widely supported. Unfortunately dash and fish and maybe some other shells do not support it (see the man page patch for a list). This allows environment variables to be safely exported using show-environment and imported into the shell. Shells which do not support this syntax will have to do something like export $(systemctl show-environment|grep -v '=\$') or whatever is appropriate in their case. I think csh and fish do not support the A=B syntax anyway, so the change is moot for them. Fixes #5536. v2: - also escape newlines (which currently disallowed in shell values, so this doesn't really matter), and tabs (as $'\t'), and ! (as $'!'). This way quoted output can be included directly in both interactive and noninteractive bash.
* test-parse-util: verify that ato[ui] actually rejects trailing garbageZbigniew Jędrzejewski-Szmek2017-07-25
|
* test-conf-parser: add valid and invalid utf8 test for config_parse_pathRonny Chevalier2017-07-25
|
* conf-parser: fix wrong argument given to log_syntax_invalid_utf8Ronny Chevalier2017-07-25
| | | | | | | | | | The condition is on "word", hence we give word instead of rvalue. An assert would be triggered if !utf8_is_valid(word) is true and rvalue == NULL, since log_syntax_invalid_utf8 calls utf8_escape_invalid which calls assert(str). A test case has been added to test with valid and invalid utf8.
* Revert "selinux: split up mac_selinux_have() from mac_selinux_use()"Gary Tierney2017-07-25
| | | | | | | | | | | | | | | This reverts commit 6355e75610a8d47fc3ba5ab8bd442172a2cfe574. The previously mentioned commit inadvertently broke a lot of SELinux related functionality for both unprivileged users and elogind instances running as MANAGER_USER. In particular, setting the correct SELinux context after a User= directive is used would fail to work since we attempt to set the security context after changing UID. Additionally, it causes activated socket units to be mislabeled for elogind --user processes since setsockcreatecon() would never be called. Reverting this fixes the issues with labeling outlined above, and reinstates SELinux access checks on unprivileged user services.
* parse-util: introduce parse_dev() helperFranck Bui2017-07-25
|
* tmpfiles: use safe_glob()Zbigniew Jędrzejewski-Szmek2017-07-25
| | | | | | | | | | | | This filters out "." and ".." from glob results. Fixes #5655 and #5644. Any judgements on whether the path is "safe" are removed. We will not remove "/" under any name (including "/../" and such), but we will remove stuff that is specified using paths that include "//", "/./" and "/../". Such paths can be created when joining strings automatically, or for other reasons, and people generally know what ".." and "." is. Tests are added to make sure that the helper functions behave as expected.
* test-sizeof: print the size of an enumZbigniew Jędrzejewski-Szmek2017-07-25
|
* test-exec-util: drop duplicate constZbigniew Jędrzejewski-Szmek2017-07-25
| | | | gcc-7 warns about this with -Wduplicate-decl-specifier.
* test-sizeof: add some struct-timespec related fieldsZbigniew Jędrzejewski-Szmek2017-07-25
| | | | Might help with #5264.
* test-sizeof: do not link with libelogind-sharedZbigniew Jędrzejewski-Szmek2017-07-25
| | | | This makes it much quicker to compile.
* test: skip instead of fail if crypto kmods are not availableMartin Pitt2017-07-25
| | | | | | | | Package build machines may have module loading disabled, thus AF_ALG sockets are not available. Skip the tests that cover those (khash and id128) instead of failing them in this case. Fixes #5524
* basic/log: split max log level into multiple "realms"Zbigniew Jędrzejewski-Szmek2017-07-25
| | | | | | | | | | | | | | The single log level is split into an array of log levels. Which index in the array is used can be determined for each compilation unit separately by setting a macro before including log.h. All compilation units use the same index (LOG_REALM_SYSTEMD), so there should be no functional change. v2: - the "realm" is squished into the level (upper bits that are not used by priority or facility), and unsquished later in functions in log.c. v3: - rename REALM_PLUS_LEVEL to LOG_REALM_PLUS_LEVEL and REALM to LOG_REALM_REMOVE_LEVEL.
* Prep v233.3: Add all possible coverage tests for elogindSven Eden2017-07-20
|
* Prep v233.3: Remove obsolete test-hash.cSven Eden2017-07-18
|
* core: add "khash" API to src/basic/ (as wrapper around kernel AF_ALG)Lennart Poettering2017-07-17
| | | | | | | | | | | | | | | | | Let's take inspiration from bluez's ELL library, and let's move our cryptographic primitives away from libgcrypt and towards the kernel's AF_ALG cryptographic userspace API. In the long run we should try to remove the dependency on libgcrypt, in favour of using only the kernel's own primitives, however this is unlikely to happen anytime soon, as the kernel does not provide Elliptic Curve APIs to userspace at this time, and we need them for the DNSSEC cryptographic. This commit only covers hashing for now, symmetric encryption/decryption or even asymetric encryption/decryption is not available for now. "khash" is little more than a lightweight wrapper around the kernel's AF_ALG socket API.
* Remove src/testAndy Wingo2015-04-19
|
* fix gcc warnings about uninitialized variablesHarald Hoyer2015-03-27
| | | | | | | | | | | | | like: src/shared/install.c: In function ‘unit_file_lookup_state’: src/shared/install.c:1861:16: warning: ‘r’ may be used uninitialized in this function [-Wmaybe-uninitialized] return r < 0 ? r : state; ^ src/shared/install.c:1796:13: note: ‘r’ was declared here int r; ^
* util: rework word parsing and c unescaping codeLennart Poettering2015-03-26
| | | | | | | | | | | When parsing words from input files, optionally automatically unescape the passed strings, controllable via a new flags parameter. Make use of this in tmpfiles, and port everything else over, too. This improves parsing quite a bit, since we no longer have to process the same string multiple times with different calls, where an earlier call might corrupt the input for a later call.
* libudev: private - introduce udev_device_new_from_synthetic_event()Tom Gundersen2015-03-18
| | | | This allows set_action(), read_uevent_file() and read_db() to be made internal to libudev.
* shared: add path_compare(), an ordering path comparisonMichal Schmidt2015-03-16
| | | | ... and make path_equal() a simple wrapper around it.
* bus: stop using EDEADLOCKDavid Herrmann2015-03-13
| | | | | | | The error code is called EDEADLK, stop using legacy names like EDEADLOCK. Note that _some_ weird architectures define them differently (namely, mips and sparc), but on all sane architectures they're exactly the same. So stay with the widely used code, which is EDEADLK.
* shared: the btrfs quota field is called "referenced" not "referred"Lennart Poettering2015-03-10
|
* test-hashmap: fix gcc5 warningDaniel Mack2015-02-24
| | | | | | | | gcc5 spits out a warning about test-hashmap.c: CC src/test/test-hashmap.o src/test/test-hashmap.c: In function ‘test_string_compare_func’: src/test/test-hashmap.c:76:79: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]