summaryrefslogtreecommitdiff
path: root/src/test
Commit message (Collapse)AuthorAge
* 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]
* test-time: test "infinity" parsing in nanosecondsDaniel Mack2015-02-24
|
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-23
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* test: utf8 - fix utf16 tests on BE machinesTom Gundersen2015-02-18
|
* test-util: remove superfluous constThomas Hindoe Paaboel Andersen2015-02-12
|
* cg_path_get_user_unit(): Did not correctly parse user-unit templates.Luke Shumaker2015-02-04
| | | | | | | It ran either skip_session() or skip_user_manager(), then ran skip_slices() iff skip_session() ran. It needs to run skip_slices() in either case. Included is a test case demonstrating why.
* shared/async: simplify asynchronous_job a bitZbigniew Jędrzejewski-Szmek2015-02-02
|
* util: rework strappenda(), and rename it strjoina()Lennart Poettering2015-02-03
| | | | | | After all it is now much more like strjoin() than strappend(). At the same time, add support for NULL sentinels, even if they are normally not necessary.
* test: duplicate LIST_FOREACH_OTHERS test to check for corner cases of end ↵Lennart Poettering2015-01-28
| | | | and start of list
* list: add macro for iterating through a list an item is in, skipping the itemLennart Poettering2015-01-28
|
* tests: use assert_se instead of assertRonny Chevalier2015-01-22
| | | | Otherwise they can be optimized away with -DNDEBUG
* Assorted format fixesZbigniew Jędrzejewski-Szmek2015-01-22
| | | | | Types used for pids and uids in various interfaces are unpredictable. Too bad.
* util: make http url validity checks more generic, and move them to util.cLennart Poettering2015-01-20
|
* import-raw: when downloading raw images, generate sparse files if we canLennart Poettering2015-01-19
|
* Revert "test-exec: do not skip all the tests"David Herrmann2015-01-18
| | | | | | | | | | This reverts commit 68e68ca8106e7cd874682ae425843b48579c6539. We *need* root access to create cgroups. The only exception is if it is run from within a cgroup with "Delegate=yes". However, this is not always true and we really shouldn't rely on this. If your terminal runs from within a systemd --user instance, you're fine. Everyone else is not (like running from ssh, VTs, and so on..).
* remove unneeded libgen.h includesCristian Rodríguez2015-01-17
|
* test-path: do not skip tests if we are not rootRonny Chevalier2015-01-15
| | | | We can properly run the tests without being root
* test-exec: do not skip all the testsRonny Chevalier2015-01-15
| | | | | Only 5 tests cannot be executed if we are not root, so just skip them but not the whole set.
* test: hashmap_put behaviour for equal keysMartin Pitt2015-01-14
| | | | | Check string ops hashmap_put() for keys with a different pointer but the same value.
* shared: add minimal firewall manipulation helpers for establishing NAT ↵Lennart Poettering2015-01-13
| | | | rules, using libiptc
* fstab-util: fix priority parsing and add testZbigniew Jędrzejewski-Szmek2015-01-11
|
* shared/util: respect buffer boundary on incomplete escape sequencesZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | | cunescape_length_with_prefix() is called with the length as an argument, so it cannot rely on the buffer being NUL terminated. Move the length check before accessing the memory. When an incomplete escape sequence was given at the end of the buffer, c_l_w_p() would read past the end of the buffer. Fix this and add a test.
* core/load-fragment: avoid allocating 0 bytes when given an invalid commandZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | With a command line like "@/something" we would allocate an array with 0 elements. Avoid that, and add a test too.
* test-unit-file: don't access out-of-bounds memoryZbigniew Jędrzejewski-Szmek2015-01-11
| | | | Fixes an error introduced by me when the test was added.
* Support negated fstab optionsZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | We would ignore options like "fail" and "auto", and for any option which takes a value the first assignment would win. Repeated and options equivalent to the default are rarely used, but they have been documented forever, and people might use them. Especially on the kernel command line it is easier to append a repeated or negated option at the end.
* Add new function to filter fstab optionsZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | | | | | | | | | | | | This fixes parsing of options in shared/generator.c. Existing code had some issues: - it would treate whitespace and semicolons as seperators. fstab(5) is pretty clear that only commas matter. And the syntax does not allow for spaces to be inserted in the field in fstab. Whitespace might be escaped, but then it should not seperate options. Treat whitespace and semicolons as any other character. - it assumed that x-systemd.device-timeout would always be followed by "=". But this is not guaranteed, hasmntopt will return this option even if there's no value. Uninitialized memory could be read. - some error paths would log, and inconsistently, some would just return an error code. Filtering is split out to a separate function and tests are added. Similar code paths in other places are adjusted to use the new function.
* shared/list: add LIST_APPENDZbigniew Jędrzejewski-Szmek2015-01-11
|
* test-path-lookup: add simple test for path lookup functionsZbigniew Jędrzejewski-Szmek2015-01-11
|
* test-util: make sure that masking and overriding worksZbigniew Jędrzejewski-Szmek2015-01-11
|
* Implement masking and overriding of generatorsZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | | | | | | | | | | | | | | Sometimes it is necessary to stop a generator from running. Either because of a bug, or for testing, or some other reason. The only way to do that would be to rename or chmod the generator binary, which is inconvenient and does not survive upgrades. Allow masking and overriding generators similarly to units and other configuration files. For the systemd instance, masking would be more common, rather than overriding generators. For the user instances, it may also be useful for users to have generators in $XDG_CONFIG_HOME to augment or override system-wide generators. Directories are searched according to the usual scheme (/usr/lib, /usr/local/lib, /run, /etc), and files with the same name in higher priority directories override files with the same name in lower priority directories. Empty files and links to /dev/null mask a given name. https://bugs.freedesktop.org/show_bug.cgi?id=87230
* Simplify execute_directory()Zbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | Remove the optional sepearate opening of the directory, it would be just too complicated with the change to multiple directories. Move the middle of execute_directory() to a seperate function to make it easier to grok.
* logind: unify how we cast between uid_t and pointers for hashmap keysLennart Poettering2015-01-09
|
* machined: when cloning a raw disk image, also set the NOCOW flagLennart Poettering2015-01-08
|
* test-verbs: add unit tests for verbs minilibDave Reisner2015-01-08
|
* util: make use of kcmp() to compare fds, if it is availableLennart Poettering2015-01-07
|
* journald: process SIGBUS for the memory maps we set upLennart Poettering2015-01-05
| | | | | | | | | | | | | | Even though we use fallocate() it appears that file systems like btrfs will trigger SIGBUS on certain low-disk-space situation. We should handle that, hence catch the signal, add it to a list of invalidated pages, and replace the page with an empty memory area. After each write check if SIGBUS was triggered, and consider the write invalid if it was. This should make journald a lot more robust with file systems where fallocate() is not reliable, for example all CoW file systems (btrfs...), where changing written data can fail with disk full errors. https://bugzilla.redhat.com/show_bug.cgi?id=1045810
* tree-wide: spelling fixesVeres Lajos2014-12-30
| | | | | | | https://github.com/vlajos/misspell_fixer https://github.com/torstehu/systemd/commit/b6fdeb618cf2f3ce1645b3315f15f482710c7ffa Thanks to Torstein Husebo <torstein@huseboe.net>.
* macro: add DIV_ROUND_UP()David Herrmann2014-12-30
| | | | | | | | | | | | | | | | This macro calculates A / B but rounds up instead of down. We explicitly do *NOT* use: (A + B - 1) / A as it suffers from an integer overflow, even though the passed values are properly tested against overflow. Our test-cases show this behavior. Instead, we use: A / B + !!(A % B) Note that on "Real CPUs" this does *NOT* result in two divisions. Instead, instructions like idivl@x86 provide both, the quotient and the remainder. Therefore, both algorithms should perform equally well (I didn't verify this, though).
* capability: use /proc/sys/kernel/cap_last_capDavid Herrmann2014-12-29
| | | | | | | | | | | This file was introduced with linux-3.2, use it instead of probing for it via prctl(PR_CAPBSET_READ). For now, keep the old code for backwards compat. We can drop it once 3.2 is our lowest requirement. The test-cap-list code is extended to verify cap_last_cap() is the same as we'd get via prctl probing and /proc.
* test: loopback - parse logging env varTom Gundersen2014-12-29
|
* machined: add support for reporting image size via btrfs quotaLennart Poettering2014-12-28
|
* tmpfiles: add new line type 'v' for creating btrfs subvolumesLennart Poettering2014-12-28
|
* test: improve btrfs test caseLennart Poettering2014-12-26
|
* test: wait for cloned thread to exitFilipe Brandenburger2014-12-25
| | | | | | | | | | | | | | | | | | In test_raw_clone, make sure the cloned thread calls _exit() and in the parent thread call waitpid(..., __WCLONE) to wait for the child thread to terminate, otherwise there is a race condition where the child thread will log to the console after the test process has already exited and the assertion from the child thread might not be enforced. The absence of this patch might also create problems for other tests that would be added after this one, since potentially both parent and child would run those tests as the child would continue running. Tested by confirming that the logs from the child are printed before the test terminates and that a false assertion in the child aborts the test with a core dump. [zj: also add check for the return value.]
* test: only use assert_se in test_raw_cloneFilipe Brandenburger2014-12-25
| | | | The asserts used in the tests should never be allowed to be optimized away.
* test: do not use last cap from kernel in test-cap-listFilipe Brandenburger2014-12-25
| | | | | | | | | | | | | | | The new test-cap-list introduced in commit 2822da4fb7f891 uses the included table of capabilities. However, it uses cap_last_cap() which probes the kernel for the last available capability. On an older kernel (e.g. 3.10 from RHEL 7) that causes the test to fail with the following message: Assertion '!capability_to_name(cap_last_cap()+1)' failed at src/test/test-cap-list.c:30, function main(). Aborting. Fix it by exporting the size of the static table and using it in the test instead of the dynamic one from the current kernel. Tested by successfully running ./test-cap-list and the whole `make check` test suite with this patch on a RHEL 7 host.
* machined: beef up machined image listing with creation/modification times of ↵Lennart Poettering2014-12-25
| | | | | | | subvolumes We make use of the btrfs subvol crtime for this, and for gpt images of a manually managed xattr, if we can.
* env-util: don't include files from src/core/Lennart Poettering2014-12-23
|