summaryrefslogtreecommitdiff
path: root/src/test
AgeCommit message (Collapse)AuthorFilesLines
2019-07-19Merge pull request #13096 from keszybz/unit-loadingZbigniew Jędrzejewski-Szmek10-202/+393
Preparatory work for the unit loading rework
2019-07-19test-fs-util: call test functions in order of declarationZbigniew Jędrzejewski-Szmek1-2/+2
2019-07-19Create src/shared/unit-file.[ch] for unit-file related opsZbigniew Jędrzejewski-Szmek1-0/+1
So far we put such functinos in install.[ch], but that is tied too closely to enable/disable. Let's start moving things to a place with a better name.
2019-07-19Rename test-unit-file to test-load-fragmentZbigniew Jędrzejewski-Szmek2-1/+1
This file was testing a mix of functions from src/core/load-fragment.c and some from src/shared/install.c. Let's name it more appropriately. I want to add tests for the new unit-file.c too.
2019-07-19test-unit-file: move some tests to new test-env-file.cZbigniew Jędrzejewski-Szmek3-130/+147
2019-07-19test-hashmap: move tests which should also apply to ordered hashmaps and add ↵Zbigniew Jędrzejewski-Szmek2-58/+66
comment Effectively this does two more tests also for ordered hashmaps. This setup is a bit confusing, let's add a comment.
2019-07-19basic/hashmap: add hashops variant that does strdup/freeing on its ownZbigniew Jędrzejewski-Szmek1-0/+28
So far, we'd use hashmap_free_free to free both keys and values along with the hashmap. I think it's better to make this more encapsulated: in this variant the way contents are freed can be decided when the hashmap is created, and users of the hashmap can always use hashmap_free.
2019-07-19test-strv: add function headersZbigniew Jędrzejewski-Szmek1-7/+86
2019-07-19basic/unit-name: allow unit_name_to_instance() to be used to classify unitsZbigniew Jędrzejewski-Szmek1-4/+6
This could already be done by calling unit_name_is_*(), but if we don't know if the argument is a valid unit name, it is more convenient to have a single function which returns the type or possibly an error if the unit name is not valid. The values in the enum are sorted "by length". Not really important, but it seems more natural to me.
2019-07-19path-util: add path_startswith_strv()Zbigniew Jędrzejewski-Szmek1-0/+23
2019-07-19test-path-util: add function headersZbigniew Jędrzejewski-Szmek1-0/+33
2019-07-18meson: make nologin path build time configurableMichael Biebl1-2/+2
Some distros install nologin as /usr/sbin/nologin, others as /sbin/nologin. Since we can't really on merged-usr everywhere (where the path wouldn't matter), make the path build time configurable via -Dnologin-path=. Closes #13028
2019-07-17Merge pull request #13092 from keszybz/coverity-fixesLennart Poettering1-0/+24
Coverity fixes
2019-07-17shared/conf-parser,networkd: EXTRACT_UNQUOTE|EXTRACT_RETAIN_ESCAPE → ↵Zbigniew Jędrzejewski-Szmek1-0/+24
EXTRACT_UNQUOTE It's hard to even say what exactly this combination means. Escaping is necessary when quoting to have quotes within the string. So the escaping of quote characters is inherently tied to quoting. When unquoting, it seems natural to remove escaping which was done for the quoting purposes. But with both flags we would be expected to re-add this escaping after unqouting? Or maybe keep the escaping which is not necessary for quoting but otherwise present? This all seems too complicated, let's just forbid such usage and always fully unescape when unquoting.
2019-07-17core: ExecCondition= for servicesAnita Zhang1-2/+48
Closes #10596
2019-07-16format-table: add some minimal testing for new table_add_many() featuresLennart Poettering1-5/+6
2019-07-16test: make sure colors don't confuse our testLennart Poettering1-0/+1
2019-07-15tree-wide: drop duplicated blank linesYu Watanabe3-3/+0
``` $ for i in */*.[ch] */*/*.[ch]; do sed -e '/^$/ {N; s/\n$//g}' -i $i; done $ git checkout HEAD -- basic/linux shared/linux ```
2019-07-12test: modernize test-alloc-util.c test a bitLennart Poettering1-4/+4
2019-07-12Merge pull request #13022 from keszybz/coverity-cleanupsLennart Poettering4-8/+8
Coverity cleanups
2019-07-12tree-wide: get rid of strappend()Lennart Poettering4-23/+6
It's a special case of strjoin(), so no need to keep both. In particular as typing strjoin() is even shoert than strappend().
2019-07-12test-process-util: invert reporting to make sure that we're not dividing by 0Zbigniew Jędrzejewski-Szmek1-2/+2
CID#1402334.
2019-07-12test: minor modernizationZbigniew Jędrzejewski-Szmek2-5/+5
Coverity was complaining that read() does not terminate the data. But we did that termination earlier, so covirity is wrong (CID#1402306, CID#1402340). Let's modernize the style a bit nevertheless. (size_t) cast is needed to avoid the warning about comparison, iff the value is not a constant.
2019-07-11Merge pull request #12461 from Werkov/fix-job-orderingLennart Poettering1-1/+27
Refactor job ordering implementation (and fix cycle detection)
2019-07-11test-alloc-util: assert on the return value to appease coverityZbigniew Jędrzejewski-Szmek1-1/+1
Coverity is right that we should check the return value… CID#1403006.
2019-07-11Merge pull request #13011 from keszybz/auto-eraseLennart Poettering2-33/+9
Remove string_erase and friends
2019-07-11Merge pull request #12926 from keszybz/urlify-logsLennart Poettering1-0/+11
Urlify CONFIG_FILE and improve SYSTEMD_LOG_LOCATION
2019-07-10Merge pull request #12965 from keszybz/auto-eraseLennart Poettering1-0/+16
_cleanup_(erase_and_freep)
2019-07-10test-strv: test strv_free_erase() a little bitZbigniew Jędrzejewski-Szmek1-9/+9
2019-07-10Remove string_eraseZbigniew Jędrzejewski-Szmek1-24/+0
2019-07-10test: add _cleanup_(erase_and_freep)Zbigniew Jędrzejewski-Szmek1-0/+16
Based on the macro and test case by Lennart Poettering and Topi Miettinen suggestion.
2019-07-05tree-wide: introduce strerror_safe()Yu Watanabe3-9/+11
2019-07-05sd-event: replace snprintf() with strpcpyf()Yu Watanabe1-0/+21
2019-07-04basic/log: add a define for path relative to source rootZbigniew Jędrzejewski-Szmek1-0/+11
When using build/ directory inside of the source directory: __FILE__: ../src/test/test-log.c RELATIVE_SOURCE_PATH: .. PROJECT_FILE: src/test/test-log.c When using a build directory outside of the source directory: __FILE__: ../../../home/zbyszek/src/systemd-work/src/test/test-log.c RELATIVE_SOURCE_PATH: ../../../home/zbyszek/src/systemd-work PROJECT_FILE: src/test/test-log.c
2019-06-30Merge pull request #12903 from keszybz/condition-quotingYu Watanabe4-82/+104
Condition quoting
2019-06-29test-condition: do not accidentally treat error as passing conditionZbigniew Jędrzejewski-Szmek1-51/+51
condition_test returns 0, 1, or error.
2019-06-29Treat kernel version condition as a list of quoted checksZbigniew Jędrzejewski-Szmek1-1/+23
Before only one comparison was allowed. Let's make this more flexible: ConditionKernelVersion = ">=4.0" "<=4.5" Fixes #12881. This also fixes expressions like "ConditionKernelVersion=>" which would evaluate as true.
2019-06-28Merge pull request #12887 from fbuihuu/coredump-cleanup-part-1Zbigniew Jędrzejewski-Szmek1-2/+2
Coredump cleanup part 1
2019-06-28Rename EXTRACT_QUOTES to EXTRACT_UNQUOTEZbigniew Jędrzejewski-Szmek3-30/+30
Whenever I see EXTRACT_QUOTES, I'm always confused whether it means to leave the quotes in or to take them out. Let's say "unquote", like we say "cunescape".
2019-06-27journal-import: extract helpers for handling arrays of iovec and make them ↵Franck Bui1-2/+2
available for others
2019-06-27Merge pull request #12890 from yuwata/fix-conf-parser-12883Zbigniew Jędrzejewski-Szmek1-6/+13
conf-parse: fix continuation handling
2019-06-27test: fix argument type of test_format_bytes_one()Yu Watanabe1-7/+8
Closes #12891.
2019-06-27util,test: rename variable non_iec -> siYu Watanabe1-3/+3
2019-06-26tests: Check trivial loop between two jobsMichal Koutný1-1/+11
job_compare return value is undefined in case the jobs have a loop between them, so better make a test to make sure transaction cycle detection catches it.
2019-06-26tests: Check job ordering on execution cyclesMichal Koutný1-1/+17
The test-engine Test2 tests the cycle detection when units a, b and d all start at once ,-------------------after-----------------, v | a/start ---after---> d/start ---after---> b/start Extend the test with Test11 that adds i.service which causes a and d stop (by unordered Conflicts=) while starting b. Because stops precede starts, we effectively eliminate the job cycle and all transaction jobs should be applicable. ,-------------------after-----------------, v | a/stop <---after--- d/stop <---after--- b/start . . ^ . . | '. . . . . . . . . i/start ---after------'
2019-06-27test: add testcase for issue #12883Yu Watanabe1-6/+13
2019-06-25bpf-firewall: custom BPF programs through IP(Ingress|Egress)FilterPath=Kai Lüke1-3/+50
Takes a single /sys/fs/bpf/pinned_prog string as argument, but may be specified multiple times. An empty assignment resets all previous filters. Closes https://github.com/systemd/systemd/issues/10227
2019-06-24test: add more testcases for prefix_roota()Yu Watanabe1-0/+3
2019-06-21path-util: get rid of prefix_root()Lennart Poettering2-8/+8
prefix_root() is equivalent to path_join() in almost all ways, hence let's remove it. There are subtle differences though: prefix_root() will try shorten multiple "/" before and after the prefix. path_join() doesn't do that. This means prefix_root() might return a string shorter than both its inputs combined, while path_join() never does that. I like the path_join() semantics better, hence I think dropping prefix_root() is totally OK. In the end the strings generated by both functon should always be identical in terms of path_equal() if not streq(). This leaves prefix_roota() in place. Ideally we'd have path_joina(), but I don't think we can reasonably implement that as a macro. or maybe we can? (if so, sounds like something for a later PR) Also add in a few missing OOM checks
2019-06-19test: add tests for format_bytes()Yu Watanabe2-0/+42