Zbigniew Jędrzejewski-Szmek
224b0e7ad0
Add set/hashmap helpers for non-trivial freeing and use where straighforward
...
A macro is needed because otherwise we couldn't ensure type safety.
Some simple tests are included.
No functional change intended.
2017-11-28 21:30:30 +01:00
Zbigniew Jędrzejewski-Szmek
ec1d290903
Use hashmap_free_free where appropriate
2017-11-28 21:26:37 +01:00
Zbigniew Jędrzejewski-Szmek
5c4912ea61
Merge pull request #7490 from yuwata/test-basic
...
add more tests for basic functions
2017-11-28 18:15:30 +01:00
Yu Watanabe
23cc81e7c2
test-cap-list: add more tests about capability_set_{from,to}_string()
2017-11-28 22:17:00 +09:00
Yu Watanabe
4c1a95fd84
test: move tests about cap_list_cap() from test-cap-list to test-capability
2017-11-28 22:14:54 +09:00
Yu Watanabe
6b86b9e65d
test-bitmap: add tests for bitmap_copy()
2017-11-28 20:34:36 +09:00
Yu Watanabe
ade0eb2190
test-architecture: add more tests
2017-11-28 20:34:32 +09:00
Yu Watanabe
f30788ee23
test-alloc-util: add tests for memdup_suffix0() and greedy_realloc()
2017-11-28 20:33:58 +09:00
Yu Watanabe
a4e6e06bc7
tests: add tests for empty string
2017-11-28 20:21:25 +09:00
Zbigniew Jędrzejewski-Szmek
7beb3baf16
test-hostname-util: add assert_se's to make coverity happy
2017-11-28 09:26:14 +01:00
Zbigniew Jędrzejewski-Szmek
c47a9f909a
test-process-util: add (void) cast to make coverity happy
...
The intent is for the call to succeed only when privileged, so make
that clear.
2017-11-28 09:25:39 +01:00
Zbigniew Jędrzejewski-Szmek
ca9b2b4dc1
test-fd-util: add assert_se to make coverity happy
2017-11-28 09:25:39 +01:00
Zbigniew Jędrzejewski-Szmek
76b38997c9
test: increase timeout for test-journal-enum
...
This reads the journal from the host system, and in case of a slow
disk, the 30s default can be easily exceeded.
2017-11-26 15:07:53 +01:00
Lennart Poettering
2482f88d2a
tests: make "test-execute" work in "sudo ninja -C build test" ( #7463 )
...
In this mode USER/LOGNAME still point to the original caller, and our
tests get confused by that.
Follow-up for: #7450
2017-11-24 22:56:44 +01:00
Yu Watanabe
8b3c4b5757
test-execute: test more % specifiers ( #7450 )
2017-11-24 10:17:28 +01:00
Lennart Poettering
9b1573ef76
test: fix test-mount-util when handling duplicate mounts on the same location
...
The test was written so far under the assumption that if two mounts are
placed onto the same location the "upper" mount is listed later in
/proc/self/mountinfo. This appears not to be guaranteed however, as
running the tests in a normal nspawn shows.
This patch fixes that: it reverses the hashmap of mounts we build:
instead of keying by path, we key by mnt_id, and if we notice that
path_get_mnt_id() doesn't match what a line in /proc/self/mountinfo
says, we use the returned ID to check if maybe another line agrees.
Fixes : #7431
2017-11-23 13:28:06 +01:00
Zbigniew Jędrzejewski-Szmek
a217a4bcc5
Merge pull request #7395 from poettering/nametohandleat-loop
...
name_to_handle_at() EOVERFLOW handling
2017-11-22 08:20:36 +01:00
Lennart Poettering
c2a986d509
mount-util: add new path_get_mnt_id() call that queries the mnt ID of a path
...
This is a simple wrapper around name_to_handle_at_loop() and
fd_fdinfo_mnt_id() to query the mnt ID of a path. It uses
name_to_handle_at() where it can, and falls back to to
fd_fdinfo_mnt_id() where that doesn't work.
This is a best-effort thing of course, since neither name_to_handle_at()
nor the fdinfo logic work on all kernels.
2017-11-21 11:37:12 +01:00
Lennart Poettering
f35cb39ed6
hostname-util: rework read_hostname_config() a bit
...
First of all, let's rename it to read_etc_hostname(), to make clearer
what kind of configuration it actually reads: the file format defined in
/etc/hostname and nothing else.
Secondly: let's port this to use read_line(), i.e. the new way to read
lines from a file in a safe, bounded way.
Thirdly: let's strip leading/trailing whitespace from what we are
reading. Given that we are already pretty lenient what we read (comments
and empty lines), let's be permissive regarding whitespace too.
Fourthly: let's actually validate the hostname when reading it. So far
we tried to make it valid, but that's not always possible (for example,
we can't make an empty hostname valid, ever).
2017-11-20 16:43:15 +01:00
Lennart Poettering
9a9a4f10e9
util: add new helper in_utc_timezone()
...
As the name suggests it checks whether we are running in an UTC
timezone.
2017-11-20 10:53:26 +01:00
Lennart Poettering
0133d5553a
Merge pull request #7198 from poettering/stdin-stdout
...
Add StandardInput=data, StandardInput=file:... and more
2017-11-19 19:49:11 +01:00
Zbigniew Jędrzejewski-Szmek
3a726fcd08
Add license headers and SPDX identifiers to meson.build files
...
So far I avoided adding license headers to meson files, but they are pretty
big and important and should carry license headers like everything else.
I added my own copyright, even though other people modified those files too.
But this is mostly symbolic, so I hope that's OK.
2017-11-19 19:08:15 +01:00
Zbigniew Jędrzejewski-Szmek
53e1b68390
Add SPDX license identifiers to source files under the LGPL
...
This follows what the kernel is doing, c.f.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460 .
2017-11-19 19:08:15 +01:00
Lennart Poettering
666d787787
test: add basic test for StandardInput=file:
2017-11-17 11:13:44 +01:00
Lennart Poettering
da543f6a77
test: add tests for StandardInputText= and StandardInputData=
2017-11-17 11:13:44 +01:00
Lennart Poettering
a548e14d69
fd-util: add new acquire_data_fd() API helper
...
All this function does is place some data in an in-memory read-only fd,
that may be read back to get the original data back.
Doing this in a way that works everywhere, given the different kernels
we support as well as different privilege levels is surprisingly
complex.
2017-11-17 11:13:44 +01:00
Lennart Poettering
57a4359ee0
fs-util: add access_fd() which is like access() but for fds
...
Linux doesn't have faccess(), hence let's emulate it. Linux has access()
and faccessat() but neither allows checking the access rights of an fd
passed in directly.
2017-11-17 11:12:33 +01:00
Zbigniew Jędrzejewski-Szmek
05d69e0294
test-cgroup-util: skip cg hierarchy tests when necessary ( #7371 )
2017-11-17 11:10:21 +01:00
Zbigniew Jędrzejewski-Szmek
88bff42450
test-unit-file: add test for config_parse_log_extra_fields()
2017-11-16 12:40:17 +01:00
Zbigniew Jędrzejewski-Szmek
073e8f0956
test-cgroup-util: add basic test for cg_all_unified/cg_hybrid_unified/cg_unified_controller
2017-11-15 22:58:24 +01:00
Lennart Poettering
7546145e26
string-util: add delete_trailing_chars() and skip_leading_chars() helpers
...
And let's port over a couple of users to the new APIs.
2017-11-13 10:47:15 +01:00
Lennart Poettering
bcde742e78
conf-parser: turn three bool function params into a flags fields
...
This makes things more readable and fixes some issues with incorrect
flag propagation between the various flavours of config_parse().
2017-11-13 10:24:03 +01:00
Lennart Poettering
ec635a2d21
cgroup: improve cg_mask_to_string a bit, and add tests for it
2017-11-13 10:24:03 +01:00
Zbigniew Jędrzejewski-Szmek
f886559e55
Merge pull request #7186 from poettering/track-deps
...
rework unit dependency data structure to track why deps get created
2017-11-12 16:14:41 +01:00
Yu Watanabe
7a18854fe7
test-execute: update test for SystemCallErrorNumber=
2017-11-11 21:54:29 +09:00
Yu Watanabe
b4891260b9
test: add tests for syscall:errno style in SystemCallFilter=
2017-11-11 21:54:20 +09:00
Yu Watanabe
473d2ec39c
test: add test for parse_errno() and parse_syscall_and_errno()
2017-11-11 21:53:56 +09:00
Lennart Poettering
c999cf385a
core: add internal API to remove dependencies again, based on dependency mask
...
let's make use of the dependency mask, and add internal API to remove
dependencies ago, based on bits in the dependency mask.
2017-11-10 19:45:29 +01:00
tblume
ed457f1380
systemd-firstboot: add vconsole keymap support ( #7035 )
...
Enable systemd-firstboot to set the keymap.
RFE:
https://github.com/systemd/systemd/issues/6346
2017-11-10 10:31:44 +01:00
Yu Watanabe
3fcf65c352
test-parse-util: add more tests, mainly for empty string
2017-11-09 18:39:50 +09:00
Dimitri John Ledkov
02ec6e04fd
test-bpf: use /bin/ping path ( #7276 )
...
This path to ping is compatible with both debian-like and usr-merged
distros. This keeps the test simple, and should thus pass everywhere.
Fixes : #7267
2017-11-08 20:04:55 +01:00
John Lin
142468d895
systemctl: respect [Install] section in drop-ins ( #7158 )
...
Fixes : #7114
2017-11-08 18:04:31 +01:00
Yu Watanabe
23fd04e92d
test: add test for ReadOnlyPaths= with RuntimeDirectory=
2017-11-08 15:48:32 +09:00
Yu Watanabe
85e55d14de
tree-wide: do not work in assert() ( #7271 )
...
Fixes #7270 .
2017-11-07 16:04:20 +03:00
Zbigniew Jędrzejewski-Szmek
09571e3ffc
test-util: silence clang warning about unaligned access
2017-11-01 23:10:25 +01:00
Zbigniew Jędrzejewski-Szmek
ac097c841e
Remove a bunch of unused variables
...
gcc does not warn about those, because of the _cleanup_ usage.
clang is smarter here.
2017-11-01 23:06:44 +01:00
Matija Skala
d7e454ba9c
fix includes
...
sys/wait.h is needed for WEXITED macro
poll.h is more portable than sys/poll.h
2017-10-30 10:32:45 +01:00
Lennart Poettering
9672b58398
test: add simple test for validating some of the unit specifiers we support
...
(Also, sort list of test unit files in meson.build alphabetically, to
make future additions more systematic)
2017-10-26 18:01:04 +02:00
Zbigniew Jędrzejewski-Szmek
b996f7e41a
tests: rename test-time to test-time-util
...
It's for testing time-util.c so rename it to make things more
obvious.
2017-10-18 11:27:23 +02:00
Zbigniew Jędrzejewski-Szmek
be21bf856b
test-path: fix inverted return value ( #7050 )
...
It must be <0 to indicate failure.
Fixes #7050 .
2017-10-17 17:49:48 +02:00