diff options
author | Tom Gundersen <teg@jklm.no> | 2015-10-27 16:55:16 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-10-27 16:55:16 +0100 |
commit | 0d0696812980d8f41c54739ad73716a233a2fa7c (patch) | |
tree | 217d98308a3039e106efde5fd6a7b6a657916950 /src/test | |
parent | f47fc3ffc4b69a00083a76308f777b52afb8efbf (diff) | |
parent | 7760171904ef007f19e8f46aa240a00e382d5b74 (diff) |
Merge pull request #1691 from poettering/util-lib-3
split up util.h and macro.h into even more bits
Diffstat (limited to 'src/test')
39 files changed, 88 insertions, 41 deletions
diff --git a/src/test/test-async.c b/src/test/test-async.c index abd36d693c..ada6d67c42 100644 --- a/src/test/test-async.c +++ b/src/test/test-async.c @@ -20,8 +20,9 @@ #include <unistd.h> #include "async.h" -#include "util.h" +#include "fileio.h" #include "macro.h" +#include "util.h" static bool test_async = false; diff --git a/src/test/test-btrfs.c b/src/test/test-btrfs.c index afe3ff8fc2..33356f8387 100644 --- a/src/test/test-btrfs.c +++ b/src/test/test-btrfs.c @@ -25,6 +25,7 @@ #include "fd-util.h" #include "fileio.h" #include "log.h" +#include "parse-util.h" #include "string-util.h" #include "util.h" diff --git a/src/test/test-calendarspec.c b/src/test/test-calendarspec.c index 12f366a34c..70819b0371 100644 --- a/src/test/test-calendarspec.c +++ b/src/test/test-calendarspec.c @@ -21,6 +21,7 @@ #include <string.h> +#include "alloc-util.h" #include "calendarspec.h" #include "string-util.h" #include "util.h" diff --git a/src/test/test-cap-list.c b/src/test/test-cap-list.c index 43a2d35b80..4418bafda6 100644 --- a/src/test/test-cap-list.c +++ b/src/test/test-cap-list.c @@ -19,12 +19,15 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "util.h" -#include "fileio.h" -#include "cap-list.h" -#include "capability.h" #include <sys/prctl.h> +#include "alloc-util.h" +#include "cap-list.h" +#include "capability-util.h" +#include "fileio.h" +#include "parse-util.h" +#include "util.h" + /* verify the capability parser */ static void test_cap_list(void) { int i; diff --git a/src/test/test-capability.c b/src/test/test-capability.c index 09d7e61e92..fc8d3ffe0d 100644 --- a/src/test/test-capability.c +++ b/src/test/test-capability.c @@ -24,7 +24,7 @@ #include <sys/wait.h> #include <unistd.h> -#include "capability.h" +#include "capability-util.h" #include "fd-util.h" #include "macro.h" #include "util.h" diff --git a/src/test/test-cgroup-util.c b/src/test/test-cgroup-util.c index 7bf59a0aa2..a48b324e26 100644 --- a/src/test/test-cgroup-util.c +++ b/src/test/test-cgroup-util.c @@ -19,12 +19,16 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include "alloc-util.h" #include "cgroup-util.h" +#include "dirent-util.h" #include "fd-util.h" #include "formats-util.h" +#include "parse-util.h" #include "process-util.h" #include "string-util.h" #include "test-helper.h" +#include "user-util.h" #include "util.h" static void check_p_d_u(const char *path, int code, const char *result) { diff --git a/src/test/test-condition.c b/src/test/test-condition.c index 91a27138eb..f224c6cdd8 100644 --- a/src/test/test-condition.c +++ b/src/test/test-condition.c @@ -19,9 +19,10 @@ #include "sd-id128.h" +#include "alloc-util.h" #include "apparmor-util.h" #include "architecture.h" -#include "audit.h" +#include "audit-util.h" #include "condition.h" #include "hostname-util.h" #include "ima-util.h" diff --git a/src/test/test-conf-files.c b/src/test/test-conf-files.c index 30ba5364c4..a69698d4ea 100644 --- a/src/test/test-conf-files.c +++ b/src/test/test-conf-files.c @@ -22,11 +22,14 @@ #include <stdarg.h> #include <stdio.h> +#include "alloc-util.h" #include "conf-files.h" +#include "fs-util.h" #include "macro.h" #include "rm-rf.h" #include "string-util.h" #include "strv.h" +#include "user-util.h" #include "util.h" static void setup_test_dir(char *tmp_dir, const char *files, ...) { diff --git a/src/test/test-copy.c b/src/test/test-copy.c index 1bd50edca2..ad57cb0202 100644 --- a/src/test/test-copy.c +++ b/src/test/test-copy.c @@ -19,9 +19,11 @@ #include <unistd.h> +#include "alloc-util.h" #include "copy.h" #include "fd-util.h" #include "fileio.h" +#include "fs-util.h" #include "macro.h" #include "mkdir.h" #include "path-util.h" diff --git a/src/test/test-date.c b/src/test/test-date.c index e1c6ecb2ef..c6d8bf82ea 100644 --- a/src/test/test-date.c +++ b/src/test/test-date.c @@ -21,8 +21,9 @@ #include <string.h> -#include "util.h" +#include "alloc-util.h" #include "string-util.h" +#include "util.h" static void test_should_pass(const char *p) { usec_t t, q; diff --git a/src/test/test-device-nodes.c b/src/test/test-device-nodes.c index 1c745d6e5b..646b168cc0 100644 --- a/src/test/test-device-nodes.c +++ b/src/test/test-device-nodes.c @@ -21,6 +21,7 @@ #include <sys/types.h> +#include "alloc-util.h" #include "device-nodes.h" #include "string-util.h" #include "util.h" diff --git a/src/test/test-dns-domain.c b/src/test/test-dns-domain.c index 1a8541e1cc..d5778748a0 100644 --- a/src/test/test-dns-domain.c +++ b/src/test/test-dns-domain.c @@ -19,6 +19,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include "alloc-util.h" #include "dns-domain.h" #include "macro.h" #include "string-util.h" diff --git a/src/test/test-ellipsize.c b/src/test/test-ellipsize.c index 033d5af719..c597d5aecd 100644 --- a/src/test/test-ellipsize.c +++ b/src/test/test-ellipsize.c @@ -21,6 +21,7 @@ #include <stdio.h> +#include "alloc-util.h" #include "def.h" #include "string-util.h" #include "terminal-util.h" diff --git a/src/test/test-execute.c b/src/test/test-execute.c index fa6336f1fb..cdbfe6698e 100644 --- a/src/test/test-execute.c +++ b/src/test/test-execute.c @@ -19,12 +19,13 @@ #include <stdio.h> -#include "unit.h" -#include "manager.h" -#include "util.h" +#include "fs-util.h" #include "macro.h" +#include "manager.h" #include "mkdir.h" #include "rm-rf.h" +#include "unit.h" +#include "util.h" typedef void (*test_function_t)(Manager *m); diff --git a/src/test/test-fdset.c b/src/test/test-fdset.c index 96d5e38177..282aab1246 100644 --- a/src/test/test-fdset.c +++ b/src/test/test-fdset.c @@ -22,6 +22,7 @@ #include "fd-util.h" #include "fdset.h" +#include "fileio.h" #include "macro.h" #include "util.h" diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c index a40f013491..e588681b86 100644 --- a/src/test/test-fileio.c +++ b/src/test/test-fileio.c @@ -23,11 +23,13 @@ #include <fcntl.h> #include <unistd.h> +#include "alloc-util.h" #include "ctype.h" #include "def.h" #include "env-util.h" #include "fd-util.h" #include "fileio.h" +#include "parse-util.h" #include "process-util.h" #include "string-util.h" #include "strv.h" diff --git a/src/test/test-fstab-util.c b/src/test/test-fstab-util.c index b02f3a6e7c..27816ac779 100644 --- a/src/test/test-fstab-util.c +++ b/src/test/test-fstab-util.c @@ -19,6 +19,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include "alloc-util.h" #include "fstab-util.h" #include "log.h" #include "string-util.h" diff --git a/src/test/test-hashmap-plain.c b/src/test/test-hashmap-plain.c index 2da6446961..6bf33306a9 100644 --- a/src/test/test-hashmap-plain.c +++ b/src/test/test-hashmap-plain.c @@ -17,6 +17,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include "alloc-util.h" #include "hashmap.h" #include "string-util.h" #include "strv.h" diff --git a/src/test/test-hostname-util.c b/src/test/test-hostname-util.c index ac8f4ecc68..590175433c 100644 --- a/src/test/test-hostname-util.c +++ b/src/test/test-hostname-util.c @@ -21,10 +21,11 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "util.h" +#include "alloc-util.h" #include "fileio.h" #include "hostname-util.h" #include "string-util.h" +#include "util.h" static void test_hostname_is_valid(void) { assert_se(hostname_is_valid("foobar", false)); diff --git a/src/test/test-id128.c b/src/test/test-id128.c index 2c8ba70ffb..32cf3f80ca 100644 --- a/src/test/test-id128.c +++ b/src/test/test-id128.c @@ -24,6 +24,7 @@ #include "sd-daemon.h" #include "sd-id128.h" +#include "alloc-util.h" #include "macro.h" #include "string-util.h" #include "util.h" diff --git a/src/test/test-json.c b/src/test/test-json.c index ba4d75c0c8..3995224eea 100644 --- a/src/test/test-json.c +++ b/src/test/test-json.c @@ -21,6 +21,7 @@ #include <math.h> +#include "alloc-util.h" #include "json.h" #include "string-util.h" #include "util.h" diff --git a/src/test/test-namespace.c b/src/test/test-namespace.c index a060a7ba6f..5a12e959d4 100644 --- a/src/test/test-namespace.c +++ b/src/test/test-namespace.c @@ -21,6 +21,7 @@ #include <sys/socket.h> +#include "alloc-util.h" #include "fd-util.h" #include "namespace.h" #include "process-util.h" diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c index 89129c9894..3f0f0264ab 100644 --- a/src/test/test-path-util.c +++ b/src/test/test-path-util.c @@ -23,8 +23,10 @@ #include <sys/mount.h> #include <unistd.h> +#include "alloc-util.h" #include "fd-util.h" #include "macro.h" +#include "mount-util.h" #include "path-util.h" #include "rm-rf.h" #include "string-util.h" @@ -77,20 +79,6 @@ static void test_path(void) { assert_se(streq(basename("/aa///file..."), "file...")); assert_se(streq(basename("file.../"), "")); -#define test_parent(x, y) { \ - _cleanup_free_ char *z = NULL; \ - int r = path_get_parent(x, &z); \ - printf("expected: %s\n", y ? y : "error"); \ - printf("actual: %s\n", r<0 ? "error" : z); \ - assert_se((y==NULL) ^ (r==0)); \ - assert_se(y==NULL || path_equal(z, y)); \ - } - - test_parent("./aa/bb/../file.da.", "./aa/bb/.."); - test_parent("/aa///.file", "/aa///"); - test_parent("/aa///file...", "/aa///"); - test_parent("file.../", NULL); - fd = open("/", O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_NOCTTY); assert_se(fd >= 0); assert_se(fd_is_mount_point(fd, "/", 0) > 0); diff --git a/src/test/test-path.c b/src/test/test-path.c index e9e0bfd41d..ff0f044958 100644 --- a/src/test/test-path.c +++ b/src/test/test-path.c @@ -20,6 +20,9 @@ #include <stdbool.h> #include <stdio.h> +#include "alloc-util.h" +#include "fd-util.h" +#include "fs-util.h" #include "macro.h" #include "manager.h" #include "mkdir.h" @@ -28,7 +31,6 @@ #include "strv.h" #include "unit.h" #include "util.h" -#include "fd-util.h" typedef void (*test_function_t)(Manager *m); diff --git a/src/test/test-prioq.c b/src/test/test-prioq.c index 1e2e42cbca..07273ffe79 100644 --- a/src/test/test-prioq.c +++ b/src/test/test-prioq.c @@ -21,10 +21,11 @@ #include <stdlib.h> -#include "util.h" -#include "set.h" +#include "alloc-util.h" #include "prioq.h" +#include "set.h" #include "siphash24.h" +#include "util.h" #define SET_SIZE 1024*4 diff --git a/src/test/test-process-util.c b/src/test/test-process-util.c index 16a7148b19..48be5a3a87 100644 --- a/src/test/test-process-util.c +++ b/src/test/test-process-util.c @@ -23,6 +23,7 @@ #include <sys/wait.h> #include <unistd.h> +#include "alloc-util.h" #include "log.h" #include "macro.h" #include "process-util.h" @@ -54,7 +55,7 @@ static void test_get_process_comm(void) { assert_se(get_process_cmdline(1, 8, false, &d) >= 0); log_info("pid1 cmdline truncated: '%s'", d); - assert_se(get_parent_of_pid(1, &e) >= 0); + assert_se(get_process_ppid(1, &e) >= 0); log_info("pid1 ppid: "PID_FMT, e); assert_se(e == 0); diff --git a/src/test/test-socket-util.c b/src/test/test-socket-util.c index 4a2d952c86..b9699b2028 100644 --- a/src/test/test-socket-util.c +++ b/src/test/test-socket-util.c @@ -17,6 +17,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include "alloc-util.h" #include "async.h" #include "fd-util.h" #include "in-addr-util.h" diff --git a/src/test/test-strv.c b/src/test/test-strv.c index c676893719..c27f15283e 100644 --- a/src/test/test-strv.c +++ b/src/test/test-strv.c @@ -22,6 +22,7 @@ #include <string.h> +#include "alloc-util.h" #include "specifier.h" #include "string-util.h" #include "strv.h" diff --git a/src/test/test-tables.c b/src/test/test-tables.c index 0e5ab1645f..ed4abdbf12 100644 --- a/src/test/test-tables.c +++ b/src/test/test-tables.c @@ -17,7 +17,10 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include "architecture.h" #include "automount.h" +#include "bus-xml-policy.h" +#include "busname.h" #include "cgroup.h" #include "compress.h" #include "condition.h" @@ -25,7 +28,10 @@ #include "execute.h" #include "install.h" #include "job.h" +#include "journald-server.h" #include "kill.h" +#include "link-config.h" +#include "locale-util.h" #include "log.h" #include "logs-show.h" #include "mount.h" @@ -42,12 +48,7 @@ #include "unit-name.h" #include "unit.h" #include "util.h" -#include "architecture.h" -#include "link-config.h" -#include "bus-xml-policy.h" -#include "busname.h" -#include "journald-server.h" -#include "locale-util.h" +#include "rlimit-util.h" #include "test-tables.h" diff --git a/src/test/test-terminal-util.c b/src/test/test-terminal-util.c index a41de59719..e940b5a204 100644 --- a/src/test/test-terminal-util.c +++ b/src/test/test-terminal-util.c @@ -21,11 +21,12 @@ #include <stdio.h> #include <stdbool.h> -#include "terminal-util.h" +#include "fd-util.h" +#include "fileio.h" +#include "log.h" #include "macro.h" +#include "terminal-util.h" #include "util.h" -#include "log.h" -#include "fd-util.h" static void test_default_term_for_tty(void) { puts(default_term_for_tty("/dev/tty23")); diff --git a/src/test/test-tmpfiles.c b/src/test/test-tmpfiles.c index 6aa9cc8473..a8bd722e44 100644 --- a/src/test/test-tmpfiles.c +++ b/src/test/test-tmpfiles.c @@ -24,7 +24,9 @@ #include <stdlib.h> #include <unistd.h> +#include "alloc-util.h" #include "fd-util.h" +#include "fileio.h" #include "formats-util.h" #include "string-util.h" #include "util.h" diff --git a/src/test/test-udev.c b/src/test/test-udev.c index 3b9f71e3a2..219d659b41 100644 --- a/src/test/test-udev.c +++ b/src/test/test-udev.c @@ -26,6 +26,7 @@ #include <sys/signalfd.h> #include <unistd.h> +#include "fs-util.h" #include "missing.h" #include "selinux-util.h" #include "signal-util.h" diff --git a/src/test/test-uid-range.c b/src/test/test-uid-range.c index bc5baa2fcb..4dcf10e26d 100644 --- a/src/test/test-uid-range.c +++ b/src/test/test-uid-range.c @@ -21,8 +21,10 @@ #include <stddef.h> -#include "util.h" +#include "alloc-util.h" #include "uid-range.h" +#include "user-util.h" +#include "util.h" int main(int argc, char *argv[]) { _cleanup_free_ UidRange *p = NULL; diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c index 226453d06e..c58c48af3c 100644 --- a/src/test/test-unit-file.c +++ b/src/test/test-unit-file.c @@ -26,6 +26,7 @@ #include <string.h> #include <unistd.h> +#include "alloc-util.h" #include "fd-util.h" #include "fileio.h" #include "hashmap.h" diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c index 5aff771af5..9db7853dd4 100644 --- a/src/test/test-unit-name.c +++ b/src/test/test-unit-name.c @@ -26,6 +26,7 @@ #include <stdlib.h> #include <string.h> +#include "alloc-util.h" #include "hostname-util.h" #include "macro.h" #include "manager.h" diff --git a/src/test/test-user-util.c b/src/test/test-user-util.c index dfd2031998..09d37087e5 100644 --- a/src/test/test-user-util.c +++ b/src/test/test-user-util.c @@ -19,6 +19,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include "alloc-util.h" #include "macro.h" #include "string-util.h" #include "user-util.h" diff --git a/src/test/test-utf8.c b/src/test/test-utf8.c index a8e15b7cf1..0af8349732 100644 --- a/src/test/test-utf8.c +++ b/src/test/test-utf8.c @@ -19,6 +19,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include "alloc-util.h" #include "utf8.h" #include "util.h" #include "string-util.h" diff --git a/src/test/test-util.c b/src/test/test-util.c index c1f8a866af..ffde10c7e1 100644 --- a/src/test/test-util.c +++ b/src/test/test-util.c @@ -31,22 +31,33 @@ #include <sys/xattr.h> #include <unistd.h> +#include "alloc-util.h" #include "conf-parser.h" #include "cpu-set-util.h" #include "def.h" #include "escape.h" #include "fd-util.h" #include "fileio.h" +#include "fs-util.h" +#include "fstab-util.h" +#include "glob-util.h" +#include "hexdecoct.h" #include "io-util.h" #include "mkdir.h" +#include "parse-util.h" +#include "path-util.h" +#include "proc-cmdline.h" #include "process-util.h" #include "rm-rf.h" #include "signal-util.h" +#include "stat-util.h" #include "string-util.h" #include "strv.h" +#include "user-util.h" #include "util.h" #include "virt.h" -#include "user-util.h" +#include "web-util.h" +#include "xattr-util.h" static void test_streq_ptr(void) { assert_se(streq_ptr(NULL, NULL)); diff --git a/src/test/test-xml.c b/src/test/test-xml.c index 93b0e7c3fb..548d75a3c3 100644 --- a/src/test/test-xml.c +++ b/src/test/test-xml.c @@ -21,6 +21,7 @@ #include <stdarg.h> +#include "alloc-util.h" #include "string-util.h" #include "util.h" #include "xml.h" |