summaryrefslogtreecommitdiff
path: root/src/test
AgeCommit message (Collapse)Author
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt
As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
2014-11-27log: add an "error" parameter to all low-level logging calls and intrdouce ↵Lennart Poettering
log_error_errno() as log calls that take error numbers This change has two benefits: - The format string %m will now resolve to the specified error (or to errno if the specified error is 0. This allows getting rid of a ton of strerror() invocations, a function that is not thread-safe. - The specified error can be passed to the journal in the ERRNO= field. Now of course, we just need somebody to convert all cases of this: log_error("Something happened: %s", strerror(-r)); into thus: log_error_errno(-r, "Something happened: %m");
2014-11-27util: add function getting proc environJakub Filak
On the contrary of env, the added function returns all characters cescaped, because it improves reproducibility.
2014-11-23test: support empty environment variables in unit filesIago López Galeiras
Also update TODO, empty environment variables in Environment= and EnvironmentFile= options work.
2014-11-22Do not check for existence of remote binariesZbigniew Jędrzejewski-Szmek
systemd-run would fail when run with -M or -H and an absolute path, if this path did not exists locally. Allow it to continue, since we don't have a nice way of checking if the binary exists remotely. The case where -M or -H is used and a local path is unchanged, and we still iterate over $PATH to find the binary. We need to convert to an absolute path, and we don't have a nice mechanism to check remotely, so we assume that the binary will be located in the same place locally and remotely. http://lists.freedesktop.org/archives/systemd-devel/2014-November/025418.html
2014-11-21util: add functions getting proc cwd and rootJakub Filak
/proc/[pid]/cwd and /proc/[pid]/root are symliks to corresponding directories The added functions returns values of that symlinks.
2014-11-20tests: fix minor memory leakLennart Poettering
2014-11-13udev: support ENV{}=="" global property matchesKay Sievers
2014-11-13udev: move global property handling from libudev to udevdKay Sievers
2014-11-13udev: switch to systemd logging functionsKay Sievers
2014-11-13tests: add test-executeRonny Chevalier
add tests for the following directives: - WorkingDirectory - Personality - IgnoreSIGPIPE - PrivateTmp - SystemCallFilter: It makes test/TEST-04-SECCOMP obsolete, so it has been removed. - SystemCallErrorNumber - User - Group - Environment
2014-11-13manager: allow test run to catch SIGCHLD eventsRonny Chevalier
Otherwise we cannot know when a service exited
2014-11-10strv: rework strv_split_quoted() to use unquote_first_word()Lennart Poettering
This should make the unquoting scheme a bit less naive.
2014-11-08tests: add test-pathRonny Chevalier
It tests all available directives of Path units: - PathChanged - PathModified - PathExists - PathExisysGlob - DirectoryNotEmpty - MakeDirectory - DirectoryMode - Unit
2014-11-07util: rework /proc/cmdline parser to use unquote_first_word()Lennart Poettering
2014-11-07copy: teach copy_bytes() sendfile() support, and then replace ↵Lennart Poettering
sendfile_full() by it
2014-11-06shared: rename condition-util.[ch] to condition.[ch]Lennart Poettering
Now that we only have one file with condition implementations around, we can drop the -util suffix and simplify things a bit.
2014-11-06core: get rid of condition.c and move the remaining call into util.cLennart Poettering
That way only one file with condition code remaining, in src/shared/, rather than src/core/. Next step: dropping the "-util" suffix from condition-util.[ch].
2014-11-06core: introduce the concept of AssertXYZ= similar to ConditionXYZ=, but ↵Lennart Poettering
fatal for a start job if not met
2014-11-06condition: add more test casesLennart Poettering
2014-11-06condition: unify condition logic in one fileLennart Poettering
2014-11-06condition: properly allow passing back errors from condition checksLennart Poettering
2014-11-05condition: rewrite condition_test_kernel_command_line() based on ↵Lennart Poettering
unquote_first_word()
2014-11-05shared: unaligned - use void* instead of unaligned be16_t*Tom Gundersen
2014-11-05test: hashmap-plain - make coverity happyTom Gundersen
Check return value of hashmap_ensure_allocated(). CID#1250807.
2014-11-05test: fileio - make coverity happyTom Gundersen
Explicitly check the length of the read. Fixes CID#1250803.
2014-11-04test: use assert_se in test_hashmap_moveMichal Schmidt
2014-11-01shared: add helpers for unaligend BE read/writeTom Gundersen
2014-10-31Make bus errno mappings non-staticZbigniew Jędrzejewski-Szmek
__attribute__((used)) is not enough to force static variables to be carried over to a compiled program from a library. Mappings defined in libsystemd-shared.a were not visible in the compiled binaries. To ensure that the mappings are present in the final binary, the tables are made non-static and are given a real unique name by which they can be referenced. To use a mapping defined not in the local compilation unit (e.g. in a library) a reference to the mapping table is added. This is done by including a declaration in the header file. Expected values in test-engine are fixed to reflect the new mappings.
2014-10-31tests: add test-copyRonny Chevalier
2014-10-31tests: add tests for path_startswithRonny Chevalier
2014-10-31tests: add missing entry for LocalVariable to test-tablesRonny Chevalier
2014-10-31tests: add test-locale-utilRonny Chevalier
2014-10-31tests: add tests for strv.cRonny Chevalier
add tests for: - strv_find_startswith - strv_push_prepend - strv_consume_prepend
2014-10-31tests: add tests for fileio.cRonny Chevalier
add tests for the following functions: - write_string_file_no_create - load_env_file_pairs
2014-10-30test: test a corner case in hashmap_remove_and_replace()Michal Schmidt
2014-10-30test: adjust max load factor in test_hashmap_many()Michal Schmidt
A reimplementation of hashmaps will follow and it will use 0.8.
2014-10-27calendarspec: parse 'quarterly' and 'semi-annually' as shortcutsLennart Poettering
2014-10-23hashmap: allow hashmap_move() to failMichal Schmidt
It cannot fail in the current hashmap implementation, but it may fail in alternative implementations (unless a sufficiently large reservation has been placed beforehand).
2014-10-23test: add test for hashmap_reserve()Michal Schmidt
2014-10-23test: add and improve hashmap testsMichal Schmidt
Test more corner cases and error states in several tests. Add new tests for: hashmap_move hashmap_remove hashmap_remove2 hashmap_remove_value hashmap_remove_and_replace hashmap_get2 hashmap_first In test_hashmap_many additionally test with an intentionally bad hash function.
2014-10-23test: generate tests for OrderedHashmap from Hashmap testsMichal Schmidt
test-hashmap-ordered.c is generated from test-hashmap-plain.c simply by substituting "ordered_hashmap" for "hashmap" etc. In the cases where tests rely on the order of entries, a distinction between plain and ordered hashmaps is made using the ORDERED macro, which is defined only for test-hashmap-ordered.c.
2014-10-23mac: rename apis with mac_{selinux/smack}_ prefixWaLyong Cho
2014-10-17environment: append unit_id to error messages regarding EnvironmentFileLukas Nykryn
2014-10-12tests: fix some tests to pass in kojiZbigniew Jędrzejewski-Szmek
FAIL: test-engine ================= Cannot find cgroup mount point: No such file or directory Assertion 'r >= 0' failed at ../src/test/test-engine.c:46, function main(). Aborting. FAIL: test-sched-prio ===================== Cannot find cgroup mount point: No such file or directory Assertion 'r >= 0' failed at ../src/test/test-sched-prio.c:42, function main(). Aborting. FAIL: test-bus-cleanup ====================== Assertion 'sd_bus_open_system(&bus) >= 0' failed at ../src/libsystemd/sd-bus/test-bus-cleanup.c:40, function test_bus_open(). Aborting. after new: refcount 1
2014-10-04test: only use assert_seThomas Hindoe Paaboel Andersen
The asserts used in the tests should never be allowed to be optimized away
2014-10-03test-barrier: add checks after the barrier constructorThomas Hindoe Paaboel Andersen
Coverity seems to think that we can later end up with the "them" fd having a negative value. Even after a succesful barrier_create. Add some test to verify that the constructor went well. If coverity still complains then it must mean that it thinks the the value is overwritten later.
2014-10-01tests: add tests for {hashmap,set}_steal_firstZbigniew Jędrzejewski-Szmek
Just to make sure that coverity is wrong.