1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 18:27:04 +03:00
Commit Graph

399 Commits

Author SHA1 Message Date
Ronny Chevalier
fee0a92183 test-unit-name: add more tests
Add more test cases for:
- unit_name_is_instance
- unit_name_to_instance

Add tests for:
- unit_name_template
- unit_name_is_template
2014-12-13 15:12:38 +01:00
Lennart Poettering
4b7c1d5d6a test-cap-list: always check libcap comes to the same names as we do, for the names it knows 2014-12-12 18:42:19 +01:00
Lennart Poettering
34a3e4ecad cap-list: return lower-case capability names, similar to libcap's cap_to_name(), for compat reasons 2014-12-12 18:37:25 +01:00
Lennart Poettering
7430ec6ac0 copy: use btrfs reflinking only whe we know we copy full files 2014-12-12 17:30:25 +01:00
Lennart Poettering
d7c7c334f5 shared: add new btrfs-util.[ch] helpers for doing common btrfs operation 2014-12-12 13:35:32 +01:00
Lennart Poettering
ae6c3cc009 util: when using basename() for creating temporary files, verify the resulting name is actually valid
Also, rename filename_is_safe() to filename_is_valid(), since it
actually does a full validation for what the kernel will accept as file
name, it's not just a heuristic.
2014-12-12 13:35:32 +01:00
Ronny Chevalier
015df1f78f test-condition: add more test cases 2014-12-11 18:32:57 +01:00
Ronny Chevalier
e74aa253e9 test-strv: add test for strv_equal 2014-12-11 18:32:57 +01:00
Ronny Chevalier
27c5347c8c test-execute: add tests for UMask directive 2014-12-11 18:32:57 +01:00
Ronny Chevalier
14b0295f91 test-unit-name: add tests for %f 2014-12-11 18:32:57 +01:00
Lennart Poettering
eccaf89933 tree-wide: use our memset() macros instead of memset() itself 2014-12-11 16:58:45 +01:00
Torstein Husebø
f7340ab269 treewide: correct spacing near eol in code comments 2014-12-11 15:10:03 +01:00
Jan Synacek
0eb3cc8850 test: fix some tests when running inside a container 2014-12-10 13:36:10 +01:00
Lennart Poettering
2822da4fb7 util: introduce our own gperf based capability list
This way, we can ensure we have a more complete, up-to-date list of
capabilities around, always.
2014-12-10 03:21:07 +01:00
Lennart Poettering
3280236156 sd-bus: get rid of PID starttime concept
As kdbus no longer exports this, remove all traces from sd-bus too
2014-12-09 18:16:54 +01:00
Lennart Poettering
3c6d3052d3 utf8: when escaping unprintable unichars, escape the whole unichar, not just the first byte of it 2014-12-04 02:27:14 +01:00
WaLyong Cho
fec8457652 utf8: intruduce utf8_escape_non_printable 2014-12-04 02:09:44 +01:00
Thomas Hindoe Paaboel Andersen
f08c4c08c7 test-path-util: fix a leak 2014-12-04 00:13:10 +01:00
Lennart Poettering
98940a3cd9 strv: add calls to add two entries to an strv at once 2014-12-03 18:31:51 +01:00
Lennart Poettering
46bcf49291 treewide: convert some left-over (usec_t) -1 to USEC_INFINITY 2014-11-28 20:55:04 +01:00
Lennart Poettering
fed1e721fd treewide: introduce UID_INVALID (and friends) as macro for (uid_t) -1 2014-11-28 20:55:04 +01:00
Michal Schmidt
56f64d9576 treewide: use log_*_errno whenever %m is in the format string
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-28 19:49:27 +01:00
Michal Schmidt
da927ba997 treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values.
2014-11-28 13:29:21 +01:00
Michal Schmidt
0a1beeb642 treewide: auto-convert the simple cases to log_*_errno()
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-28 12:04:41 +01:00
Lennart Poettering
086891e5c1 log: add an "error" parameter to all low-level logging calls and intrdouce 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-27 22:05:23 +01:00
Jakub Filak
c593bb360e util: add function getting proc environ
On the contrary of env, the added function returns all characters
cescaped, because it improves reproducibility.
2014-11-27 00:24:52 -05:00
Iago López Galeiras
58f10d401f test: support empty environment variables in unit files
Also update TODO, empty environment variables in Environment= and
EnvironmentFile= options work.
2014-11-23 16:29:11 -05:00
Zbigniew Jędrzejewski-Szmek
b63bd1090b Do not check for existence of remote binaries
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-22 18:01:43 -05:00
Jakub Filak
ad450c3e04 util: add functions getting proc cwd and root
/proc/[pid]/cwd and /proc/[pid]/root are symliks to corresponding
directories

The added functions returns values of that symlinks.
2014-11-21 00:32:02 +01:00
Lennart Poettering
e1ba963fdf tests: fix minor memory leak 2014-11-20 00:01:05 +01:00
Kay Sievers
adeba5008e udev: support ENV{}=="" global property matches 2014-11-13 20:35:06 +01:00
Kay Sievers
41b848b0ea udev: move global property handling from libudev to udevd 2014-11-13 13:50:01 +01:00
Kay Sievers
25e773eeb4 udev: switch to systemd logging functions 2014-11-13 13:12:57 +01:00
Ronny Chevalier
281e05b6cb tests: add test-execute
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-13 10:39:51 +01:00
Ronny Chevalier
07aa32e31d manager: allow test run to catch SIGCHLD events
Otherwise we cannot know when a service exited
2014-11-13 10:39:51 +01:00
Lennart Poettering
f88e6be5ee strv: rework strv_split_quoted() to use unquote_first_word()
This should make the unquoting scheme a bit less naive.
2014-11-10 23:45:12 +01:00
Ronny Chevalier
bc9992978c tests: add test-path
It tests all available directives of Path units:
- PathChanged
- PathModified
- PathExists
- PathExisysGlob
- DirectoryNotEmpty
- MakeDirectory
- DirectoryMode
- Unit
2014-11-08 22:45:56 +01:00
Lennart Poettering
f32d2db140 util: rework /proc/cmdline parser to use unquote_first_word() 2014-11-07 01:19:56 +01:00
Lennart Poettering
cda134ab1e copy: teach copy_bytes() sendfile() support, and then replace sendfile_full() by it 2014-11-07 01:19:56 +01:00
Lennart Poettering
134e56dcc5 shared: rename condition-util.[ch] to condition.[ch]
Now that we only have one file with condition implementations around, we
can drop the -util suffix and simplify things a bit.
2014-11-06 14:21:11 +01:00
Lennart Poettering
493657337a core: get rid of condition.c and move the remaining call into util.c
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-06 14:21:11 +01:00
Lennart Poettering
59fccdc587 core: introduce the concept of AssertXYZ= similar to ConditionXYZ=, but fatal for a start job if not met 2014-11-06 14:21:11 +01:00
Lennart Poettering
b80ba1da1c condition: add more test cases 2014-11-06 14:21:10 +01:00
Lennart Poettering
d1bddcec98 condition: unify condition logic in one file 2014-11-06 14:21:10 +01:00
Lennart Poettering
592fd144ae condition: properly allow passing back errors from condition checks 2014-11-06 14:21:10 +01:00
Lennart Poettering
07318c2908 condition: rewrite condition_test_kernel_command_line() based on unquote_first_word() 2014-11-05 19:46:07 +01:00
Tom Gundersen
617e794652 shared: unaligned - use void* instead of unaligned be16_t* 2014-11-05 16:54:22 +01:00
Tom Gundersen
61c8175021 test: hashmap-plain - make coverity happy
Check return value of hashmap_ensure_allocated().

CID#1250807.
2014-11-05 16:54:22 +01:00
Tom Gundersen
696c24fced test: fileio - make coverity happy
Explicitly check the length of the read.

Fixes CID#1250803.
2014-11-05 16:54:22 +01:00
Michal Schmidt
e80afdb3e4 test: use assert_se in test_hashmap_move 2014-11-04 17:05:01 +01:00