summaryrefslogtreecommitdiff
path: root/src/test
Commit message (Collapse)AuthorAge
* test: fix strtod test for realDavid Herrmann2014-08-15
| | | | | | | | The "0,5" syntax was actually right. The real problem is, the test should only run if the local system has the de_DE.UTF-8 locale. Therefore, skip the tests if setlocale() fails. This is kinda ugly, as it is done silently, but we cannot skip partial tests with the current infrastructure. Should be fine this way.
* test: fix strtod() testDavid Herrmann2014-08-15
| | | | | | | | | | | | | | | One strtod() test is broken since: commit 8e211000025940b770794abf5754de61b4add0af Author: Thomas Hindoe Paaboel Andersen <phomes@gmail.com> Date: Mon Aug 4 23:13:31 2014 +0200 test: use fabs on doubles The commit was right, so no reason to revert it, but the test was broken before and only worked by coincidence. Convert "0,5" to "0.5" so we don't depend on locales for double conversion (or well, we depend on "C" which seems reasonable).
* util: allow strappenda to take any number of argsDave Reisner2014-08-13
| | | | | This makes strappenda3 redundant, so we remove its usage and definition. Add a few tests along the way for sanity.
* udev: never bypass our own logging framework and call vsyslog() directly ↵Lennart Poettering2014-08-11
| | | | from udev tools
* test: use fabs on doublesThomas Hindoe Paaboel Andersen2014-08-04
|
* Unify parse_argv styleZbigniew Jędrzejewski-Szmek2014-08-03
| | | | | | | | | | | | | | | | getopt is usually good at printing out a nice error message when commandline options are invalid. It distinguishes between an unknown option and a known option with a missing arg. It is better to let it do its job and not use opterr=0 unless we actually want to suppress messages. So remove opterr=0 in the few places where it wasn't really useful. When an error in options is encountered, we should not print a lengthy help() and overwhelm the user, when we know precisely what is wrong with the commandline. In addition, since help() prints to stdout, it should not be used except when requested with -h or --help. Also, simplify things here and there.
* Always prefer our headers to system headersZbigniew Jędrzejewski-Szmek2014-07-31
| | | | | | In practice this shouldn't make much difference, but sometimes our headers might be newer, and we want to test them.
* Properly report invalid quoted stringsZbigniew Jędrzejewski-Szmek2014-07-31
| | | | | | | | $ systemd-analyze verify trailing-g.service [./trailing-g.service:2] Trailing garbage, ignoring. trailing-g.service lacks ExecStart setting. Refusing. Error: org.freedesktop.systemd1.LoadFailed: Unit trailing-g.service failed to load: Invalid argument. Failed to create trailing-g.service/start: Invalid argument
* Reject invalid quoted stringsZbigniew Jędrzejewski-Szmek2014-07-31
| | | | | | | | | | | | | | | | | | | | | | String which ended in an unfinished quote were accepted, potentially with bad memory accesses. Reject anything which ends in a unfished quote, or contains non-whitespace characters right after the closing quote. _FOREACH_WORD now returns the invalid character in *state. But this return value is not checked anywhere yet. Also, make 'word' and 'state' variables const pointers, and rename 'w' to 'word' in various places. Things are easier to read if the same name is used consistently. mbiebl_> am I correct that something like this doesn't work mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"' mbiebl_> systemd seems to strip of the quotes mbiebl_> systemctl status shows mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS $RootDir $MountPoint mbiebl_> which is pretty weird
* test-strv: add test which shows access to random memoryZbigniew Jędrzejewski-Szmek2014-07-31
|
* barrier: fix race in test-codeDavid Herrmann2014-07-29
| | | | | | | | | | | | | | The barrier_wait_next_twice* test-cases run: Parent: Child: set_alarm(10) sleep_for(1); ... set_alarm(1); sleep_for(2) ... Therefore, the parent exits after 2+ periods, the client's alarm fires after 2+ periods. This race turns out to be lost by the child on other machines, so avoid it by increasing the parent's sleep-interval to 4. This way, the client has 2 periods to run the barrier test, which is far more than enough.
* udev: unify event timeout handlingKay Sievers2014-07-29
|
* barrier: convert msecs to usecs in test-codeDavid Herrmann2014-07-29
| | | | | | Avoid using msecs in favor of usec_t. This is more consistent with the other parts of systemd and avoids the confusion between msec and usec. We always use usecs, end of story.
* parse_boolean: require exact matchesAnsgar Burchardt2014-07-27
| | | | | | | | | | Require exact matches in all cases instead of treating strings starting with 't' ('f') as true (false). This is required for config_parse_protect_system to parse ProtectSystem=full correctly: it uses parse_boolean and only tries a more specific parsing function if that did not return a valid result. Thus "full" was treated as "false" before.
* Add utility function to append root to pathZbigniew Jędrzejewski-Szmek2014-07-26
|
* test-cgroup-mask: fix masks in test and enable by defaultZbigniew Jędrzejewski-Szmek2014-07-20
| | | | | | | | | Commit 637f421e5c6a ("cgroups: always propagate controller membership to siblings") changed the mask propagation logic, but the test wasn't updated. Move to normal tests from manual tests, it should not touch the system anymore.
* test-cgroup-mask: pass on kernels without memory controllerZbigniew Jędrzejewski-Szmek2014-07-20
| | | | | | | It seems that unit_get_siblings_mask returns the controllers filtered by what is available, but get_members_mask and get_cgroup_mask do not. This just fixes the test following the symptoms.
* test-engine: fix access to unit load pathZbigniew Jędrzejewski-Szmek2014-07-20
| | | | | | | | Also add a bit of debugging output to help diagnose problems, add missing units, and simplify cppflags. Move test-engine to normal tests from manual tests, it should now work without destroying the system.
* core: remove systemd_running_as lookup functionsZbigniew Jędrzejewski-Szmek2014-07-19
| | | | They are unused and unlikely to ever be.
* barrier: initalize file descriptors with -1Zbigniew Jędrzejewski-Szmek2014-07-18
| | | | | | | | | | | Explicitly initalize descriptors using explicit assignment like bus_error. This makes barriers follow the same conventions as everything else and makes things a bit simpler too. Rename barier_init to barier_create so it is obvious that it is not about initialization. Remove some parens, etc.
* test-pty: silence a warningThomas Hindoe Paaboel Andersen2014-07-17
|
* shared: add PTY helperDavid Herrmann2014-07-17
| | | | | | | | | | | | | | | | | | | This Pty API wraps the ugliness that is POSIX PTY. It takes care of: - edge-triggered HUP handling (avoid heavy CPU-usage on vhangup) - HUP vs. input-queue draining (handle HUP _after_ draining the whole input queue) - SIGCHLD vs. HUP (HUP is no reliable way to catch PTY deaths, always use SIGCHLD. Otherwise, vhangup() and friends will break.) - Output queue buffering (async EPOLLOUT handling) - synchronous setup (via Barrier API) At the same time, the PTY API does not execve(). It simply fork()s and leaves everything else to the caller. Usually, they execve() but we support other setups, too. This will be needed by multiple UI binaries (systemd-console, systemd-er, ...) so it's placed in src/shared/. It's not strictly related to libsystemd-terminal, so it's not included there.
* shared: add generic IPC barrierDavid Herrmann2014-07-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "Barrier" object is a simple inter-process barrier implementation. It allows placing synchronization points and waiting for the other side to reach it. Additionally, it has an abortion-mechanism as second-layer synchronization to send abortion-events asynchronously to the other side. The API is usually used to synchronize processes during fork(). However, it can be extended to pass state through execve() so you could synchronize beyond execve(). Usually, it's used like this (error-handling replaced by assert() for simplicity): Barrier b; r = barrier_init(&b); assert_se(r >= 0); pid = fork(); assert_se(pid >= 0); if (pid == 0) { barrier_set_role(&b, BARRIER_CHILD); ...do child post-setup... if (CHILD_SETUP_FAILED) exit(1); ...child setup done... barrier_place(&b); if (!barrier_sync(&b)) { /* parent setup failed */ exit(1); } barrier_destroy(&b); /* redundant as execve() and exit() imply this */ /* parent & child setup successful */ execve(...); } barrier_set_role(&b, BARRIER_PARENT); ...do parent post-setup... if (PARENT_SETUP_FAILED) { barrier_abort(&b); /* send abortion event */ barrier_wait_abortion(&b); /* wait for child to abort (exit() implies abortion) */ barrier_destroy(&b); ...bail out... } ...parent setup done... barrier_place(&b); if (!barrier_sync(&b)) { ...child setup failed... ; barrier_destroy(&b); ...bail out... } barrier_destroy(&b); ...child setup successfull... This is the most basic API. Using barrier_place() to place barriers and barrier_sync() to perform a full synchronization between both processes. barrier_abort() places an abortion barrier which superceeds any other barriers, exit() (or barrier_destroy()) places an abortion-barrier that queues behind existing barriers (thus *not* replacing existing barriers unlike barrier_abort()). This example uses hard-synchronization with wait_abortion(), sync() and friends. These are all optional. Barriers are highly dynamic and can be used for one-way synchronization or even no synchronization at all (postponing it for later). The sync() call performs a full two-way synchronization. The API is documented and should be fairly self-explanatory. A test-suite shows some special semantics regarding abortion, wait_next() and exit(). Internally, barriers use two eventfds and a pipe. The pipe is used to detect exit()s of the remote side as eventfds do not allow that. The eventfds are used to place barriers, one for each side. Barriers itself are numbered, but the numbers are reused once both sides reached the same barrier, thus you cannot address barriers by the index. Moreover, the numbering is implicit and we only store a counter. This makes the implementation itself very lightweight, which is probably negligible considering that we need 3 FDs for a barrier.. Last but not least: This barrier implementation is quite heavy. It's definitely not meant for fast IPC synchronization. However, it's very easy to use. And given the *HUGE* overhead of fork(), the barrier-overhead should be negligible.
* test-tables: add new entriesZbigniew Jędrzejewski-Szmek2014-07-16
| | | | | | One missing string found. A few things had to be moved around to make it possible to test them.
* test-socket-util: silence warningsThomas Hindoe Paaboel Andersen2014-07-16
|
* shared/socket-util: add function to query remote addressZbigniew Jędrzejewski-Szmek2014-07-15
|
* shared: fix coding-style for ring-buffer implementationDavid Herrmann2014-07-11
| | | | | We use "typedef struct Ring Ring" with camel-case for internal objects. So rename "struct ring" to "Ring".
* util: fix has cc check and add testZbigniew Jędrzejewski-Szmek2014-07-11
|
* shared: split out in_addr related calls from socket-util.[ch] into its ↵Lennart Poettering2014-07-10
| | | | | | | private in-addr-util.[ch] These are enough calls for a new file, and they are sufficiently different from the sockaddr-related calls, hence let's split this out.
* machinectl: show /etc/os-release information of container in status outputLennart Poettering2014-07-03
|
* test: print library tuple in testLennart Poettering2014-07-03
|
* util: when unescaping strings, don't allow smuggling in of additional NUL bytesLennart Poettering2014-07-02
| | | | Better safe than sorry.
* tests: add missing XDG_RUNTIME_DIR env variableRonny Chevalier2014-06-30
| | | | | Otherwise the test fails because specifier_runtime() returns -ENOTSUP when XDG_RUNTIME_DIR is not set.
* tests: add test-ratelimitRonny Chevalier2014-06-24
|
* tests: add tests to test-unit-nameRonny Chevalier2014-06-24
| | | | | | | | | | | | add tests for: - unit_instance_is_valid - unit_prefix_is_valid - unit_name_change_suffix - unit_name_build - unit_name_is_instance - build_subslice - unit_name_to_instance - unit_name_escape
* consistently order cleanup attribute before typeThomas Hindoe Paaboel Andersen2014-06-22
|
* tests: add test_fdset_removeRonny Chevalier2014-06-22
|
* tests: add test-asyncRonny Chevalier2014-06-22
|
* tests: add test-capabilityRonny Chevalier2014-06-22
|
* test: ensure conf_files_list returns absolute pathsMichael Marineau2014-06-20
|
* test: unit test for using alternate roots with path_strv_resolveMichael Marineau2014-06-20
|
* tests: add tests for strv_extendfRonny Chevalier2014-06-19
|
* tests: add tests to test-utilRonny Chevalier2014-06-19
| | | | | | | | | | | | | | | | add tests for: - filename_is_safe - ascii_strlower - files_same - is_valid_documentation_url - file_in_same_dir - endswith - close_nointr - unlink_noerrno - readlink_and_make_absolute - read_one_char - ignore_signals - strshorten
* tests: add missing returnRonny Chevalier2014-06-19
|
* networkd: add a number of calls to manipulate in_addr_union structsLennart Poettering2014-06-18
|
* install: beef up preset logic to limit to only enable or only disable, and ↵Lennart Poettering2014-06-17
| | | | | | | | | | | | | | | | do all-unit preset operations The new "systemctl preset-all" command may now be used to put all installed units back into the enable/disable state the vendor/admin encoded in preset files. Also, introduce "systemctl --preset-mode=enable-only" and "systemctl --preset-mode=disable-only" to only apply the enable or only the disable operations of a "systemctl preset" or "systemctl preset-all" operation. "systemctl preset-all" implements this RFE: https://bugzilla.redhat.com/show_bug.cgi?id=630174
* tests: unlink temp file used in testRonny Chevalier2014-06-16
|
* tests: add tests to test-hashmapRonny Chevalier2014-06-16
| | | | | | | | | add tests for: - hashmap_remove_and_put - hashmap_first_key - hashmap_last - hashmap_steal_first_key - hashmap_clear_free_free
* tests: add test-fdsetRonny Chevalier2014-06-16
|
* tests: add test-socket-utilRonny Chevalier2014-06-16
|