summaryrefslogtreecommitdiff
path: root/src/test
AgeCommit message (Collapse)Author
2014-02-08core: do not print invalid utf-8 in error messagesZbigniew Jędrzejewski-Szmek
2014-01-31use memzero(foo, length); for all memset(foo, 0, length); callsGreg KH
In trying to track down a stupid linker bug, I noticed a bunch of memset() calls that should be using memzero() to make it more "obvious" that the options are correct (i.e. 0 is not the length, but the data to set). So fix up all current calls to memset(foo, 0, length) to memzero(foo, length).
2014-01-28Get rid of write_safeZbigniew Jędrzejewski-Szmek
Current glibc implementation is safe. Kernel does this atomically, and write is actually implemented through writev. So if write is async-signal-safe, than writev pretty much must be too.
2014-01-28always use the same code for creating temporary filesLennart Poettering
Let's unify our code here, and also always specifiy O_CLOEXEC.
2014-01-27journal: guarantee async-signal-safety in sd_journald_sendvZbigniew Jędrzejewski-Szmek
signal(7) provides a list of functions which may be called from a signal handler. Other functions, which only call those functions and don't access global memory and are reentrant are also safe. sd_j_sendv was mostly OK, but would call mkostemp and writev in a fallback path, which are unsafe. Being able to call sd_j_sendv in a async-signal-safe way is important because it allows it be used in signal handlers. Safety is achieved by replacing mkostemp with open(O_TMPFILE) and an open-coded writev replacement which uses write. Unfortunately, O_TMPFILE is only available on kernels >= 3.11. When O_TMPFILE is unavailable, an open-coded mkostemp is used. https://bugzilla.gnome.org/show_bug.cgi?id=722889
2014-01-20exec: introduce PrivateDevices= switch to provide services with a private /devLennart Poettering
Similar to PrivateNetwork=, PrivateTmp= introduce PrivateDevices= that sets up a private /dev with only the API pseudo-devices like /dev/null, /dev/zero, /dev/random, but not any physical devices in them.
2014-01-05strv: multiple cleanupsSimon Peeters
- turn strv_merge into strv_extend_strv. appending strv b to the end of strv a instead of creating a new strv - strv_append: remove in favor of strv_extend and strv_push. - strv_remove: write slightly more elegant - strv_remove_prefix: remove unused function - strv_overlap: use strv_contains - strv_printf: STRV_FOREACH handles NULL correctly
2013-12-28shared: add simplistic XML parser for usage in the D-Bus policy language ↵Lennart Poettering
compat parser
2013-12-26Use enums to make it obvious what boolean params meanZbigniew Jędrzejewski-Szmek
Suggested-by: Russ Allbery <rra@debian.org>
2013-12-26systemctl: allow globbing in commands which take multiple unit namesZbigniew Jędrzejewski-Szmek
2013-12-24bus: properly shift cgroup data returned from kdbus by the container's root ↵Lennart Poettering
before parsing
2013-12-24log: log_error() and friends add a newline after each line anyway, so avoid ↵Lennart Poettering
including it in the log strings
2013-12-22Fix extraction of _SYSTEMD_USER_UNITZbigniew Jędrzejewski-Szmek
Units from user services underneath user@.service would not be detected properly.
2013-12-22shared: switch our hash table implementation over to SipHashLennart Poettering
SipHash appears to be the new gold standard for hashing smaller strings for hashtables these days, so let's make use of it.
2013-12-18tests: fix buildLennart Poettering
2013-12-14Add more _printf_'s for format-nonliteralsThomas Hindoe Paaboel Andersen
Clang is a bit more strict wrt format-nonliterals: http://clang.llvm.org/docs/LanguageExtensions.html#format-string-checking Adding these extra printf attributes also makes gcc able to find more problems. E.g. this patch uncovers a format issue in udev-builtin-path_id.c Some parts looked intetional about breaking the format-nonliteral check. I added some supression for warnings there.
2013-12-13namespace: include boot id in private tmp directoriesLennart Poettering
This way it is easy to only exclude directories from the current boot from automatic clean up in /var/tmp. Also, pick a longer name for the directories so that are globs in tmp.conf can be simpler yet equally accurate.
2013-12-12scan-build: silence some warningsThomas Hindoe Paaboel Andersen
test-fileio/test-strv: Use the streq_ptr to make build-scan not worry about passing in a null to a nonnull function. test-dhcp-option: Prevent a theoretical null pointer dereference
2013-12-12test-fileio: replace mktemp with mkstemp to avoid warningsThomas Hindoe Paaboel Andersen
This is a fairly useless thing to do but it makes the compilers and analyzers shut up about the use of mktemp.
2013-12-11journald: cache cgroup root path, instead of querying it on every incoming ↵Lennart Poettering
log message
2013-12-10fix scan-build issuesThomas Hindoe Paaboel Andersen
The static analyzer scan-build had a few issues with analysing parts of systemd. gpt-auto-generator.c: scan-build could not find blkid.h. Whether it should be blkid.h or blkid/blkid.h seems to depend on the version used. We already use blkid/blkid.h in udev-builtin-blkid.c so it seems safe to use that here too. Makefile.am: Moved some -D's from CFLAGS to CPPFLAGS. I also simplified them a bit and got rid of a left over DBUS_CFLAGS. test-cgroup-mask.c/test-sched-prio.c A variable was added to store the replaced TEST_DIR. When wrapped in an assert_se TEST_DIR was not replaced in the logged error. While not an issue introduced in this patch we might as well fix it up while we are here.
2013-12-08test: cgroup-util - do not fail if cpu controller is not availableKay Sievers
2013-12-06Get rid of our reimplementation of basenameZbigniew Jędrzejewski-Szmek
The only problem is that libgen.h #defines basename to point to it's own broken implementation instead of the GNU one. This can be fixed by #undefining basename.
2013-12-03trivial coding style clean upsThomas Hindoe Paaboel Andersen
- Add space between if/for and the opening parentheses - Place the opening brace on same line as the function (not for udev) From the CODING_STYLE Try to use this: void foo() { } instead of this: void foo() { }
2013-12-02macro: add a macro to test whether a value is in a specified listLennart Poettering
Introduce IN_SET() macro to nicely check whether a value a is one of a few listed values. This makes writing this: if (a == 1 || a == 7 || a == 8 || a == 9) nicer, by allowing this: if (IN_SET(a, 1, 7, 8, 9)) This is particularly useful for state machine enums.
2013-11-30core: allocate a kdbus bus for each systemd instance, if we canLennart Poettering
2013-11-28util: fix handling of trailing whitespace in split_quoted()Lennart Poettering
Inspired by a patch by Lukas Nykryn.
2013-11-27service: add the ability for units to join other unit's PrivateNetwork= and ↵Lennart Poettering
PrivateTmp= namespaces
2013-11-25conf-parser: distinguish between multiple sections with the same nameTom Gundersen
Pass on the line on which a section was decleared to the parsers, so they can distinguish between multiple sections (if they chose to). Currently no parsers take advantage of this, but a follow-up patch will do that to distinguish [Address] Address=192.168.0.1/24 Label=one [Address] Address=192.168.0.2/24 Label=two from [Address] Address=192.168.0.1/24 Label=one Address=192.168.0.2/24 Label=two
2013-11-22test: test-sched-prio - skip if XDG_RUNTIME_DIR is not setKay Sievers
================================= No control group support available, not creating root group. Failed to determine XDG_RUNTIME_DIR Assertion 'r >= 0' failed at src/test/test-sched-prio.c:42, function main(). Aborting. =================================
2013-11-22cgroups: Cache controller masks and optimize queues.David Strauss
2013-11-21bus: add API calls to escape string components of objects pathsLennart Poettering
2013-11-20test: exit early if we would conflict with running user systemdLennart Poettering
2013-11-07test-strv: add strv_split, strv_split_newline, strv_remove_prefixDaniel Buch
2013-11-07utf8: ascii_filter() is unused, let's remove itLennart Poettering
2013-10-29strv: introduce new STRV_MAKE and STRV_MAKE_EMPTY macros to create string ↵Lennart Poettering
arrays nicely on the fly
2013-10-29strv: introduce new strv_from_stdarg_alloca() macro to generate a string ↵Lennart Poettering
array from stdarg function parameters This allows us to turn lists of strings passed in easily into string arrays without having to allocate memory.
2013-10-27test-strv.c: added STRV_FOREACH and STRV_FOREACH_BACKWARDSDaniel Buch
2013-10-22systemd: use unit name in PrivateTmp directoriesZbigniew Jędrzejewski-Szmek
Unit name is used whole in the directory name, so that the unit name can be easily extracted from it, e.g. "/tmp/systemd-abcd.service-DEDBIF1". https://bugzilla.redhat.com/show_bug.cgi?id=957439
2013-10-14list: make our list macros a bit easier to use by not requring type spec on ↵Lennart Poettering
each invocation We can determine the list entry type via the typeof() gcc construct, and so we should to make the macros much shorter to use.
2013-10-13Introduce udev object cleanup functionsZbigniew Jędrzejewski-Szmek
2013-10-13Fix write-only use of a few variablesZbigniew Jędrzejewski-Szmek
Since the invention of read-only memory, write-only memory has been considered deprecated. Where appropriate, either make use of the value, or avoid writing it, to make it clear that it is not used.
2013-10-13test: test for ellipsizeShawn Landden
2013-10-09tests: fix some memory leaks in testsLennart Poettering
2013-10-06shared/util: fix off-by-one error in tag_to_udev_nodeDave Reisner
Triggered false negatives when encoding a string which needed every character to be escaped, e.g. "LABEL=/".
2013-10-05utf8: fix utf8_is_printableZbigniew Jędrzejewski-Szmek
2013-10-01hashmap: size hashmap bucket array dynamicallyLennart Poettering
Instead of fixing the hashmap bucket array to 127 entries dynamically size it, starting with a smaller one of 31. As soon as a fill level of 75% is reached, quadruple the size, and so on. This should siginficantly optimize the lookup time in large tables (from O(n) back to O(1)), and save memory on smaller tables (which most are).
2013-09-29Fix buffer overrun when enumerating filesZbigniew Jędrzejewski-Szmek
https://bugs.freedesktop.org/show_bug.cgi?id=69887 Based-on-a-patch-by: Hans Petter Jansson <hpj@copyleft.no>
2013-09-26util: properly handle the root dir in PATH_FOREACH_PREFIXLennart Poettering
Also add PATH_FOREACH_PREFIX_MORE which includes the specified dir itself in the iteration
2013-09-26test-hashmap: fix access to uninitialized memoryZbigniew Jędrzejewski-Szmek