summaryrefslogtreecommitdiff
path: root/src/test
AgeCommit message (Collapse)Author
2013-07-16test-tables: allow sparse tables and check mapping for -1Zbigniew Jędrzejewski-Szmek
Jan: test-tables fails on my system. The one it's failing on is: syscall: 222 → (null) → -1 ... and indeed, our own tables should not have holes, but syscall tables certainly might.
2013-07-16tests: add more tests for shared/util.cThomas Hindoe Paaboel Andersen
2013-07-13test: add trivial test for syscall table and extend table tests to error pathsZbigniew Jędrzejewski-Szmek
2013-07-12test-path-util,test-sched-prio: uninitialize manager to appease valgrindZbigniew Jędrzejewski-Szmek
2013-07-11cgroup: simplify how instantiated units are mapped to cgroupsLennart Poettering
Previously for an instantiated unit foo@bar.service we created a cgroup foo@.service/foo@bar.service, in order to place all instances of the same template inside the same subtree. As we now implicitly add all instantiated units into one per-template slice we don't need this complexity anymore, and instance units can map directly to the cgroups of their full name.
2013-07-10core: serialize/deserialize bus subscribersLennart Poettering
2013-07-05tests: add tests for string lookup tablesZbigniew Jędrzejewski-Szmek
The tests check if the tables have entries for all values in the enum, and that the entries are unique.
2013-07-02libsystemd-logind: fix detection of session/user/machine of a PIDLennart Poettering
2013-06-27test: Add list testcaseJan Janssen
2013-06-27core: general cgroup reworkLennart Poettering
Replace the very generic cgroup hookup with a much simpler one. With this change only the high-level cgroup settings remain, the ability to set arbitrary cgroup attributes is removed, so is support for adding units to arbitrary cgroup controllers or setting arbitrary paths for them (especially paths that are different for the various controllers). This also introduces a new -.slice root slice, that is the parent of system.slice and friends. This enables easy admin configuration of root-level cgrouo properties. This replaces DeviceDeny= by DevicePolicy=, and implicitly adds in /dev/null, /dev/zero and friends if DeviceAllow= is used (unless this is turned off by DevicePolicy=).
2013-06-21login: add an api to determine the slice a PID is located in to libsystemd-loginLennart Poettering
2013-06-20logind: add infrastructure to keep track of machines, and move to slicesLennart Poettering
- This changes all logind cgroup objects to use slice objects rather than fixed croup locations. - logind can now collect minimal information about running VMs/containers. As fixed cgroup locations can no longer be used we need an entity that keeps track of machine cgroups in whatever slice they might be located. Since logind already keeps track of users, sessions and seats this is a trivial addition. - nspawn will now register with logind and pass various bits of metadata along. A new option "--slice=" has been added to place the container in a specific slice. - loginctl gained commands to list, introspect and terminate machines. - user.slice and machine.slice will now be pulled in by logind.service, since only logind.service requires this slice.
2013-06-17core: add new .slice unit type for partitioning systemsLennart Poettering
In order to prepare for the kernel cgroup rework, let's introduce a new unit type to systemd, the "slice". Slices can be arranged in a tree and are useful to partition resources freely and hierarchally by the user. Each service unit can now be assigned to one of these slices, and later on login users and machines may too. Slices translate pretty directly to the cgroup hierarchy, and the various objects can be assigned to any of the slices in the tree.
2013-06-10Properly check for overflow in offsetsZbigniew Jędrzejewski-Szmek
2013-05-06systemd-sleep: add support for freeze and standbyZbigniew Jędrzejewski-Szmek
A new config file /etc/systemd/sleep.conf is added. It is parsed by systemd-sleep and logind. The strings written to /sys/power/disk and /sys/power/state can be configured. This allows people to use different modes of suspend on systems with broken or special hardware. Configuration is shared between systemd-sleep and logind to enable logind to answer the question "can the system be put to sleep" as correctly as possible without actually invoking the action. If the user configured systemd-sleep to only use 'freeze', but current kernel does not support it, logind will properly report that the system cannot be put to sleep. https://bugs.freedesktop.org/show_bug.cgi?id=57793 https://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=7e73c5ae6e7991a6c01f6d096ff8afaef4458c36 http://lists.freedesktop.org/archives/systemd-devel/2013-February/009238.html SYSTEM_CONFIG_FILE and USER_CONFIG_FILE defines were removed since they were used in only a few places and with the addition of /etc/systemd/sleep.conf it becomes easier to just append the name of each file to the dir name.
2013-05-03cgroup: when escaping a cgroup object name, also escape names that start ↵Lennart Poettering
with a dot
2013-05-03test-hashmap.c: add unit-test for hashmapDaniel Buch
2013-05-01cgls: add --machine/-MZbigniew Jędrzejewski-Szmek
cg_get_machine_path is modified to include the escaped machine name + ".nspawn" if the machine argument is nonnull.
2013-04-30id128: when taking user input for a 128bit ID, validate syntaxLennart Poettering
Also, always accept both our simple hexdump syntax and UUID syntax.
2013-04-25Use attribute(unused) in PROTECT_ERRNOZbigniew Jędrzejewski-Szmek
clang emits warnings about unused attribute _saved_errno_, which drown out other—potentially useful—warnings. gcc documentation is not exactly verbose about the effects of __attribute__((unused)) on variables, but let's assume that it works if the unit test passes.
2013-04-25util: rework safe_atod() to be locale-independentLennart Poettering
This adds some syntactic sugar with a macro RUN_WITH_LOCALE() that reset the thread-specific locale temporarily.
2013-04-24cgroup: always validate cgroup controller namesLennart Poettering
Let's better be safe than sorry.
2013-04-24Add set_consume which always takes ownershipZbigniew Jędrzejewski-Szmek
Freeing in error path is the common pattern with set_put().
2013-04-22cgroup: make sure all our cgroup objects have a suffix and are properly escapedLennart Poettering
Session objects will now get the .session suffix, user objects the .user suffix, nspawn containers the .nspawn suffix. This also changes the user cgroups to be named after the numeric UID rather than the username, since this allows us the parse these paths standalone without requiring access to the cgroup file system. This also changes the mapping of instanced units to cgroups. Instead of mapping foo@bar.service to the cgroup path /user/foo@.service/bar we will now map it to /user/foo@.service/foo@bar.service, in order to ensure that all our objects are properly suffixed in the tree.
2013-04-22nspawn: suffix the nspawn cgroups with ".nspawn"Lennart Poettering
As discussed with Dan Berrange it's a good idea to suffix all objects in the cgroup tree with ".something", so that when the system is partitioned using a resource management tool we can drop objects of different types into the same partition directory without generate namespace conflicts. We'l add this to the Pax Control Group document as soon as write access to the fdo wiki is restored.
2013-04-18fileio.c: do not parse comments after non-whitespace charsHarald Hoyer
systemd does not want to understand comments after the first non-whitespace char occured. key=foo #comment will result into key == "foo #comment" key="foo" #comment will result into key == "foo#comment" "key= #comment" will result into key == "#comment" "key #comment" is an invalid line
2013-04-18move _cleanup_ attribute in front of the typeHarald Hoyer
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-17core/execute: report invalid environment variables from filesHarald Hoyer
Because "export key=val" is not supported by systemd, an error is logged where the invalid assignment is coming from. Introduce strv_env_clean_log() to log invalid environment assignments, where logging is possible and allowed. parse_env_file_internal() is modified to allow WHITESPACE in keys, to report the issues later on.
2013-04-17fileio:parse_env_file_internal() fix environment file parsingHarald Hoyer
parse_env_file_internal() could not parse the following lines correctly: export key="val" key="val"#comment
2013-04-17Report about syntax errors with metadataZbigniew Jędrzejewski-Szmek
The information about the unit for which files are being parsed is passed all the way down. This way messages land in the journal with proper UNIT=... or USER_UNIT=... attribution. 'systemctl status' and 'journalctl -u' not displaying those messages has been a source of confusion for users, since the journal entry for a misspelt setting was often logged quite a bit earlier than the failure to start a unit. Based-on-a-patch-by: Oleksii Shevchuk <alxchk@gmail.com>
2013-04-17core: log a few more things under UNIT=...Zbigniew Jędrzejewski-Szmek
2013-04-16util: make generation of profcs PID paths nicerLennart Poettering
2013-04-16nspawn: introduce the new /machine/ tree in the cgroup tree and move ↵Lennart Poettering
containers there Containers will now carry a label (normally derived from the root directory name, but configurable by the user), and the container's root cgroup is /machine/<label>. This label is called "machine name", and can cover both containers and VMs (as soon as libvirt also makes use of /machine/). libsystemd-login can be used to query the machine name from a process. This patch also includes numerous clean-ups for the cgroup code.
2013-04-15core: always create /user and /machine top-level cgroup dirsLennart Poettering
This allows clients to put inotify watches on these trees to watch for state changes, without having to wait until these dirs are created. This introduces the new top-level /machine cgroup dir as canonical location where OS containers and VMs shall be located (as discussed with the libvirt folks).
2013-04-15bus: handle env vars safelyLennart Poettering
Make sure that our library is safe for usage in SUID programs when it comes to env var handling
2013-04-13fileio: in envfiles, do not skip lines following empty linesZbigniew Jędrzejewski-Szmek
https://bugs.freedesktop.org/show_bug.cgi?id=63477
2013-04-05test-strv: do not declare table to be sorted constZbigniew Jędrzejewski-Szmek
Segmentation fault under clang.
2013-04-05journal: u64log2 can be expressed just as __builtin_clzll(n) ^ 63UCristian Rodríguez
2013-04-04util: make time formatting a bit smarterLennart Poettering
Instead of outputting "5h 55s 50ms 3us" we'll now output "5h 55.050003s". Also, while outputting the accuracy is configurable. Basically we now try use "dot notation" for all time values > 1min. For >= 1s we use 's' as unit, otherwise for >= 1ms we use 'ms' as unit, and finally 'us'. This should give reasonably values in most cases.
2013-04-03time: add suppot for fractional time specificationsLennart Poettering
We can now parse "0.5s" as the same as "500ms". In fact, we can parse "3.45years" correctly, too, and any other unit and fraction length.
2013-04-03fileio: write proper env var write-out codeLennart Poettering
This will properly escape all weird chars when writing env var files. With this in place we can now read and write environment files where the values contain arbitrary weird chars. This enables hostnamed and suchlike to finally properly save pretty host names with backlashes or quotes in them.
2013-04-03shared: rework env file readerLennart Poettering
Implement this with a proper state machine, so that newlines and escaped chars can appear in string assignments. This should bring the parser much closer to shell.
2013-03-29test-path-util: fix another stupid test failureZbigniew Jędrzejewski-Szmek
2013-03-29test-path-util: fix botched testZbigniew Jędrzejewski-Szmek
2013-03-28tests: add some silly tests for path-util.cZbigniew Jędrzejewski-Szmek
2013-03-26tests: skip bus test if bus cannot be openedZbigniew Jędrzejewski-Szmek
To make the result more visible, special return value is used to tell automake that the test was skipped. While at it, use the same return value in other skipped tests.
2013-03-26tests: fix size_t in format stringZbigniew Jędrzejewski-Szmek
2013-03-26Simplify the meaning of %sZbigniew Jędrzejewski-Szmek
The rules governing %s where just too complicated. First of all, looking at $SHELL is dangerous. For systemd --system, it usually wouldn't be set. But it could be set if the admin first started a debug shell, let's say /sbin/sash, and then launched systemd from it. This shouldn't influence how daemons are started later on, so is better ignored. Similar reasoning holds for session mode. Some shells set $SHELL, while other set it only when it wasn't set previously (e.g. zsh). This results in fragility that is better avoided by ignoring $SHELL totally. With $SHELL out of the way, simplify things by saying that %s==/bin/sh for root, and the configured shell otherwise. get_shell() is the only caller, so it can be inlined. Fixes one issue seen with 'make check'.
2013-03-22util: be more picky when validating hostnamesLennart Poettering
No longer allow dots at the beginning or end of host names, Or double dots. https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1152187/comments/14
2013-03-21shared: add simple priority queue implementationLennart Poettering