Bug Summary

File:build-scan/../src/test/test-unit-file.c
Warning:line 661, column 9
Potential leak of memory pointed to by 'd1'

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name test-unit-file.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=all -relaxed-aliasing -menable-no-infs -menable-no-nans -menable-unsafe-fp-math -fno-signed-zeros -mreassociate -freciprocal-math -fdenormal-fp-math=preserve-sign,preserve-sign -ffp-contract=fast -fno-rounding-math -ffast-math -ffinite-math-only -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/12.0.0 -include config.h -I test-unit-file.p -I . -I .. -I src/basic -I ../src/basic -I src/shared -I ../src/shared -I src/systemd -I ../src/systemd -I src/journal -I ../src/journal -I src/journal-remote -I ../src/journal-remote -I src/nspawn -I ../src/nspawn -I src/resolve -I ../src/resolve -I src/timesync -I ../src/timesync -I ../src/time-wait-sync -I src/login -I ../src/login -I src/udev -I ../src/udev -I src/libudev -I ../src/libudev -I src/core -I ../src/core -I ../src/libsystemd/sd-bus -I ../src/libsystemd/sd-device -I ../src/libsystemd/sd-hwdb -I ../src/libsystemd/sd-id128 -I ../src/libsystemd/sd-netlink -I ../src/libsystemd/sd-network -I src/libsystemd-network -I ../src/libsystemd-network -I /usr/include/libmount -I /usr/include/blkid -D _FILE_OFFSET_BITS=64 -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/12.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wwrite-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Wno-format-signedness -Wno-error=nonnull -std=gnu99 -fconst-strings -fdebug-compilation-dir /home/mrc0mmand/repos/@redhat-plumbers/systemd-rhel8/build-scan -ferror-limit 19 -fvisibility hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcolor-diagnostics -analyzer-output=html -faddrsig -o /tmp/scan-build-2021-07-16-221226-1465241-1 -x c ../src/test/test-unit-file.c
1/* SPDX-License-Identifier: LGPL-2.1+ */
2
3#include <fcntl.h>
4#include <stddef.h>
5#include <stdio.h>
6#include <string.h>
7#include <sys/capability.h>
8#include <unistd.h>
9
10#include "alloc-util.h"
11#include "all-units.h"
12#include "capability-util.h"
13#include "conf-parser.h"
14#include "fd-util.h"
15#include "fileio.h"
16#include "fs-util.h"
17#include "hashmap.h"
18#include "hostname-util.h"
19#include "install-printf.h"
20#include "install.h"
21#include "load-fragment.h"
22#include "macro.h"
23#include "rm-rf.h"
24#include "specifier.h"
25#include "string-util.h"
26#include "strv.h"
27#include "test-helper.h"
28#include "tests.h"
29#include "user-util.h"
30#include "util.h"
31
32static int test_unit_file_get_set(void) {
33 int r;
34 Hashmap *h;
35 Iterator i;
36 UnitFileList *p;
37
38 h = hashmap_new(&string_hash_ops)internal_hashmap_new(&string_hash_ops );
39 assert_se(h)do { if ((__builtin_expect(!!(!(h)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("h"), "../src/test/test-unit-file.c", 39
, __PRETTY_FUNCTION__); } while (0)
;
40
41 r = unit_file_get_list(UNIT_FILE_SYSTEM, NULL((void*)0), h, NULL((void*)0), NULL((void*)0));
42
43 if (IN_SET(r, -EPERM, -EACCES)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended
[20 - sizeof((int[]){-1, -13})/sizeof(int)]; switch(r) { case
-1: case -13: _found = 1; break; default: break; } _found; }
)
) {
44 log_notice_errno(r, "Skipping test: unit_file_get_list: %m")({ int _level = ((5)), _e = ((r)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 44, __func__, "Skipping test: unit_file_get_list: %m"
) : -abs(_e); })
;
45 return EXIT_TEST_SKIP77;
46 }
47
48 log_full_errno(r == 0 ? LOG_INFO : LOG_ERR, r,({ int _level = ((r == 0 ? 6 : 3)), _e = ((r)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 49, __func__, "unit_file_get_list: %m"
) : -abs(_e); })
49 "unit_file_get_list: %m")({ int _level = ((r == 0 ? 6 : 3)), _e = ((r)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 49, __func__, "unit_file_get_list: %m"
) : -abs(_e); })
;
50 if (r < 0)
51 return EXIT_FAILURE1;
52
53 HASHMAP_FOREACH(p, h, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); hashmap_iterate((h), &(i), (void
**)&(p), ((void*)0)); )
54 printf("%s = %s\n", p->path, unit_file_state_to_string(p->state));
55
56 unit_file_list_free(h);
57
58 return 0;
59}
60
61static void check_execcommand(ExecCommand *c,
62 const char* path,
63 const char* argv0,
64 const char* argv1,
65 const char* argv2,
66 bool_Bool ignore) {
67 size_t n;
68
69 assert_se(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("c"), "../src/test/test-unit-file.c", 69
, __PRETTY_FUNCTION__); } while (0)
;
70 log_info("expect: \"%s\" [\"%s\" \"%s\" \"%s\"]",({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 71, __func__, "expect: \"%s\" [\"%s\" \"%s\" \"%s\"]"
, path, argv0 ?: path, argv1, argv2) : -abs(_e); })
71 path, argv0 ?: path, argv1, argv2)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 71, __func__, "expect: \"%s\" [\"%s\" \"%s\" \"%s\"]"
, path, argv0 ?: path, argv1, argv2) : -abs(_e); })
;
72 n = strv_length(c->argv);
73 log_info("actual: \"%s\" [\"%s\" \"%s\" \"%s\"]",({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 74, __func__, "actual: \"%s\" [\"%s\" \"%s\" \"%s\"]"
, c->path, c->argv[0], n > 0 ? c->argv[1] : ((void
*)0), n > 1 ? c->argv[2] : ((void*)0)) : -abs(_e); })
74 c->path, c->argv[0], n > 0 ? c->argv[1] : NULL, n > 1 ? c->argv[2] : NULL)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 74, __func__, "actual: \"%s\" [\"%s\" \"%s\" \"%s\"]"
, c->path, c->argv[0], n > 0 ? c->argv[1] : ((void
*)0), n > 1 ? c->argv[2] : ((void*)0)) : -abs(_e); })
;
75 assert_se(streq(c->path, path))do { if ((__builtin_expect(!!(!((strcmp((c->path),(path)) ==
0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(c->path, path)"
), "../src/test/test-unit-file.c", 75, __PRETTY_FUNCTION__); }
while (0)
;
76 assert_se(streq(c->argv[0], argv0 ?: path))do { if ((__builtin_expect(!!(!((strcmp((c->argv[0]),(argv0
?: path)) == 0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("streq(c->argv[0], argv0 ?: path)"), "../src/test/test-unit-file.c"
, 76, __PRETTY_FUNCTION__); } while (0)
;
77 if (n > 0)
78 assert_se(streq_ptr(c->argv[1], argv1))do { if ((__builtin_expect(!!(!(streq_ptr(c->argv[1], argv1
))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq_ptr(c->argv[1], argv1)"
), "../src/test/test-unit-file.c", 78, __PRETTY_FUNCTION__); }
while (0)
;
79 if (n > 1)
80 assert_se(streq_ptr(c->argv[2], argv2))do { if ((__builtin_expect(!!(!(streq_ptr(c->argv[2], argv2
))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq_ptr(c->argv[2], argv2)"
), "../src/test/test-unit-file.c", 80, __PRETTY_FUNCTION__); }
while (0)
;
81 assert_se(!!(c->flags & EXEC_COMMAND_IGNORE_FAILURE) == ignore)do { if ((__builtin_expect(!!(!(!!(c->flags & EXEC_COMMAND_IGNORE_FAILURE
) == ignore)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD,
("!!(c->flags & EXEC_COMMAND_IGNORE_FAILURE) == ignore"
), "../src/test/test-unit-file.c", 81, __PRETTY_FUNCTION__); }
while (0)
;
82}
83
84static void test_config_parse_exec(void) {
85 /* int config_parse_exec(
86 const char *unit,
87 const char *filename,
88 unsigned line,
89 const char *section,
90 unsigned section_line,
91 const char *lvalue,
92 int ltype,
93 const char *rvalue,
94 void *data,
95 void *userdata) */
96 int r;
97
98 ExecCommand *c = NULL((void*)0), *c1;
99 const char *ccc;
100 _cleanup_(manager_freep)__attribute__((cleanup(manager_freep))) Manager *m = NULL((void*)0);
101 _cleanup_(unit_freep)__attribute__((cleanup(unit_freep))) Unit *u = NULL((void*)0);
102
103 r = manager_new(UNIT_FILE_USER, MANAGER_TEST_RUN_MINIMAL, &m);
104 if (MANAGER_SKIP_TEST(r)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended
[20 - sizeof((int[]){-1, -13, -98, -112, -2, -123})/sizeof(int
)]; switch(r) { case -1: case -13: case -98: case -112: case -
2: case -123: _found = 1; break; default: break; } _found; })
) {
105 log_notice_errno(r, "Skipping test: manager_new: %m")({ int _level = ((5)), _e = ((r)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 105, __func__, "Skipping test: manager_new: %m"
) : -abs(_e); })
;
106 return;
107 }
108
109 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 109, __PRETTY_FUNCTION__); } while (0)
;
110 assert_se(manager_startup(m, NULL, NULL) >= 0)do { if ((__builtin_expect(!!(!(manager_startup(m, ((void*)0)
, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("manager_startup(m, NULL, NULL) >= 0"), "../src/test/test-unit-file.c"
, 110, __PRETTY_FUNCTION__); } while (0)
;
111
112 assert_se(u = unit_new(m, sizeof(Service)))do { if ((__builtin_expect(!!(!(u = unit_new(m, sizeof(Service
)))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("u = unit_new(m, sizeof(Service))"
), "../src/test/test-unit-file.c", 112, __PRETTY_FUNCTION__);
} while (0)
;
113
114 log_info("/* basic test */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 114, __func__, "/* basic test */"
) : -abs(_e); })
;
115 r = config_parse_exec(NULL((void*)0), "fake", 1, "section", 1,
116 "LValue", 0, "/RValue r1",
117 &c, u);
118 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 118, __PRETTY_FUNCTION__); } while (0)
;
119 check_execcommand(c, "/RValue", "/RValue", "r1", NULL((void*)0), false0);
120
121 r = config_parse_exec(NULL((void*)0), "fake", 2, "section", 1,
122 "LValue", 0, "/RValue///slashes r1///",
123 &c, u);
124
125 log_info("/* test slashes */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 125, __func__, "/* test slashes */"
) : -abs(_e); })
;
126 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 126, __PRETTY_FUNCTION__); } while (0)
;
127 c1 = c->command_next;
128 check_execcommand(c1, "/RValue/slashes", "/RValue///slashes", "r1///", NULL((void*)0), false0);
129
130 log_info("/* trailing slash */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 130, __func__, "/* trailing slash */"
) : -abs(_e); })
;
131 r = config_parse_exec(NULL((void*)0), "fake", 4, "section", 1,
132 "LValue", 0, "/RValue/ argv0 r1",
133 &c, u);
134 assert_se(r == -ENOEXEC)do { if ((__builtin_expect(!!(!(r == -8)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r == -ENOEXEC"), "../src/test/test-unit-file.c"
, 134, __PRETTY_FUNCTION__); } while (0)
;
135 assert_se(c1->command_next == NULL)do { if ((__builtin_expect(!!(!(c1->command_next == ((void
*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c1->command_next == NULL"
), "../src/test/test-unit-file.c", 135, __PRETTY_FUNCTION__);
} while (0)
;
136
137 log_info("/* honour_argv0 */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 137, __func__, "/* honour_argv0 */"
) : -abs(_e); })
;
138 r = config_parse_exec(NULL((void*)0), "fake", 3, "section", 1,
139 "LValue", 0, "@/RValue///slashes2 ///argv0 r1",
140 &c, u);
141 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 141, __PRETTY_FUNCTION__); } while (0)
;
142 c1 = c1->command_next;
143 check_execcommand(c1, "/RValue/slashes2", "///argv0", "r1", NULL((void*)0), false0);
144
145 log_info("/* honour_argv0, no args */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 145, __func__, "/* honour_argv0, no args */"
) : -abs(_e); })
;
146 r = config_parse_exec(NULL((void*)0), "fake", 3, "section", 1,
147 "LValue", 0, "@/RValue",
148 &c, u);
149 assert_se(r == -ENOEXEC)do { if ((__builtin_expect(!!(!(r == -8)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r == -ENOEXEC"), "../src/test/test-unit-file.c"
, 149, __PRETTY_FUNCTION__); } while (0)
;
150 assert_se(c1->command_next == NULL)do { if ((__builtin_expect(!!(!(c1->command_next == ((void
*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c1->command_next == NULL"
), "../src/test/test-unit-file.c", 150, __PRETTY_FUNCTION__);
} while (0)
;
151
152 log_info("/* no command, whitespace only, reset */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 152, __func__, "/* no command, whitespace only, reset */"
) : -abs(_e); })
;
153 r = config_parse_exec(NULL((void*)0), "fake", 3, "section", 1,
154 "LValue", 0, " ",
155 &c, u);
156 assert_se(r == 0)do { if ((__builtin_expect(!!(!(r == 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r == 0"), "../src/test/test-unit-file.c"
, 156, __PRETTY_FUNCTION__); } while (0)
;
157 assert_se(c == NULL)do { if ((__builtin_expect(!!(!(c == ((void*)0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("c == NULL"), "../src/test/test-unit-file.c"
, 157, __PRETTY_FUNCTION__); } while (0)
;
158
159 log_info("/* ignore && honour_argv0 */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 159, __func__, "/* ignore && honour_argv0 */"
) : -abs(_e); })
;
160 r = config_parse_exec(NULL((void*)0), "fake", 4, "section", 1,
161 "LValue", 0, "-@/RValue///slashes3 argv0a r1",
162 &c, u);
163 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 163, __PRETTY_FUNCTION__); } while (0)
;
164 c1 = c;
165 check_execcommand(c1, "/RValue/slashes3", "argv0a", "r1", NULL((void*)0), true1);
166
167 log_info("/* ignore && honour_argv0 */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 167, __func__, "/* ignore && honour_argv0 */"
) : -abs(_e); })
;
168 r = config_parse_exec(NULL((void*)0), "fake", 4, "section", 1,
169 "LValue", 0, "@-/RValue///slashes4 argv0b r1",
170 &c, u);
171 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 171, __PRETTY_FUNCTION__); } while (0)
;
172 c1 = c1->command_next;
173 check_execcommand(c1, "/RValue/slashes4", "argv0b", "r1", NULL((void*)0), true1);
174
175 log_info("/* ignore && ignore */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 175, __func__, "/* ignore && ignore */"
) : -abs(_e); })
;
176 r = config_parse_exec(NULL((void*)0), "fake", 4, "section", 1,
177 "LValue", 0, "--/RValue argv0 r1",
178 &c, u);
179 assert_se(r == 0)do { if ((__builtin_expect(!!(!(r == 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r == 0"), "../src/test/test-unit-file.c"
, 179, __PRETTY_FUNCTION__); } while (0)
;
180 assert_se(c1->command_next == NULL)do { if ((__builtin_expect(!!(!(c1->command_next == ((void
*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c1->command_next == NULL"
), "../src/test/test-unit-file.c", 180, __PRETTY_FUNCTION__);
} while (0)
;
181
182 log_info("/* ignore && ignore (2) */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 182, __func__, "/* ignore && ignore (2) */"
) : -abs(_e); })
;
183 r = config_parse_exec(NULL((void*)0), "fake", 4, "section", 1,
184 "LValue", 0, "-@-/RValue argv0 r1",
185 &c, u);
186 assert_se(r == 0)do { if ((__builtin_expect(!!(!(r == 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r == 0"), "../src/test/test-unit-file.c"
, 186, __PRETTY_FUNCTION__); } while (0)
;
187 assert_se(c1->command_next == NULL)do { if ((__builtin_expect(!!(!(c1->command_next == ((void
*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c1->command_next == NULL"
), "../src/test/test-unit-file.c", 187, __PRETTY_FUNCTION__);
} while (0)
;
188
189 log_info("/* semicolon */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 189, __func__, "/* semicolon */"
) : -abs(_e); })
;
190 r = config_parse_exec(NULL((void*)0), "fake", 5, "section", 1,
191 "LValue", 0,
192 "-@/RValue argv0 r1 ; "
193 "/goo/goo boo",
194 &c, u);
195 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 195, __PRETTY_FUNCTION__); } while (0)
;
196 c1 = c1->command_next;
197 check_execcommand(c1, "/RValue", "argv0", "r1", NULL((void*)0), true1);
198
199 c1 = c1->command_next;
200 check_execcommand(c1, "/goo/goo", NULL((void*)0), "boo", NULL((void*)0), false0);
201
202 log_info("/* two semicolons in a row */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 202, __func__, "/* two semicolons in a row */"
) : -abs(_e); })
;
203 r = config_parse_exec(NULL((void*)0), "fake", 5, "section", 1,
204 "LValue", 0,
205 "-@/RValue argv0 r1 ; ; "
206 "/goo/goo boo",
207 &c, u);
208 assert_se(r == -ENOEXEC)do { if ((__builtin_expect(!!(!(r == -8)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r == -ENOEXEC"), "../src/test/test-unit-file.c"
, 208, __PRETTY_FUNCTION__); } while (0)
;
209 c1 = c1->command_next;
210 check_execcommand(c1, "/RValue", "argv0", "r1", NULL((void*)0), true1);
211
212 /* second command fails because the executable name is ";" */
213 assert_se(c1->command_next == NULL)do { if ((__builtin_expect(!!(!(c1->command_next == ((void
*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c1->command_next == NULL"
), "../src/test/test-unit-file.c", 213, __PRETTY_FUNCTION__);
} while (0)
;
214
215 log_info("/* trailing semicolon */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 215, __func__, "/* trailing semicolon */"
) : -abs(_e); })
;
216 r = config_parse_exec(NULL((void*)0), "fake", 5, "section", 1,
217 "LValue", 0,
218 "-@/RValue argv0 r1 ; ",
219 &c, u);
220 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 220, __PRETTY_FUNCTION__); } while (0)
;
221 c1 = c1->command_next;
222 check_execcommand(c1, "/RValue", "argv0", "r1", NULL((void*)0), true1);
223
224 assert_se(c1->command_next == NULL)do { if ((__builtin_expect(!!(!(c1->command_next == ((void
*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c1->command_next == NULL"
), "../src/test/test-unit-file.c", 224, __PRETTY_FUNCTION__);
} while (0)
;
225
226 log_info("/* trailing semicolon, no whitespace */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 226, __func__, "/* trailing semicolon, no whitespace */"
) : -abs(_e); })
;
227 r = config_parse_exec(NULL((void*)0), "fake", 5, "section", 1,
228 "LValue", 0,
229 "-@/RValue argv0 r1 ;",
230 &c, u);
231 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 231, __PRETTY_FUNCTION__); } while (0)
;
232 c1 = c1->command_next;
233 check_execcommand(c1, "/RValue", "argv0", "r1", NULL((void*)0), true1);
234
235 assert_se(c1->command_next == NULL)do { if ((__builtin_expect(!!(!(c1->command_next == ((void
*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c1->command_next == NULL"
), "../src/test/test-unit-file.c", 235, __PRETTY_FUNCTION__);
} while (0)
;
236
237 log_info("/* trailing semicolon in single quotes */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 237, __func__, "/* trailing semicolon in single quotes */"
) : -abs(_e); })
;
238 r = config_parse_exec(NULL((void*)0), "fake", 5, "section", 1,
239 "LValue", 0,
240 "-@/RValue argv0 r1 ';'",
241 &c, u);
242 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 242, __PRETTY_FUNCTION__); } while (0)
;
243 c1 = c1->command_next;
244 check_execcommand(c1, "/RValue", "argv0", "r1", ";", true1);
245
246 log_info("/* escaped semicolon */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 246, __func__, "/* escaped semicolon */"
) : -abs(_e); })
;
247 r = config_parse_exec(NULL((void*)0), "fake", 5, "section", 1,
248 "LValue", 0,
249 "/bin/find \\;",
250 &c, u);
251 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 251, __PRETTY_FUNCTION__); } while (0)
;
252 c1 = c1->command_next;
253 check_execcommand(c1, "/bin/find", NULL((void*)0), ";", NULL((void*)0), false0);
254
255 log_info("/* escaped semicolon with following arg */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 255, __func__, "/* escaped semicolon with following arg */"
) : -abs(_e); })
;
256 r = config_parse_exec(NULL((void*)0), "fake", 5, "section", 1,
257 "LValue", 0,
258 "/sbin/find \\; /x",
259 &c, u);
260 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 260, __PRETTY_FUNCTION__); } while (0)
;
261 c1 = c1->command_next;
262 check_execcommand(c1,
263 "/sbin/find", NULL((void*)0), ";", "/x", false0);
264
265 log_info("/* escaped semicolon as part of an expression */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 265, __func__, "/* escaped semicolon as part of an expression */"
) : -abs(_e); })
;
266 r = config_parse_exec(NULL((void*)0), "fake", 5, "section", 1,
267 "LValue", 0,
268 "/sbin/find \\;x",
269 &c, u);
270 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 270, __PRETTY_FUNCTION__); } while (0)
;
271 c1 = c1->command_next;
272 check_execcommand(c1,
273 "/sbin/find", NULL((void*)0), "\\;x", NULL((void*)0), false0);
274
275 log_info("/* encoded semicolon */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 275, __func__, "/* encoded semicolon */"
) : -abs(_e); })
;
276 r = config_parse_exec(NULL((void*)0), "fake", 5, "section", 1,
277 "LValue", 0,
278 "/bin/find \\073",
279 &c, u);
280 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 280, __PRETTY_FUNCTION__); } while (0)
;
281 c1 = c1->command_next;
282 check_execcommand(c1, "/bin/find", NULL((void*)0), ";", NULL((void*)0), false0);
283
284 log_info("/* quoted semicolon */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 284, __func__, "/* quoted semicolon */"
) : -abs(_e); })
;
285 r = config_parse_exec(NULL((void*)0), "fake", 5, "section", 1,
286 "LValue", 0,
287 "/bin/find \";\"",
288 &c, u);
289 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 289, __PRETTY_FUNCTION__); } while (0)
;
290 c1 = c1->command_next;
291 check_execcommand(c1, "/bin/find", NULL((void*)0), ";", NULL((void*)0), false0);
292
293 log_info("/* quoted semicolon with following arg */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 293, __func__, "/* quoted semicolon with following arg */"
) : -abs(_e); })
;
294 r = config_parse_exec(NULL((void*)0), "fake", 5, "section", 1,
295 "LValue", 0,
296 "/sbin/find \";\" /x",
297 &c, u);
298 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 298, __PRETTY_FUNCTION__); } while (0)
;
299 c1 = c1->command_next;
300 check_execcommand(c1,
301 "/sbin/find", NULL((void*)0), ";", "/x", false0);
302
303 log_info("/* spaces in the filename */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 303, __func__, "/* spaces in the filename */"
) : -abs(_e); })
;
304 r = config_parse_exec(NULL((void*)0), "fake", 5, "section", 1,
305 "LValue", 0,
306 "\"/PATH WITH SPACES/daemon\" -1 -2",
307 &c, u);
308 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 308, __PRETTY_FUNCTION__); } while (0)
;
309 c1 = c1->command_next;
310 check_execcommand(c1,
311 "/PATH WITH SPACES/daemon", NULL((void*)0), "-1", "-2", false0);
312
313 log_info("/* spaces in the filename, no args */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 313, __func__, "/* spaces in the filename, no args */"
) : -abs(_e); })
;
314 r = config_parse_exec(NULL((void*)0), "fake", 5, "section", 1,
315 "LValue", 0,
316 "\"/PATH WITH SPACES/daemon -1 -2\"",
317 &c, u);
318 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 318, __PRETTY_FUNCTION__); } while (0)
;
319 c1 = c1->command_next;
320 check_execcommand(c1,
321 "/PATH WITH SPACES/daemon -1 -2", NULL((void*)0), NULL((void*)0), NULL((void*)0), false0);
322
323 log_info("/* spaces in the filename, everything quoted */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 323, __func__, "/* spaces in the filename, everything quoted */"
) : -abs(_e); })
;
324 r = config_parse_exec(NULL((void*)0), "fake", 5, "section", 1,
325 "LValue", 0,
326 "\"/PATH WITH SPACES/daemon\" \"-1\" '-2'",
327 &c, u);
328 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 328, __PRETTY_FUNCTION__); } while (0)
;
329 c1 = c1->command_next;
330 check_execcommand(c1,
331 "/PATH WITH SPACES/daemon", NULL((void*)0), "-1", "-2", false0);
332
333 log_info("/* escaped spaces in the filename */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 333, __func__, "/* escaped spaces in the filename */"
) : -abs(_e); })
;
334 r = config_parse_exec(NULL((void*)0), "fake", 5, "section", 1,
335 "LValue", 0,
336 "\"/PATH\\sWITH\\sSPACES/daemon\" '-1 -2'",
337 &c, u);
338 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 338, __PRETTY_FUNCTION__); } while (0)
;
339 c1 = c1->command_next;
340 check_execcommand(c1,
341 "/PATH WITH SPACES/daemon", NULL((void*)0), "-1 -2", NULL((void*)0), false0);
342
343 log_info("/* escaped spaces in the filename (2) */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 343, __func__, "/* escaped spaces in the filename (2) */"
) : -abs(_e); })
;
344 r = config_parse_exec(NULL((void*)0), "fake", 5, "section", 1,
345 "LValue", 0,
346 "\"/PATH\\x20WITH\\x20SPACES/daemon\" \"-1 -2\"",
347 &c, u);
348 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 348, __PRETTY_FUNCTION__); } while (0)
;
349 c1 = c1->command_next;
350 check_execcommand(c1,
351 "/PATH WITH SPACES/daemon", NULL((void*)0), "-1 -2", NULL((void*)0), false0);
352
353 for (ccc = "abfnrtv\\\'\"x"; *ccc; ccc++) {
354 /* \\x is an incomplete hexadecimal sequence, invalid because of the slash */
355 char path[] = "/path\\X";
356 path[sizeof(path) - 2] = *ccc;
357
358 log_info("/* invalid character: \\%c */", *ccc)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 358, __func__, "/* invalid character: \\%c */"
, *ccc) : -abs(_e); })
;
359 r = config_parse_exec(NULL((void*)0), "fake", 4, "section", 1,
360 "LValue", 0, path,
361 &c, u);
362 assert_se(r == -ENOEXEC)do { if ((__builtin_expect(!!(!(r == -8)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r == -ENOEXEC"), "../src/test/test-unit-file.c"
, 362, __PRETTY_FUNCTION__); } while (0)
;
363 assert_se(c1->command_next == NULL)do { if ((__builtin_expect(!!(!(c1->command_next == ((void
*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c1->command_next == NULL"
), "../src/test/test-unit-file.c", 363, __PRETTY_FUNCTION__);
} while (0)
;
364 }
365
366 log_info("/* valid character: \\s */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 366, __func__, "/* valid character: \\s */"
) : -abs(_e); })
;
367 r = config_parse_exec(NULL((void*)0), "fake", 4, "section", 1,
368 "LValue", 0, "/path\\s",
369 &c, u);
370 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 370, __PRETTY_FUNCTION__); } while (0)
;
371 c1 = c1->command_next;
372 check_execcommand(c1, "/path ", NULL((void*)0), NULL((void*)0), NULL((void*)0), false0);
373
374 log_info("/* quoted backslashes */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 374, __func__, "/* quoted backslashes */"
) : -abs(_e); })
;
375 r = config_parse_exec(NULL((void*)0), "fake", 5, "section", 1,
376 "LValue", 0,
377 "/bin/grep '\\w+\\K'",
378 &c, u);
379 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 379, __PRETTY_FUNCTION__); } while (0)
;
380 c1 = c1->command_next;
381 check_execcommand(c1, "/bin/grep", NULL((void*)0), "\\w+\\K", NULL((void*)0), false0);
382
383 log_info("/* trailing backslash: \\ */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 383, __func__, "/* trailing backslash: \\ */"
) : -abs(_e); })
;
384 /* backslash is invalid */
385 r = config_parse_exec(NULL((void*)0), "fake", 4, "section", 1,
386 "LValue", 0, "/path\\",
387 &c, u);
388 assert_se(r == -ENOEXEC)do { if ((__builtin_expect(!!(!(r == -8)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r == -ENOEXEC"), "../src/test/test-unit-file.c"
, 388, __PRETTY_FUNCTION__); } while (0)
;
389 assert_se(c1->command_next == NULL)do { if ((__builtin_expect(!!(!(c1->command_next == ((void
*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c1->command_next == NULL"
), "../src/test/test-unit-file.c", 389, __PRETTY_FUNCTION__);
} while (0)
;
390
391 log_info("/* missing ending ' */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 391, __func__, "/* missing ending ' */"
) : -abs(_e); })
;
392 r = config_parse_exec(NULL((void*)0), "fake", 4, "section", 1,
393 "LValue", 0, "/path 'foo",
394 &c, u);
395 assert_se(r == -ENOEXEC)do { if ((__builtin_expect(!!(!(r == -8)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r == -ENOEXEC"), "../src/test/test-unit-file.c"
, 395, __PRETTY_FUNCTION__); } while (0)
;
396 assert_se(c1->command_next == NULL)do { if ((__builtin_expect(!!(!(c1->command_next == ((void
*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c1->command_next == NULL"
), "../src/test/test-unit-file.c", 396, __PRETTY_FUNCTION__);
} while (0)
;
397
398 log_info("/* missing ending ' with trailing backslash */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 398, __func__, "/* missing ending ' with trailing backslash */"
) : -abs(_e); })
;
399 r = config_parse_exec(NULL((void*)0), "fake", 4, "section", 1,
400 "LValue", 0, "/path 'foo\\",
401 &c, u);
402 assert_se(r == -ENOEXEC)do { if ((__builtin_expect(!!(!(r == -8)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r == -ENOEXEC"), "../src/test/test-unit-file.c"
, 402, __PRETTY_FUNCTION__); } while (0)
;
403 assert_se(c1->command_next == NULL)do { if ((__builtin_expect(!!(!(c1->command_next == ((void
*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c1->command_next == NULL"
), "../src/test/test-unit-file.c", 403, __PRETTY_FUNCTION__);
} while (0)
;
404
405 log_info("/* invalid space between modifiers */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 405, __func__, "/* invalid space between modifiers */"
) : -abs(_e); })
;
406 r = config_parse_exec(NULL((void*)0), "fake", 4, "section", 1,
407 "LValue", 0, "- /path",
408 &c, u);
409 assert_se(r == 0)do { if ((__builtin_expect(!!(!(r == 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r == 0"), "../src/test/test-unit-file.c"
, 409, __PRETTY_FUNCTION__); } while (0)
;
410 assert_se(c1->command_next == NULL)do { if ((__builtin_expect(!!(!(c1->command_next == ((void
*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c1->command_next == NULL"
), "../src/test/test-unit-file.c", 410, __PRETTY_FUNCTION__);
} while (0)
;
411
412 log_info("/* only modifiers, no path */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 412, __func__, "/* only modifiers, no path */"
) : -abs(_e); })
;
413 r = config_parse_exec(NULL((void*)0), "fake", 4, "section", 1,
414 "LValue", 0, "-",
415 &c, u);
416 assert_se(r == 0)do { if ((__builtin_expect(!!(!(r == 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r == 0"), "../src/test/test-unit-file.c"
, 416, __PRETTY_FUNCTION__); } while (0)
;
417 assert_se(c1->command_next == NULL)do { if ((__builtin_expect(!!(!(c1->command_next == ((void
*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c1->command_next == NULL"
), "../src/test/test-unit-file.c", 417, __PRETTY_FUNCTION__);
} while (0)
;
418
419 log_info("/* empty argument, reset */")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 419, __func__, "/* empty argument, reset */"
) : -abs(_e); })
;
420 r = config_parse_exec(NULL((void*)0), "fake", 4, "section", 1,
421 "LValue", 0, "",
422 &c, u);
423 assert_se(r == 0)do { if ((__builtin_expect(!!(!(r == 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r == 0"), "../src/test/test-unit-file.c"
, 423, __PRETTY_FUNCTION__); } while (0)
;
424 assert_se(c == NULL)do { if ((__builtin_expect(!!(!(c == ((void*)0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("c == NULL"), "../src/test/test-unit-file.c"
, 424, __PRETTY_FUNCTION__); } while (0)
;
425
426 exec_command_free_list(c);
427}
428
429static void test_config_parse_log_extra_fields(void) {
430 /* int config_parse_log_extra_fields(
431 const char *unit,
432 const char *filename,
433 unsigned line,
434 const char *section,
435 unsigned section_line,
436 const char *lvalue,
437 int ltype,
438 const char *rvalue,
439 void *data,
440 void *userdata) */
441
442 int r;
443
444 _cleanup_(manager_freep)__attribute__((cleanup(manager_freep))) Manager *m = NULL((void*)0);
445 _cleanup_(unit_freep)__attribute__((cleanup(unit_freep))) Unit *u = NULL((void*)0);
446 ExecContext c = {};
447
448 r = manager_new(UNIT_FILE_USER, MANAGER_TEST_RUN_MINIMAL, &m);
449 if (MANAGER_SKIP_TEST(r)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended
[20 - sizeof((int[]){-1, -13, -98, -112, -2, -123})/sizeof(int
)]; switch(r) { case -1: case -13: case -98: case -112: case -
2: case -123: _found = 1; break; default: break; } _found; })
) {
450 log_notice_errno(r, "Skipping test: manager_new: %m")({ int _level = ((5)), _e = ((r)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 450, __func__, "Skipping test: manager_new: %m"
) : -abs(_e); })
;
451 return;
452 }
453
454 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 454, __PRETTY_FUNCTION__); } while (0)
;
455 assert_se(manager_startup(m, NULL, NULL) >= 0)do { if ((__builtin_expect(!!(!(manager_startup(m, ((void*)0)
, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("manager_startup(m, NULL, NULL) >= 0"), "../src/test/test-unit-file.c"
, 455, __PRETTY_FUNCTION__); } while (0)
;
456
457 assert_se(u = unit_new(m, sizeof(Service)))do { if ((__builtin_expect(!!(!(u = unit_new(m, sizeof(Service
)))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("u = unit_new(m, sizeof(Service))"
), "../src/test/test-unit-file.c", 457, __PRETTY_FUNCTION__);
} while (0)
;
458
459 log_info("/* %s – basic test */", __func__)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 459, __func__, "/* %s – basic test */"
, __func__) : -abs(_e); })
;
460 r = config_parse_log_extra_fields(NULL((void*)0), "fake", 1, "section", 1,
461 "LValue", 0, "FOO=BAR \"QOOF=quux ' ' \"",
462 &c, u);
463 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 463, __PRETTY_FUNCTION__); } while (0)
;
464 assert_se(c.n_log_extra_fields == 2)do { if ((__builtin_expect(!!(!(c.n_log_extra_fields == 2)),0
))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c.n_log_extra_fields == 2"
), "../src/test/test-unit-file.c", 464, __PRETTY_FUNCTION__);
} while (0)
;
465 assert_se(strneq(c.log_extra_fields[0].iov_base, "FOO=BAR", c.log_extra_fields[0].iov_len))do { if ((__builtin_expect(!!(!((strncmp((c.log_extra_fields[
0].iov_base), ("FOO=BAR"), (c.log_extra_fields[0].iov_len)) ==
0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("strneq(c.log_extra_fields[0].iov_base, \"FOO=BAR\", c.log_extra_fields[0].iov_len)"
), "../src/test/test-unit-file.c", 465, __PRETTY_FUNCTION__);
} while (0)
;
466 assert_se(strneq(c.log_extra_fields[1].iov_base, "QOOF=quux ' ' ", c.log_extra_fields[1].iov_len))do { if ((__builtin_expect(!!(!((strncmp((c.log_extra_fields[
1].iov_base), ("QOOF=quux ' ' "), (c.log_extra_fields[1].iov_len
)) == 0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("strneq(c.log_extra_fields[1].iov_base, \"QOOF=quux ' ' \", c.log_extra_fields[1].iov_len)"
), "../src/test/test-unit-file.c", 466, __PRETTY_FUNCTION__);
} while (0)
;
467
468 log_info("/* %s – add some */", __func__)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 468, __func__, "/* %s – add some */"
, __func__) : -abs(_e); })
;
469 r = config_parse_log_extra_fields(NULL((void*)0), "fake", 1, "section", 1,
470 "LValue", 0, "FOO2=BAR2 QOOF2=quux ' '",
471 &c, u);
472 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 472, __PRETTY_FUNCTION__); } while (0)
;
473 assert_se(c.n_log_extra_fields == 4)do { if ((__builtin_expect(!!(!(c.n_log_extra_fields == 4)),0
))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c.n_log_extra_fields == 4"
), "../src/test/test-unit-file.c", 473, __PRETTY_FUNCTION__);
} while (0)
;
474 assert_se(strneq(c.log_extra_fields[0].iov_base, "FOO=BAR", c.log_extra_fields[0].iov_len))do { if ((__builtin_expect(!!(!((strncmp((c.log_extra_fields[
0].iov_base), ("FOO=BAR"), (c.log_extra_fields[0].iov_len)) ==
0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("strneq(c.log_extra_fields[0].iov_base, \"FOO=BAR\", c.log_extra_fields[0].iov_len)"
), "../src/test/test-unit-file.c", 474, __PRETTY_FUNCTION__);
} while (0)
;
475 assert_se(strneq(c.log_extra_fields[1].iov_base, "QOOF=quux ' ' ", c.log_extra_fields[1].iov_len))do { if ((__builtin_expect(!!(!((strncmp((c.log_extra_fields[
1].iov_base), ("QOOF=quux ' ' "), (c.log_extra_fields[1].iov_len
)) == 0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("strneq(c.log_extra_fields[1].iov_base, \"QOOF=quux ' ' \", c.log_extra_fields[1].iov_len)"
), "../src/test/test-unit-file.c", 475, __PRETTY_FUNCTION__);
} while (0)
;
476 assert_se(strneq(c.log_extra_fields[2].iov_base, "FOO2=BAR2", c.log_extra_fields[2].iov_len))do { if ((__builtin_expect(!!(!((strncmp((c.log_extra_fields[
2].iov_base), ("FOO2=BAR2"), (c.log_extra_fields[2].iov_len))
== 0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("strneq(c.log_extra_fields[2].iov_base, \"FOO2=BAR2\", c.log_extra_fields[2].iov_len)"
), "../src/test/test-unit-file.c", 476, __PRETTY_FUNCTION__);
} while (0)
;
477 assert_se(strneq(c.log_extra_fields[3].iov_base, "QOOF2=quux", c.log_extra_fields[3].iov_len))do { if ((__builtin_expect(!!(!((strncmp((c.log_extra_fields[
3].iov_base), ("QOOF2=quux"), (c.log_extra_fields[3].iov_len)
) == 0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("strneq(c.log_extra_fields[3].iov_base, \"QOOF2=quux\", c.log_extra_fields[3].iov_len)"
), "../src/test/test-unit-file.c", 477, __PRETTY_FUNCTION__);
} while (0)
;
478
479 exec_context_dump(&c, stdoutstdout, " --> ");
480
481 log_info("/* %s – reset */", __func__)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 481, __func__, "/* %s – reset */"
, __func__) : -abs(_e); })
;
482 r = config_parse_log_extra_fields(NULL((void*)0), "fake", 1, "section", 1,
483 "LValue", 0, "",
484 &c, u);
485 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 485, __PRETTY_FUNCTION__); } while (0)
;
486 assert_se(c.n_log_extra_fields == 0)do { if ((__builtin_expect(!!(!(c.n_log_extra_fields == 0)),0
))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c.n_log_extra_fields == 0"
), "../src/test/test-unit-file.c", 486, __PRETTY_FUNCTION__);
} while (0)
;
487
488 exec_context_free_log_extra_fields(&c);
489
490 log_info("/* %s – bye */", __func__)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 490, __func__, "/* %s – bye */"
, __func__) : -abs(_e); })
;
491}
492
493#define env_file_1"a=a\n" "b=b\\\n" "c\n" "d=d\\\n" "e\\\n" "f\n" "g=g\\ \n" "h=h\n"
"i=i\\"
\
494 "a=a\n" \
495 "b=b\\\n" \
496 "c\n" \
497 "d=d\\\n" \
498 "e\\\n" \
499 "f\n" \
500 "g=g\\ \n" \
501 "h=h\n" \
502 "i=i\\"
503
504#define env_file_2"a=a\\\n" \
505 "a=a\\\n"
506
507#define env_file_3"#SPAMD_ARGS=\"-d --socketpath=/var/lib/bulwark/spamd \\\n" "#--nouser-config \\\n"
"normal=line"
\
508 "#SPAMD_ARGS=\"-d --socketpath=/var/lib/bulwark/spamd \\\n" \
509 "#--nouser-config \\\n" \
510 "normal=line"
511
512#define env_file_4"# Generated\n" "\n" "HWMON_MODULES=\"coretemp f71882fg\"\n" "\n"
"# For compatibility reasons\n" "\n" "MODULE_0=coretemp\n" "MODULE_1=f71882fg"
\
513 "# Generated\n" \
514 "\n" \
515 "HWMON_MODULES=\"coretemp f71882fg\"\n" \
516 "\n" \
517 "# For compatibility reasons\n" \
518 "\n" \
519 "MODULE_0=coretemp\n" \
520 "MODULE_1=f71882fg"
521
522#define env_file_5"a=\n" "b=" \
523 "a=\n" \
524 "b="
525
526static void test_load_env_file_1(void) {
527 _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **data = NULL((void*)0);
528 int r;
529
530 _cleanup_(unlink_tempfilep)__attribute__((cleanup(unlink_tempfilep))) char name[] = "/tmp/test-load-env-file.XXXXXX";
531 _cleanup_close___attribute__((cleanup(closep))) int fd;
532
533 fd = mkostemp_safe(name);
534 assert_se(fd >= 0)do { if ((__builtin_expect(!!(!(fd >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("fd >= 0"), "../src/test/test-unit-file.c"
, 534, __PRETTY_FUNCTION__); } while (0)
;
535 assert_se(write(fd, env_file_1, sizeof(env_file_1)) == sizeof(env_file_1))do { if ((__builtin_expect(!!(!(write(fd, "a=a\n" "b=b\\\n" "c\n"
"d=d\\\n" "e\\\n" "f\n" "g=g\\ \n" "h=h\n" "i=i\\", sizeof("a=a\n"
"b=b\\\n" "c\n" "d=d\\\n" "e\\\n" "f\n" "g=g\\ \n" "h=h\n" "i=i\\"
)) == sizeof("a=a\n" "b=b\\\n" "c\n" "d=d\\\n" "e\\\n" "f\n" "g=g\\ \n"
"h=h\n" "i=i\\"))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("write(fd, env_file_1, sizeof(env_file_1)) == sizeof(env_file_1)"
), "../src/test/test-unit-file.c", 535, __PRETTY_FUNCTION__);
} while (0)
;
536
537 r = load_env_file(NULL((void*)0), name, NULL((void*)0), &data);
538 assert_se(r == 0)do { if ((__builtin_expect(!!(!(r == 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r == 0"), "../src/test/test-unit-file.c"
, 538, __PRETTY_FUNCTION__); } while (0)
;
539 assert_se(streq(data[0], "a=a"))do { if ((__builtin_expect(!!(!((strcmp((data[0]),("a=a")) ==
0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(data[0], \"a=a\")"
), "../src/test/test-unit-file.c", 539, __PRETTY_FUNCTION__);
} while (0)
;
540 assert_se(streq(data[1], "b=bc"))do { if ((__builtin_expect(!!(!((strcmp((data[1]),("b=bc")) ==
0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(data[1], \"b=bc\")"
), "../src/test/test-unit-file.c", 540, __PRETTY_FUNCTION__);
} while (0)
;
541 assert_se(streq(data[2], "d=def"))do { if ((__builtin_expect(!!(!((strcmp((data[2]),("d=def")) ==
0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(data[2], \"d=def\")"
), "../src/test/test-unit-file.c", 541, __PRETTY_FUNCTION__);
} while (0)
;
542 assert_se(streq(data[3], "g=g "))do { if ((__builtin_expect(!!(!((strcmp((data[3]),("g=g ")) ==
0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(data[3], \"g=g \")"
), "../src/test/test-unit-file.c", 542, __PRETTY_FUNCTION__);
} while (0)
;
543 assert_se(streq(data[4], "h=h"))do { if ((__builtin_expect(!!(!((strcmp((data[4]),("h=h")) ==
0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(data[4], \"h=h\")"
), "../src/test/test-unit-file.c", 543, __PRETTY_FUNCTION__);
} while (0)
;
544 assert_se(streq(data[5], "i=i"))do { if ((__builtin_expect(!!(!((strcmp((data[5]),("i=i")) ==
0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(data[5], \"i=i\")"
), "../src/test/test-unit-file.c", 544, __PRETTY_FUNCTION__);
} while (0)
;
545 assert_se(data[6] == NULL)do { if ((__builtin_expect(!!(!(data[6] == ((void*)0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("data[6] == NULL"), "../src/test/test-unit-file.c"
, 545, __PRETTY_FUNCTION__); } while (0)
;
546}
547
548static void test_load_env_file_2(void) {
549 _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **data = NULL((void*)0);
550 int r;
551
552 _cleanup_(unlink_tempfilep)__attribute__((cleanup(unlink_tempfilep))) char name[] = "/tmp/test-load-env-file.XXXXXX";
553 _cleanup_close___attribute__((cleanup(closep))) int fd;
554
555 fd = mkostemp_safe(name);
556 assert_se(fd >= 0)do { if ((__builtin_expect(!!(!(fd >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("fd >= 0"), "../src/test/test-unit-file.c"
, 556, __PRETTY_FUNCTION__); } while (0)
;
557 assert_se(write(fd, env_file_2, sizeof(env_file_2)) == sizeof(env_file_2))do { if ((__builtin_expect(!!(!(write(fd, "a=a\\\n", sizeof("a=a\\\n"
)) == sizeof("a=a\\\n"))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("write(fd, env_file_2, sizeof(env_file_2)) == sizeof(env_file_2)"
), "../src/test/test-unit-file.c", 557, __PRETTY_FUNCTION__);
} while (0)
;
558
559 r = load_env_file(NULL((void*)0), name, NULL((void*)0), &data);
560 assert_se(r == 0)do { if ((__builtin_expect(!!(!(r == 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r == 0"), "../src/test/test-unit-file.c"
, 560, __PRETTY_FUNCTION__); } while (0)
;
561 assert_se(streq(data[0], "a=a"))do { if ((__builtin_expect(!!(!((strcmp((data[0]),("a=a")) ==
0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(data[0], \"a=a\")"
), "../src/test/test-unit-file.c", 561, __PRETTY_FUNCTION__);
} while (0)
;
562 assert_se(data[1] == NULL)do { if ((__builtin_expect(!!(!(data[1] == ((void*)0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("data[1] == NULL"), "../src/test/test-unit-file.c"
, 562, __PRETTY_FUNCTION__); } while (0)
;
563}
564
565static void test_load_env_file_3(void) {
566 _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **data = NULL((void*)0);
567 int r;
568
569 _cleanup_(unlink_tempfilep)__attribute__((cleanup(unlink_tempfilep))) char name[] = "/tmp/test-load-env-file.XXXXXX";
570 _cleanup_close___attribute__((cleanup(closep))) int fd;
571
572 fd = mkostemp_safe(name);
573 assert_se(fd >= 0)do { if ((__builtin_expect(!!(!(fd >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("fd >= 0"), "../src/test/test-unit-file.c"
, 573, __PRETTY_FUNCTION__); } while (0)
;
574 assert_se(write(fd, env_file_3, sizeof(env_file_3)) == sizeof(env_file_3))do { if ((__builtin_expect(!!(!(write(fd, "#SPAMD_ARGS=\"-d --socketpath=/var/lib/bulwark/spamd \\\n"
"#--nouser-config \\\n" "normal=line"
, sizeof("#SPAMD_ARGS=\"-d --socketpath=/var/lib/bulwark/spamd \\\n"
"#--nouser-config \\\n" "normal=line"
)) == sizeof("#SPAMD_ARGS=\"-d --socketpath=/var/lib/bulwark/spamd \\\n"
"#--nouser-config \\\n" "normal=line"
))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("write(fd, env_file_3, sizeof(env_file_3)) == sizeof(env_file_3)"
), "../src/test/test-unit-file.c", 574, __PRETTY_FUNCTION__);
} while (0)
;
575
576 r = load_env_file(NULL((void*)0), name, NULL((void*)0), &data);
577 assert_se(r == 0)do { if ((__builtin_expect(!!(!(r == 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r == 0"), "../src/test/test-unit-file.c"
, 577, __PRETTY_FUNCTION__); } while (0)
;
578 assert_se(data == NULL)do { if ((__builtin_expect(!!(!(data == ((void*)0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("data == NULL"), "../src/test/test-unit-file.c"
, 578, __PRETTY_FUNCTION__); } while (0)
;
579}
580
581static void test_load_env_file_4(void) {
582 _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **data = NULL((void*)0);
583 _cleanup_(unlink_tempfilep)__attribute__((cleanup(unlink_tempfilep))) char name[] = "/tmp/test-load-env-file.XXXXXX";
584 _cleanup_close___attribute__((cleanup(closep))) int fd;
585 int r;
586
587 fd = mkostemp_safe(name);
588 assert_se(fd >= 0)do { if ((__builtin_expect(!!(!(fd >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("fd >= 0"), "../src/test/test-unit-file.c"
, 588, __PRETTY_FUNCTION__); } while (0)
;
589 assert_se(write(fd, env_file_4, sizeof(env_file_4)) == sizeof(env_file_4))do { if ((__builtin_expect(!!(!(write(fd, "# Generated\n" "\n"
"HWMON_MODULES=\"coretemp f71882fg\"\n" "\n" "# For compatibility reasons\n"
"\n" "MODULE_0=coretemp\n" "MODULE_1=f71882fg", sizeof("# Generated\n"
"\n" "HWMON_MODULES=\"coretemp f71882fg\"\n" "\n" "# For compatibility reasons\n"
"\n" "MODULE_0=coretemp\n" "MODULE_1=f71882fg")) == sizeof("# Generated\n"
"\n" "HWMON_MODULES=\"coretemp f71882fg\"\n" "\n" "# For compatibility reasons\n"
"\n" "MODULE_0=coretemp\n" "MODULE_1=f71882fg"))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("write(fd, env_file_4, sizeof(env_file_4)) == sizeof(env_file_4)"
), "../src/test/test-unit-file.c", 589, __PRETTY_FUNCTION__);
} while (0)
;
590
591 r = load_env_file(NULL((void*)0), name, NULL((void*)0), &data);
592 assert_se(r == 0)do { if ((__builtin_expect(!!(!(r == 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r == 0"), "../src/test/test-unit-file.c"
, 592, __PRETTY_FUNCTION__); } while (0)
;
593 assert_se(streq(data[0], "HWMON_MODULES=coretemp f71882fg"))do { if ((__builtin_expect(!!(!((strcmp((data[0]),("HWMON_MODULES=coretemp f71882fg"
)) == 0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(data[0], \"HWMON_MODULES=coretemp f71882fg\")"
), "../src/test/test-unit-file.c", 593, __PRETTY_FUNCTION__);
} while (0)
;
594 assert_se(streq(data[1], "MODULE_0=coretemp"))do { if ((__builtin_expect(!!(!((strcmp((data[1]),("MODULE_0=coretemp"
)) == 0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(data[1], \"MODULE_0=coretemp\")"
), "../src/test/test-unit-file.c", 594, __PRETTY_FUNCTION__);
} while (0)
;
595 assert_se(streq(data[2], "MODULE_1=f71882fg"))do { if ((__builtin_expect(!!(!((strcmp((data[2]),("MODULE_1=f71882fg"
)) == 0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(data[2], \"MODULE_1=f71882fg\")"
), "../src/test/test-unit-file.c", 595, __PRETTY_FUNCTION__);
} while (0)
;
596 assert_se(data[3] == NULL)do { if ((__builtin_expect(!!(!(data[3] == ((void*)0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("data[3] == NULL"), "../src/test/test-unit-file.c"
, 596, __PRETTY_FUNCTION__); } while (0)
;
597}
598
599static void test_load_env_file_5(void) {
600 _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **data = NULL((void*)0);
601 int r;
602
603 _cleanup_(unlink_tempfilep)__attribute__((cleanup(unlink_tempfilep))) char name[] = "/tmp/test-load-env-file.XXXXXX";
604 _cleanup_close___attribute__((cleanup(closep))) int fd;
605
606 fd = mkostemp_safe(name);
607 assert_se(fd >= 0)do { if ((__builtin_expect(!!(!(fd >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("fd >= 0"), "../src/test/test-unit-file.c"
, 607, __PRETTY_FUNCTION__); } while (0)
;
608 assert_se(write(fd, env_file_5, sizeof(env_file_5)) == sizeof(env_file_5))do { if ((__builtin_expect(!!(!(write(fd, "a=\n" "b=", sizeof
("a=\n" "b=")) == sizeof("a=\n" "b="))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("write(fd, env_file_5, sizeof(env_file_5)) == sizeof(env_file_5)"
), "../src/test/test-unit-file.c", 608, __PRETTY_FUNCTION__);
} while (0)
;
609
610 r = load_env_file(NULL((void*)0), name, NULL((void*)0), &data);
611 assert_se(r == 0)do { if ((__builtin_expect(!!(!(r == 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r == 0"), "../src/test/test-unit-file.c"
, 611, __PRETTY_FUNCTION__); } while (0)
;
612 assert_se(streq(data[0], "a="))do { if ((__builtin_expect(!!(!((strcmp((data[0]),("a=")) == 0
))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(data[0], \"a=\")"
), "../src/test/test-unit-file.c", 612, __PRETTY_FUNCTION__);
} while (0)
;
613 assert_se(streq(data[1], "b="))do { if ((__builtin_expect(!!(!((strcmp((data[1]),("b=")) == 0
))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(data[1], \"b=\")"
), "../src/test/test-unit-file.c", 613, __PRETTY_FUNCTION__);
} while (0)
;
614 assert_se(data[2] == NULL)do { if ((__builtin_expect(!!(!(data[2] == ((void*)0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("data[2] == NULL"), "../src/test/test-unit-file.c"
, 614, __PRETTY_FUNCTION__); } while (0)
;
615}
616
617static void test_install_printf(void) {
618 char name[] = "name.service",
619 path[] = "/run/systemd/system/name.service";
620 UnitFileInstallInfo i = { .name = name, .path = path, };
621 UnitFileInstallInfo i2 = { .name= name, .path = path, };
622 char name3[] = "name@inst.service",
623 path3[] = "/run/systemd/system/name.service";
624 UnitFileInstallInfo i3 = { .name = name3, .path = path3, };
625 UnitFileInstallInfo i4 = { .name = name3, .path = path3, };
626
627 _cleanup_free___attribute__((cleanup(freep))) char *mid = NULL((void*)0), *bid = NULL((void*)0), *host = NULL((void*)0), *uid = NULL((void*)0), *user = NULL((void*)0);
628
629 assert_se(specifier_machine_id('m', NULL, NULL, &mid) >= 0 && mid)do { if ((__builtin_expect(!!(!(specifier_machine_id('m', ((void
*)0), ((void*)0), &mid) >= 0 && mid)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("specifier_machine_id('m', NULL, NULL, &mid) >= 0 && mid"
), "../src/test/test-unit-file.c", 629, __PRETTY_FUNCTION__);
} while (0)
;
1
Assuming the condition is true
2
Assuming the condition is false
3
Taking false branch
4
Loop condition is false. Exiting loop
630 assert_se(specifier_boot_id('b', NULL, NULL, &bid) >= 0 && bid)do { if ((__builtin_expect(!!(!(specifier_boot_id('b', ((void
*)0), ((void*)0), &bid) >= 0 && bid)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("specifier_boot_id('b', NULL, NULL, &bid) >= 0 && bid"
), "../src/test/test-unit-file.c", 630, __PRETTY_FUNCTION__);
} while (0)
;
5
Assuming the condition is true
6
Assuming the condition is false
7
Taking false branch
8
Loop condition is false. Exiting loop
631 assert_se(host = gethostname_malloc())do { if ((__builtin_expect(!!(!(host = gethostname_malloc()))
,0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("host = gethostname_malloc()"
), "../src/test/test-unit-file.c", 631, __PRETTY_FUNCTION__);
} while (0)
;
9
Assuming 'host' is non-null
10
Taking false branch
11
Loop condition is false. Exiting loop
632 assert_se(user = uid_to_name(getuid()))do { if ((__builtin_expect(!!(!(user = uid_to_name(getuid()))
),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("user = uid_to_name(getuid())"
), "../src/test/test-unit-file.c", 632, __PRETTY_FUNCTION__);
} while (0)
;
12
Assuming 'user' is non-null
13
Taking false branch
14
Loop condition is false. Exiting loop
633 assert_se(asprintf(&uid, UID_FMT, getuid()) >= 0)do { if ((__builtin_expect(!!(!(asprintf(&uid, "%" "u", getuid
()) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD,
("asprintf(&uid, UID_FMT, getuid()) >= 0"), "../src/test/test-unit-file.c"
, 633, __PRETTY_FUNCTION__); } while (0)
;
15
Assuming the condition is true
16
Taking false branch
17
Loop condition is false. Exiting loop
634
635#define expect(src, pattern, result)do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
src, pattern, &t) >= 0 || !result)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&src, pattern, &t) >= 0 || !result"
), "../src/test/test-unit-file.c", 635, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 635, __PRETTY_FUNCTION__);
} while (0); if (result) { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),(result)) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, result)"), "../src/test/test-unit-file.c"
, 635, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 635, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
\
636 do { \
637 _cleanup_free___attribute__((cleanup(freep))) char *t = NULL((void*)0); \
638 _cleanup_free___attribute__((cleanup(freep))) char \
639 *d1 = strdup(i.name), \
640 *d2 = strdup(i.path); \
641 assert_se(install_full_printf(&src, pattern, &t) >= 0 || !result)do { if ((__builtin_expect(!!(!(install_full_printf(&src,
pattern, &t) >= 0 || !result)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&src, pattern, &t) >= 0 || !result"
), "../src/test/test-unit-file.c", 641, __PRETTY_FUNCTION__);
} while (0)
; \
642 memzero(i.name, strlen(i.name))({ size_t _l_ = (strlen(i.name)); void *_x_ = (i.name); _l_ ==
0 ? _x_ : memset(_x_, 0, _l_); })
; \
643 memzero(i.path, strlen(i.path))({ size_t _l_ = (strlen(i.path)); void *_x_ = (i.path); _l_ ==
0 ? _x_ : memset(_x_, 0, _l_); })
; \
644 assert_se(d1 && d2)do { if ((__builtin_expect(!!(!(d1 && d2)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("d1 && d2"), "../src/test/test-unit-file.c"
, 644, __PRETTY_FUNCTION__); } while (0)
; \
645 if (result) { \
646 printf("%s\n", t); \
647 assert_se(streq(t, result))do { if ((__builtin_expect(!!(!((strcmp((t),(result)) == 0)))
,0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(t, result)"
), "../src/test/test-unit-file.c", 647, __PRETTY_FUNCTION__);
} while (0)
; \
648 } else assert_se(t == NULL)do { if ((__builtin_expect(!!(!(t == ((void*)0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("t == NULL"), "../src/test/test-unit-file.c"
, 648, __PRETTY_FUNCTION__); } while (0)
; \
649 strcpy(i.name, d1); \
650 strcpy(i.path, d2); \
651 } while (false0)
652
653 expect(i, "%n", "name.service")do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i, "%n", &t) >= 0 || !"name.service")),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i, \"%n\", &t) >= 0 || !\"name.service\""
), "../src/test/test-unit-file.c", 653, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 653, __PRETTY_FUNCTION__);
} while (0); if ("name.service") { printf("%s\n", t); do { if
((__builtin_expect(!!(!((strcmp((t),("name.service")) == 0))
),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(t, \"name.service\")"
), "../src/test/test-unit-file.c", 653, __PRETTY_FUNCTION__);
} while (0); } else do { if ((__builtin_expect(!!(!(t == ((void
*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("t == NULL"
), "../src/test/test-unit-file.c", 653, __PRETTY_FUNCTION__);
} while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
18
Assuming the condition is true
19
Taking false branch
20
Loop condition is false. Exiting loop
21
Assuming '_l_' is equal to 0
22
'?' condition is true
23
Assuming '_l_' is equal to 0
24
'?' condition is true
25
Assuming 'd1' is non-null
26
Assuming the condition is false
27
Taking false branch
28
Loop condition is false. Exiting loop
29
Taking true branch
30
Taking false branch
31
Loop condition is false. Exiting loop
32
Loop condition is false. Exiting loop
654 expect(i, "%N", "name")do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i, "%N", &t) >= 0 || !"name")),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i, \"%N\", &t) >= 0 || !\"name\""
), "../src/test/test-unit-file.c", 654, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 654, __PRETTY_FUNCTION__);
} while (0); if ("name") { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),("name")) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, \"name\")"), "../src/test/test-unit-file.c"
, 654, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 654, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
33
Assuming the condition is true
34
Taking false branch
35
Loop condition is false. Exiting loop
36
Assuming '_l_' is equal to 0
37
'?' condition is true
38
Assuming '_l_' is equal to 0
39
'?' condition is true
40
Assuming 'd1' is non-null
41
Assuming the condition is false
42
Taking false branch
43
Loop condition is false. Exiting loop
44
Taking true branch
45
Taking false branch
46
Loop condition is false. Exiting loop
47
Loop condition is false. Exiting loop
655 expect(i, "%p", "name")do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i, "%p", &t) >= 0 || !"name")),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i, \"%p\", &t) >= 0 || !\"name\""
), "../src/test/test-unit-file.c", 655, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 655, __PRETTY_FUNCTION__);
} while (0); if ("name") { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),("name")) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, \"name\")"), "../src/test/test-unit-file.c"
, 655, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 655, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
48
Assuming the condition is true
49
Taking false branch
50
Loop condition is false. Exiting loop
51
Assuming '_l_' is equal to 0
52
'?' condition is true
53
Assuming '_l_' is equal to 0
54
'?' condition is true
55
Assuming 'd1' is non-null
56
Assuming the condition is false
57
Taking false branch
58
Loop condition is false. Exiting loop
59
Taking true branch
60
Taking false branch
61
Loop condition is false. Exiting loop
62
Loop condition is false. Exiting loop
656 expect(i, "%i", "")do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i, "%i", &t) >= 0 || !"")),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i, \"%i\", &t) >= 0 || !\"\""
), "../src/test/test-unit-file.c", 656, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 656, __PRETTY_FUNCTION__);
} while (0); if ("") { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),("")) == 0))),0))) log_assert_failed_realm(
LOG_REALM_SYSTEMD, ("streq(t, \"\")"), "../src/test/test-unit-file.c"
, 656, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 656, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
63
Assuming the condition is true
64
Taking false branch
65
Loop condition is false. Exiting loop
66
Assuming '_l_' is equal to 0
67
'?' condition is true
68
Assuming '_l_' is equal to 0
69
'?' condition is true
70
Assuming 'd1' is non-null
71
Assuming the condition is false
72
Taking false branch
73
Loop condition is false. Exiting loop
74
Taking true branch
75
Taking false branch
76
Loop condition is false. Exiting loop
77
Loop condition is false. Exiting loop
657 expect(i, "%j", "name")do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i, "%j", &t) >= 0 || !"name")),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i, \"%j\", &t) >= 0 || !\"name\""
), "../src/test/test-unit-file.c", 657, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 657, __PRETTY_FUNCTION__);
} while (0); if ("name") { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),("name")) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, \"name\")"), "../src/test/test-unit-file.c"
, 657, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 657, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
78
Assuming the condition is true
79
Taking false branch
80
Loop condition is false. Exiting loop
81
Assuming '_l_' is equal to 0
82
'?' condition is true
83
Assuming '_l_' is equal to 0
84
'?' condition is true
85
Assuming 'd1' is non-null
86
Assuming the condition is false
87
Taking false branch
88
Loop condition is false. Exiting loop
89
Taking true branch
90
Taking false branch
91
Loop condition is false. Exiting loop
92
Loop condition is false. Exiting loop
658 expect(i, "%u", user)do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i, "%u", &t) >= 0 || !user)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i, \"%u\", &t) >= 0 || !user"
), "../src/test/test-unit-file.c", 658, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 658, __PRETTY_FUNCTION__);
} while (0); if (user) { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),(user)) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, user)"), "../src/test/test-unit-file.c"
, 658, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 658, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
93
Assuming the condition is true
94
Taking false branch
95
Loop condition is false. Exiting loop
96
Assuming '_l_' is equal to 0
97
'?' condition is true
98
Assuming '_l_' is equal to 0
99
'?' condition is true
100
Assuming 'd1' is non-null
101
Assuming the condition is false
102
Taking false branch
103
Loop condition is false. Exiting loop
104
Taking true branch
105
Taking false branch
106
Loop condition is false. Exiting loop
107
Loop condition is false. Exiting loop
659 expect(i, "%U", uid)do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i, "%U", &t) >= 0 || !uid)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i, \"%U\", &t) >= 0 || !uid"
), "../src/test/test-unit-file.c", 659, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 659, __PRETTY_FUNCTION__);
} while (0); if (uid) { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),(uid)) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, uid)"), "../src/test/test-unit-file.c"
, 659, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 659, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
108
Assuming the condition is true
109
Taking false branch
110
Loop condition is false. Exiting loop
111
Assuming '_l_' is equal to 0
112
'?' condition is true
113
Assuming '_l_' is equal to 0
114
'?' condition is true
115
Assuming 'd1' is non-null
116
Assuming the condition is false
117
Taking false branch
118
Loop condition is false. Exiting loop
119
Assuming 'uid' is null
120
Taking false branch
121
Assuming 't' is equal to null
122
Taking false branch
123
Loop condition is false. Exiting loop
124
Loop condition is false. Exiting loop
660
661 expect(i, "%m", mid)do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i, "%m", &t) >= 0 || !mid)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i, \"%m\", &t) >= 0 || !mid"
), "../src/test/test-unit-file.c", 661, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 661, __PRETTY_FUNCTION__);
} while (0); if (mid) { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),(mid)) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, mid)"), "../src/test/test-unit-file.c"
, 661, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 661, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
125
Memory is allocated
126
Assuming the condition is true
127
Taking false branch
128
Loop condition is false. Exiting loop
129
Assuming '_l_' is equal to 0
130
'?' condition is true
131
Assuming '_l_' is equal to 0
132
'?' condition is true
133
Assuming 'd1' is non-null
134
Assuming the condition is false
135
Taking false branch
136
Loop condition is false. Exiting loop
137
Taking true branch
138
Taking false branch
139
Loop condition is false. Exiting loop
140
Potential leak of memory pointed to by 'd1'
662 expect(i, "%b", bid)do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i, "%b", &t) >= 0 || !bid)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i, \"%b\", &t) >= 0 || !bid"
), "../src/test/test-unit-file.c", 662, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 662, __PRETTY_FUNCTION__);
} while (0); if (bid) { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),(bid)) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, bid)"), "../src/test/test-unit-file.c"
, 662, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 662, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
663 expect(i, "%H", host)do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i, "%H", &t) >= 0 || !host)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i, \"%H\", &t) >= 0 || !host"
), "../src/test/test-unit-file.c", 663, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 663, __PRETTY_FUNCTION__);
} while (0); if (host) { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),(host)) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, host)"), "../src/test/test-unit-file.c"
, 663, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 663, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
664
665 expect(i2, "%u", user)do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i2, "%u", &t) >= 0 || !user)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i2, \"%u\", &t) >= 0 || !user"
), "../src/test/test-unit-file.c", 665, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 665, __PRETTY_FUNCTION__);
} while (0); if (user) { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),(user)) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, user)"), "../src/test/test-unit-file.c"
, 665, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 665, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
666 expect(i2, "%U", uid)do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i2, "%U", &t) >= 0 || !uid)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i2, \"%U\", &t) >= 0 || !uid"
), "../src/test/test-unit-file.c", 666, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 666, __PRETTY_FUNCTION__);
} while (0); if (uid) { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),(uid)) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, uid)"), "../src/test/test-unit-file.c"
, 666, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 666, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
667
668 expect(i3, "%n", "name@inst.service")do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i3, "%n", &t) >= 0 || !"name@inst.service")),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i3, \"%n\", &t) >= 0 || !\"name@inst.service\""
), "../src/test/test-unit-file.c", 668, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 668, __PRETTY_FUNCTION__);
} while (0); if ("name@inst.service") { printf("%s\n", t); do
{ if ((__builtin_expect(!!(!((strcmp((t),("name@inst.service"
)) == 0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(t, \"name@inst.service\")"
), "../src/test/test-unit-file.c", 668, __PRETTY_FUNCTION__);
} while (0); } else do { if ((__builtin_expect(!!(!(t == ((void
*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("t == NULL"
), "../src/test/test-unit-file.c", 668, __PRETTY_FUNCTION__);
} while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
669 expect(i3, "%N", "name@inst")do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i3, "%N", &t) >= 0 || !"name@inst")),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i3, \"%N\", &t) >= 0 || !\"name@inst\""
), "../src/test/test-unit-file.c", 669, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 669, __PRETTY_FUNCTION__);
} while (0); if ("name@inst") { printf("%s\n", t); do { if (
(__builtin_expect(!!(!((strcmp((t),("name@inst")) == 0))),0))
) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(t, \"name@inst\")"
), "../src/test/test-unit-file.c", 669, __PRETTY_FUNCTION__);
} while (0); } else do { if ((__builtin_expect(!!(!(t == ((void
*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("t == NULL"
), "../src/test/test-unit-file.c", 669, __PRETTY_FUNCTION__);
} while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
670 expect(i3, "%p", "name")do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i3, "%p", &t) >= 0 || !"name")),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i3, \"%p\", &t) >= 0 || !\"name\""
), "../src/test/test-unit-file.c", 670, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 670, __PRETTY_FUNCTION__);
} while (0); if ("name") { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),("name")) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, \"name\")"), "../src/test/test-unit-file.c"
, 670, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 670, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
671 expect(i3, "%u", user)do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i3, "%u", &t) >= 0 || !user)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i3, \"%u\", &t) >= 0 || !user"
), "../src/test/test-unit-file.c", 671, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 671, __PRETTY_FUNCTION__);
} while (0); if (user) { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),(user)) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, user)"), "../src/test/test-unit-file.c"
, 671, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 671, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
672 expect(i3, "%U", uid)do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i3, "%U", &t) >= 0 || !uid)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i3, \"%U\", &t) >= 0 || !uid"
), "../src/test/test-unit-file.c", 672, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 672, __PRETTY_FUNCTION__);
} while (0); if (uid) { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),(uid)) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, uid)"), "../src/test/test-unit-file.c"
, 672, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 672, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
673
674 expect(i3, "%m", mid)do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i3, "%m", &t) >= 0 || !mid)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i3, \"%m\", &t) >= 0 || !mid"
), "../src/test/test-unit-file.c", 674, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 674, __PRETTY_FUNCTION__);
} while (0); if (mid) { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),(mid)) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, mid)"), "../src/test/test-unit-file.c"
, 674, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 674, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
675 expect(i3, "%b", bid)do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i3, "%b", &t) >= 0 || !bid)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i3, \"%b\", &t) >= 0 || !bid"
), "../src/test/test-unit-file.c", 675, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 675, __PRETTY_FUNCTION__);
} while (0); if (bid) { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),(bid)) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, bid)"), "../src/test/test-unit-file.c"
, 675, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 675, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
676 expect(i3, "%H", host)do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i3, "%H", &t) >= 0 || !host)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i3, \"%H\", &t) >= 0 || !host"
), "../src/test/test-unit-file.c", 676, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 676, __PRETTY_FUNCTION__);
} while (0); if (host) { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),(host)) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, host)"), "../src/test/test-unit-file.c"
, 676, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 676, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
677
678 expect(i4, "%u", user)do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i4, "%u", &t) >= 0 || !user)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i4, \"%u\", &t) >= 0 || !user"
), "../src/test/test-unit-file.c", 678, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 678, __PRETTY_FUNCTION__);
} while (0); if (user) { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),(user)) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, user)"), "../src/test/test-unit-file.c"
, 678, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 678, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
679 expect(i4, "%U", uid)do { __attribute__((cleanup(freep))) char *t = ((void*)0); __attribute__
((cleanup(freep))) char *d1 = strdup(i.name), *d2 = strdup(i.
path); do { if ((__builtin_expect(!!(!(install_full_printf(&
i4, "%U", &t) >= 0 || !uid)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("install_full_printf(&i4, \"%U\", &t) >= 0 || !uid"
), "../src/test/test-unit-file.c", 679, __PRETTY_FUNCTION__);
} while (0); ({ size_t _l_ = (strlen(i.name)); void *_x_ = (
i.name); _l_ == 0 ? _x_ : memset(_x_, 0, _l_); }); ({ size_t _l_
= (strlen(i.path)); void *_x_ = (i.path); _l_ == 0 ? _x_ : memset
(_x_, 0, _l_); }); do { if ((__builtin_expect(!!(!(d1 &&
d2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("d1 && d2"
), "../src/test/test-unit-file.c", 679, __PRETTY_FUNCTION__);
} while (0); if (uid) { printf("%s\n", t); do { if ((__builtin_expect
(!!(!((strcmp((t),(uid)) == 0))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("streq(t, uid)"), "../src/test/test-unit-file.c"
, 679, __PRETTY_FUNCTION__); } while (0); } else do { if ((__builtin_expect
(!!(!(t == ((void*)0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("t == NULL"), "../src/test/test-unit-file.c", 679, __PRETTY_FUNCTION__
); } while (0); strcpy(i.name, d1); strcpy(i.path, d2); } while
(0)
;
680}
681
682static uint64_t make_cap(int cap) {
683 return ((uint64_t) 1ULL << (uint64_t) cap);
684}
685
686static void test_config_parse_capability_set(void) {
687 /* int config_parse_capability_set(
688 const char *unit,
689 const char *filename,
690 unsigned line,
691 const char *section,
692 unsigned section_line,
693 const char *lvalue,
694 int ltype,
695 const char *rvalue,
696 void *data,
697 void *userdata) */
698 int r;
699 uint64_t capability_bounding_set = 0;
700
701 r = config_parse_capability_set(NULL((void*)0), "fake", 1, "section", 1,
702 "CapabilityBoundingSet", 0, "CAP_NET_RAW",
703 &capability_bounding_set, NULL((void*)0));
704 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 704, __PRETTY_FUNCTION__); } while (0)
;
705 assert_se(capability_bounding_set == make_cap(CAP_NET_RAW))do { if ((__builtin_expect(!!(!(capability_bounding_set == make_cap
(13))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("capability_bounding_set == make_cap(CAP_NET_RAW)"
), "../src/test/test-unit-file.c", 705, __PRETTY_FUNCTION__);
} while (0)
;
706
707 r = config_parse_capability_set(NULL((void*)0), "fake", 1, "section", 1,
708 "CapabilityBoundingSet", 0, "CAP_NET_ADMIN",
709 &capability_bounding_set, NULL((void*)0));
710 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 710, __PRETTY_FUNCTION__); } while (0)
;
711 assert_se(capability_bounding_set == (make_cap(CAP_NET_RAW) | make_cap(CAP_NET_ADMIN)))do { if ((__builtin_expect(!!(!(capability_bounding_set == (make_cap
(13) | make_cap(12)))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("capability_bounding_set == (make_cap(CAP_NET_RAW) | make_cap(CAP_NET_ADMIN))"
), "../src/test/test-unit-file.c", 711, __PRETTY_FUNCTION__);
} while (0)
;
712
713 r = config_parse_capability_set(NULL((void*)0), "fake", 1, "section", 1,
714 "CapabilityBoundingSet", 0, "~CAP_NET_ADMIN",
715 &capability_bounding_set, NULL((void*)0));
716 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 716, __PRETTY_FUNCTION__); } while (0)
;
717 assert_se(capability_bounding_set == make_cap(CAP_NET_RAW))do { if ((__builtin_expect(!!(!(capability_bounding_set == make_cap
(13))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("capability_bounding_set == make_cap(CAP_NET_RAW)"
), "../src/test/test-unit-file.c", 717, __PRETTY_FUNCTION__);
} while (0)
;
718
719 r = config_parse_capability_set(NULL((void*)0), "fake", 1, "section", 1,
720 "CapabilityBoundingSet", 0, "",
721 &capability_bounding_set, NULL((void*)0));
722 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 722, __PRETTY_FUNCTION__); } while (0)
;
723 assert_se(capability_bounding_set == UINT64_C(0))do { if ((__builtin_expect(!!(!(capability_bounding_set == 0UL
)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("capability_bounding_set == UINT64_C(0)"
), "../src/test/test-unit-file.c", 723, __PRETTY_FUNCTION__);
} while (0)
;
724
725 r = config_parse_capability_set(NULL((void*)0), "fake", 1, "section", 1,
726 "CapabilityBoundingSet", 0, "~",
727 &capability_bounding_set, NULL((void*)0));
728 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 728, __PRETTY_FUNCTION__); } while (0)
;
729 assert_se(cap_test_all(capability_bounding_set))do { if ((__builtin_expect(!!(!(cap_test_all(capability_bounding_set
))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("cap_test_all(capability_bounding_set)"
), "../src/test/test-unit-file.c", 729, __PRETTY_FUNCTION__);
} while (0)
;
730
731 capability_bounding_set = 0;
732 r = config_parse_capability_set(NULL((void*)0), "fake", 1, "section", 1,
733 "CapabilityBoundingSet", 0, " 'CAP_NET_RAW' WAT_CAP??? CAP_NET_ADMIN CAP'_trailing_garbage",
734 &capability_bounding_set, NULL((void*)0));
735 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 735, __PRETTY_FUNCTION__); } while (0)
;
736 assert_se(capability_bounding_set == (make_cap(CAP_NET_RAW) | make_cap(CAP_NET_ADMIN)))do { if ((__builtin_expect(!!(!(capability_bounding_set == (make_cap
(13) | make_cap(12)))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("capability_bounding_set == (make_cap(CAP_NET_RAW) | make_cap(CAP_NET_ADMIN))"
), "../src/test/test-unit-file.c", 736, __PRETTY_FUNCTION__);
} while (0)
;
737}
738
739static void test_config_parse_rlimit(void) {
740 struct rlimit * rl[_RLIMIT_MAX(__RLIMIT_RTTIME+1 > __RLIMIT_NLIMITS ? __RLIMIT_RTTIME+1 :
__RLIMIT_NLIMITS)
] = {};
741
742 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitNOFILE", RLIMIT_NOFILE, "55", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitNOFILE", RLIMIT_NOFILE, "55"
, rl, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitNOFILE\", RLIMIT_NOFILE, \"55\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 742, __PRETTY_FUNCTION__);
} while (0)
;
743 assert_se(rl[RLIMIT_NOFILE])do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]"), "../src/test/test-unit-file.c"
, 743, __PRETTY_FUNCTION__); } while (0)
;
744 assert_se(rl[RLIMIT_NOFILE]->rlim_cur == 55)do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE]->rlim_cur
== 55)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]->rlim_cur == 55"
), "../src/test/test-unit-file.c", 744, __PRETTY_FUNCTION__);
} while (0)
;
745 assert_se(rl[RLIMIT_NOFILE]->rlim_cur == rl[RLIMIT_NOFILE]->rlim_max)do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE]->rlim_cur
== rl[RLIMIT_NOFILE]->rlim_max)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]->rlim_cur == rl[RLIMIT_NOFILE]->rlim_max"
), "../src/test/test-unit-file.c", 745, __PRETTY_FUNCTION__);
} while (0)
;
746
747 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitNOFILE", RLIMIT_NOFILE, "55:66", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitNOFILE", RLIMIT_NOFILE, "55:66"
, rl, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitNOFILE\", RLIMIT_NOFILE, \"55:66\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 747, __PRETTY_FUNCTION__);
} while (0)
;
748 assert_se(rl[RLIMIT_NOFILE])do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]"), "../src/test/test-unit-file.c"
, 748, __PRETTY_FUNCTION__); } while (0)
;
749 assert_se(rl[RLIMIT_NOFILE]->rlim_cur == 55)do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE]->rlim_cur
== 55)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]->rlim_cur == 55"
), "../src/test/test-unit-file.c", 749, __PRETTY_FUNCTION__);
} while (0)
;
750 assert_se(rl[RLIMIT_NOFILE]->rlim_max == 66)do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE]->rlim_max
== 66)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]->rlim_max == 66"
), "../src/test/test-unit-file.c", 750, __PRETTY_FUNCTION__);
} while (0)
;
751
752 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitNOFILE", RLIMIT_NOFILE, "infinity", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitNOFILE", RLIMIT_NOFILE, "infinity"
, rl, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitNOFILE\", RLIMIT_NOFILE, \"infinity\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 752, __PRETTY_FUNCTION__);
} while (0)
;
753 assert_se(rl[RLIMIT_NOFILE])do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]"), "../src/test/test-unit-file.c"
, 753, __PRETTY_FUNCTION__); } while (0)
;
754 assert_se(rl[RLIMIT_NOFILE]->rlim_cur == RLIM_INFINITY)do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE]->rlim_cur
== 0xffffffffffffffffuLL)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("rl[RLIMIT_NOFILE]->rlim_cur == RLIM_INFINITY"), "../src/test/test-unit-file.c"
, 754, __PRETTY_FUNCTION__); } while (0)
;
755 assert_se(rl[RLIMIT_NOFILE]->rlim_cur == rl[RLIMIT_NOFILE]->rlim_max)do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE]->rlim_cur
== rl[RLIMIT_NOFILE]->rlim_max)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]->rlim_cur == rl[RLIMIT_NOFILE]->rlim_max"
), "../src/test/test-unit-file.c", 755, __PRETTY_FUNCTION__);
} while (0)
;
756
757 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitNOFILE", RLIMIT_NOFILE, "infinity:infinity", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitNOFILE", RLIMIT_NOFILE, "infinity:infinity"
, rl, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitNOFILE\", RLIMIT_NOFILE, \"infinity:infinity\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 757, __PRETTY_FUNCTION__);
} while (0)
;
758 assert_se(rl[RLIMIT_NOFILE])do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]"), "../src/test/test-unit-file.c"
, 758, __PRETTY_FUNCTION__); } while (0)
;
759 assert_se(rl[RLIMIT_NOFILE]->rlim_cur == RLIM_INFINITY)do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE]->rlim_cur
== 0xffffffffffffffffuLL)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("rl[RLIMIT_NOFILE]->rlim_cur == RLIM_INFINITY"), "../src/test/test-unit-file.c"
, 759, __PRETTY_FUNCTION__); } while (0)
;
760 assert_se(rl[RLIMIT_NOFILE]->rlim_cur == rl[RLIMIT_NOFILE]->rlim_max)do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE]->rlim_cur
== rl[RLIMIT_NOFILE]->rlim_max)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]->rlim_cur == rl[RLIMIT_NOFILE]->rlim_max"
), "../src/test/test-unit-file.c", 760, __PRETTY_FUNCTION__);
} while (0)
;
761
762 rl[RLIMIT_NOFILERLIMIT_NOFILE]->rlim_cur = 10;
763 rl[RLIMIT_NOFILERLIMIT_NOFILE]->rlim_max = 20;
764
765 /* Invalid values don't change rl */
766 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitNOFILE", RLIMIT_NOFILE, "10:20:30", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitNOFILE", RLIMIT_NOFILE, "10:20:30"
, rl, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitNOFILE\", RLIMIT_NOFILE, \"10:20:30\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 766, __PRETTY_FUNCTION__);
} while (0)
;
767 assert_se(rl[RLIMIT_NOFILE])do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]"), "../src/test/test-unit-file.c"
, 767, __PRETTY_FUNCTION__); } while (0)
;
768 assert_se(rl[RLIMIT_NOFILE]->rlim_cur == 10)do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE]->rlim_cur
== 10)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]->rlim_cur == 10"
), "../src/test/test-unit-file.c", 768, __PRETTY_FUNCTION__);
} while (0)
;
769 assert_se(rl[RLIMIT_NOFILE]->rlim_max == 20)do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE]->rlim_max
== 20)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]->rlim_max == 20"
), "../src/test/test-unit-file.c", 769, __PRETTY_FUNCTION__);
} while (0)
;
770
771 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitNOFILE", RLIMIT_NOFILE, "wat:wat", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitNOFILE", RLIMIT_NOFILE, "wat:wat"
, rl, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitNOFILE\", RLIMIT_NOFILE, \"wat:wat\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 771, __PRETTY_FUNCTION__);
} while (0)
;
772 assert_se(rl[RLIMIT_NOFILE])do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]"), "../src/test/test-unit-file.c"
, 772, __PRETTY_FUNCTION__); } while (0)
;
773 assert_se(rl[RLIMIT_NOFILE]->rlim_cur == 10)do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE]->rlim_cur
== 10)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]->rlim_cur == 10"
), "../src/test/test-unit-file.c", 773, __PRETTY_FUNCTION__);
} while (0)
;
774 assert_se(rl[RLIMIT_NOFILE]->rlim_max == 20)do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE]->rlim_max
== 20)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]->rlim_max == 20"
), "../src/test/test-unit-file.c", 774, __PRETTY_FUNCTION__);
} while (0)
;
775
776 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitNOFILE", RLIMIT_NOFILE, "66:wat", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitNOFILE", RLIMIT_NOFILE, "66:wat"
, rl, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitNOFILE\", RLIMIT_NOFILE, \"66:wat\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 776, __PRETTY_FUNCTION__);
} while (0)
;
777 assert_se(rl[RLIMIT_NOFILE])do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]"), "../src/test/test-unit-file.c"
, 777, __PRETTY_FUNCTION__); } while (0)
;
778 assert_se(rl[RLIMIT_NOFILE]->rlim_cur == 10)do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE]->rlim_cur
== 10)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]->rlim_cur == 10"
), "../src/test/test-unit-file.c", 778, __PRETTY_FUNCTION__);
} while (0)
;
779 assert_se(rl[RLIMIT_NOFILE]->rlim_max == 20)do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE]->rlim_max
== 20)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]->rlim_max == 20"
), "../src/test/test-unit-file.c", 779, __PRETTY_FUNCTION__);
} while (0)
;
780
781 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitNOFILE", RLIMIT_NOFILE, "200:100", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitNOFILE", RLIMIT_NOFILE, "200:100"
, rl, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitNOFILE\", RLIMIT_NOFILE, \"200:100\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 781, __PRETTY_FUNCTION__);
} while (0)
;
782 assert_se(rl[RLIMIT_NOFILE])do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]"), "../src/test/test-unit-file.c"
, 782, __PRETTY_FUNCTION__); } while (0)
;
783 assert_se(rl[RLIMIT_NOFILE]->rlim_cur == 10)do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE]->rlim_cur
== 10)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]->rlim_cur == 10"
), "../src/test/test-unit-file.c", 783, __PRETTY_FUNCTION__);
} while (0)
;
784 assert_se(rl[RLIMIT_NOFILE]->rlim_max == 20)do { if ((__builtin_expect(!!(!(rl[RLIMIT_NOFILE]->rlim_max
== 20)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_NOFILE]->rlim_max == 20"
), "../src/test/test-unit-file.c", 784, __PRETTY_FUNCTION__);
} while (0)
;
785
786 rl[RLIMIT_NOFILERLIMIT_NOFILE] = mfree(rl[RLIMIT_NOFILERLIMIT_NOFILE]);
787
788 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitCPU", RLIMIT_CPU, "56", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitCPU", RLIMIT_CPU, "56", rl,
((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitCPU\", RLIMIT_CPU, \"56\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 788, __PRETTY_FUNCTION__);
} while (0)
;
789 assert_se(rl[RLIMIT_CPU])do { if ((__builtin_expect(!!(!(rl[RLIMIT_CPU])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_CPU]"), "../src/test/test-unit-file.c"
, 789, __PRETTY_FUNCTION__); } while (0)
;
790 assert_se(rl[RLIMIT_CPU]->rlim_cur == 56)do { if ((__builtin_expect(!!(!(rl[RLIMIT_CPU]->rlim_cur ==
56)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_CPU]->rlim_cur == 56"
), "../src/test/test-unit-file.c", 790, __PRETTY_FUNCTION__);
} while (0)
;
791 assert_se(rl[RLIMIT_CPU]->rlim_cur == rl[RLIMIT_CPU]->rlim_max)do { if ((__builtin_expect(!!(!(rl[RLIMIT_CPU]->rlim_cur ==
rl[RLIMIT_CPU]->rlim_max)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("rl[RLIMIT_CPU]->rlim_cur == rl[RLIMIT_CPU]->rlim_max"
), "../src/test/test-unit-file.c", 791, __PRETTY_FUNCTION__);
} while (0)
;
792
793 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitCPU", RLIMIT_CPU, "57s", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitCPU", RLIMIT_CPU, "57s", rl
, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitCPU\", RLIMIT_CPU, \"57s\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 793, __PRETTY_FUNCTION__);
} while (0)
;
794 assert_se(rl[RLIMIT_CPU])do { if ((__builtin_expect(!!(!(rl[RLIMIT_CPU])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_CPU]"), "../src/test/test-unit-file.c"
, 794, __PRETTY_FUNCTION__); } while (0)
;
795 assert_se(rl[RLIMIT_CPU]->rlim_cur == 57)do { if ((__builtin_expect(!!(!(rl[RLIMIT_CPU]->rlim_cur ==
57)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_CPU]->rlim_cur == 57"
), "../src/test/test-unit-file.c", 795, __PRETTY_FUNCTION__);
} while (0)
;
796 assert_se(rl[RLIMIT_CPU]->rlim_cur == rl[RLIMIT_CPU]->rlim_max)do { if ((__builtin_expect(!!(!(rl[RLIMIT_CPU]->rlim_cur ==
rl[RLIMIT_CPU]->rlim_max)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("rl[RLIMIT_CPU]->rlim_cur == rl[RLIMIT_CPU]->rlim_max"
), "../src/test/test-unit-file.c", 796, __PRETTY_FUNCTION__);
} while (0)
;
797
798 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitCPU", RLIMIT_CPU, "40s:1m", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitCPU", RLIMIT_CPU, "40s:1m",
rl, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitCPU\", RLIMIT_CPU, \"40s:1m\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 798, __PRETTY_FUNCTION__);
} while (0)
;
799 assert_se(rl[RLIMIT_CPU])do { if ((__builtin_expect(!!(!(rl[RLIMIT_CPU])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_CPU]"), "../src/test/test-unit-file.c"
, 799, __PRETTY_FUNCTION__); } while (0)
;
800 assert_se(rl[RLIMIT_CPU]->rlim_cur == 40)do { if ((__builtin_expect(!!(!(rl[RLIMIT_CPU]->rlim_cur ==
40)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_CPU]->rlim_cur == 40"
), "../src/test/test-unit-file.c", 800, __PRETTY_FUNCTION__);
} while (0)
;
801 assert_se(rl[RLIMIT_CPU]->rlim_max == 60)do { if ((__builtin_expect(!!(!(rl[RLIMIT_CPU]->rlim_max ==
60)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_CPU]->rlim_max == 60"
), "../src/test/test-unit-file.c", 801, __PRETTY_FUNCTION__);
} while (0)
;
802
803 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitCPU", RLIMIT_CPU, "infinity", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitCPU", RLIMIT_CPU, "infinity"
, rl, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitCPU\", RLIMIT_CPU, \"infinity\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 803, __PRETTY_FUNCTION__);
} while (0)
;
804 assert_se(rl[RLIMIT_CPU])do { if ((__builtin_expect(!!(!(rl[RLIMIT_CPU])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_CPU]"), "../src/test/test-unit-file.c"
, 804, __PRETTY_FUNCTION__); } while (0)
;
805 assert_se(rl[RLIMIT_CPU]->rlim_cur == RLIM_INFINITY)do { if ((__builtin_expect(!!(!(rl[RLIMIT_CPU]->rlim_cur ==
0xffffffffffffffffuLL)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("rl[RLIMIT_CPU]->rlim_cur == RLIM_INFINITY"), "../src/test/test-unit-file.c"
, 805, __PRETTY_FUNCTION__); } while (0)
;
806 assert_se(rl[RLIMIT_CPU]->rlim_cur == rl[RLIMIT_CPU]->rlim_max)do { if ((__builtin_expect(!!(!(rl[RLIMIT_CPU]->rlim_cur ==
rl[RLIMIT_CPU]->rlim_max)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("rl[RLIMIT_CPU]->rlim_cur == rl[RLIMIT_CPU]->rlim_max"
), "../src/test/test-unit-file.c", 806, __PRETTY_FUNCTION__);
} while (0)
;
807
808 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitCPU", RLIMIT_CPU, "1234ms", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitCPU", RLIMIT_CPU, "1234ms",
rl, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitCPU\", RLIMIT_CPU, \"1234ms\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 808, __PRETTY_FUNCTION__);
} while (0)
;
809 assert_se(rl[RLIMIT_CPU])do { if ((__builtin_expect(!!(!(rl[RLIMIT_CPU])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_CPU]"), "../src/test/test-unit-file.c"
, 809, __PRETTY_FUNCTION__); } while (0)
;
810 assert_se(rl[RLIMIT_CPU]->rlim_cur == 2)do { if ((__builtin_expect(!!(!(rl[RLIMIT_CPU]->rlim_cur ==
2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_CPU]->rlim_cur == 2"
), "../src/test/test-unit-file.c", 810, __PRETTY_FUNCTION__);
} while (0)
;
811 assert_se(rl[RLIMIT_CPU]->rlim_cur == rl[RLIMIT_CPU]->rlim_max)do { if ((__builtin_expect(!!(!(rl[RLIMIT_CPU]->rlim_cur ==
rl[RLIMIT_CPU]->rlim_max)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("rl[RLIMIT_CPU]->rlim_cur == rl[RLIMIT_CPU]->rlim_max"
), "../src/test/test-unit-file.c", 811, __PRETTY_FUNCTION__);
} while (0)
;
812
813 rl[RLIMIT_CPURLIMIT_CPU] = mfree(rl[RLIMIT_CPURLIMIT_CPU]);
814
815 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitRTTIME", RLIMIT_RTTIME, "58", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitRTTIME", __RLIMIT_RTTIME, "58"
, rl, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitRTTIME\", RLIMIT_RTTIME, \"58\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 815, __PRETTY_FUNCTION__);
} while (0)
;
816 assert_se(rl[RLIMIT_RTTIME])do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]"), "../src/test/test-unit-file.c"
, 816, __PRETTY_FUNCTION__); } while (0)
;
817 assert_se(rl[RLIMIT_RTTIME]->rlim_cur == 58)do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME]->rlim_cur
== 58)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]->rlim_cur == 58"
), "../src/test/test-unit-file.c", 817, __PRETTY_FUNCTION__);
} while (0)
;
818 assert_se(rl[RLIMIT_RTTIME]->rlim_cur == rl[RLIMIT_RTTIME]->rlim_max)do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME]->rlim_cur
== rl[__RLIMIT_RTTIME]->rlim_max)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]->rlim_cur == rl[RLIMIT_RTTIME]->rlim_max"
), "../src/test/test-unit-file.c", 818, __PRETTY_FUNCTION__);
} while (0)
;
819
820 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitRTTIME", RLIMIT_RTTIME, "58:60", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitRTTIME", __RLIMIT_RTTIME, "58:60"
, rl, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitRTTIME\", RLIMIT_RTTIME, \"58:60\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 820, __PRETTY_FUNCTION__);
} while (0)
;
821 assert_se(rl[RLIMIT_RTTIME])do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]"), "../src/test/test-unit-file.c"
, 821, __PRETTY_FUNCTION__); } while (0)
;
822 assert_se(rl[RLIMIT_RTTIME]->rlim_cur == 58)do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME]->rlim_cur
== 58)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]->rlim_cur == 58"
), "../src/test/test-unit-file.c", 822, __PRETTY_FUNCTION__);
} while (0)
;
823 assert_se(rl[RLIMIT_RTTIME]->rlim_max == 60)do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME]->rlim_max
== 60)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]->rlim_max == 60"
), "../src/test/test-unit-file.c", 823, __PRETTY_FUNCTION__);
} while (0)
;
824
825 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitRTTIME", RLIMIT_RTTIME, "59s", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitRTTIME", __RLIMIT_RTTIME, "59s"
, rl, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitRTTIME\", RLIMIT_RTTIME, \"59s\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 825, __PRETTY_FUNCTION__);
} while (0)
;
826 assert_se(rl[RLIMIT_RTTIME])do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]"), "../src/test/test-unit-file.c"
, 826, __PRETTY_FUNCTION__); } while (0)
;
827 assert_se(rl[RLIMIT_RTTIME]->rlim_cur == 59 * USEC_PER_SEC)do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME]->rlim_cur
== 59 * ((usec_t) 1000000ULL))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]->rlim_cur == 59 * USEC_PER_SEC"
), "../src/test/test-unit-file.c", 827, __PRETTY_FUNCTION__);
} while (0)
;
828 assert_se(rl[RLIMIT_RTTIME]->rlim_cur == rl[RLIMIT_RTTIME]->rlim_max)do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME]->rlim_cur
== rl[__RLIMIT_RTTIME]->rlim_max)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]->rlim_cur == rl[RLIMIT_RTTIME]->rlim_max"
), "../src/test/test-unit-file.c", 828, __PRETTY_FUNCTION__);
} while (0)
;
829
830 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitRTTIME", RLIMIT_RTTIME, "59s:123s", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitRTTIME", __RLIMIT_RTTIME, "59s:123s"
, rl, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitRTTIME\", RLIMIT_RTTIME, \"59s:123s\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 830, __PRETTY_FUNCTION__);
} while (0)
;
831 assert_se(rl[RLIMIT_RTTIME])do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]"), "../src/test/test-unit-file.c"
, 831, __PRETTY_FUNCTION__); } while (0)
;
832 assert_se(rl[RLIMIT_RTTIME]->rlim_cur == 59 * USEC_PER_SEC)do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME]->rlim_cur
== 59 * ((usec_t) 1000000ULL))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]->rlim_cur == 59 * USEC_PER_SEC"
), "../src/test/test-unit-file.c", 832, __PRETTY_FUNCTION__);
} while (0)
;
833 assert_se(rl[RLIMIT_RTTIME]->rlim_max == 123 * USEC_PER_SEC)do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME]->rlim_max
== 123 * ((usec_t) 1000000ULL))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]->rlim_max == 123 * USEC_PER_SEC"
), "../src/test/test-unit-file.c", 833, __PRETTY_FUNCTION__);
} while (0)
;
834
835 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitRTTIME", RLIMIT_RTTIME, "infinity", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitRTTIME", __RLIMIT_RTTIME, "infinity"
, rl, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitRTTIME\", RLIMIT_RTTIME, \"infinity\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 835, __PRETTY_FUNCTION__);
} while (0)
;
836 assert_se(rl[RLIMIT_RTTIME])do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]"), "../src/test/test-unit-file.c"
, 836, __PRETTY_FUNCTION__); } while (0)
;
837 assert_se(rl[RLIMIT_RTTIME]->rlim_cur == RLIM_INFINITY)do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME]->rlim_cur
== 0xffffffffffffffffuLL)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("rl[RLIMIT_RTTIME]->rlim_cur == RLIM_INFINITY"), "../src/test/test-unit-file.c"
, 837, __PRETTY_FUNCTION__); } while (0)
;
838 assert_se(rl[RLIMIT_RTTIME]->rlim_cur == rl[RLIMIT_RTTIME]->rlim_max)do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME]->rlim_cur
== rl[__RLIMIT_RTTIME]->rlim_max)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]->rlim_cur == rl[RLIMIT_RTTIME]->rlim_max"
), "../src/test/test-unit-file.c", 838, __PRETTY_FUNCTION__);
} while (0)
;
839
840 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitRTTIME", RLIMIT_RTTIME, "infinity:infinity", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitRTTIME", __RLIMIT_RTTIME, "infinity:infinity"
, rl, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitRTTIME\", RLIMIT_RTTIME, \"infinity:infinity\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 840, __PRETTY_FUNCTION__);
} while (0)
;
841 assert_se(rl[RLIMIT_RTTIME])do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]"), "../src/test/test-unit-file.c"
, 841, __PRETTY_FUNCTION__); } while (0)
;
842 assert_se(rl[RLIMIT_RTTIME]->rlim_cur == RLIM_INFINITY)do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME]->rlim_cur
== 0xffffffffffffffffuLL)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("rl[RLIMIT_RTTIME]->rlim_cur == RLIM_INFINITY"), "../src/test/test-unit-file.c"
, 842, __PRETTY_FUNCTION__); } while (0)
;
843 assert_se(rl[RLIMIT_RTTIME]->rlim_cur == rl[RLIMIT_RTTIME]->rlim_max)do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME]->rlim_cur
== rl[__RLIMIT_RTTIME]->rlim_max)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]->rlim_cur == rl[RLIMIT_RTTIME]->rlim_max"
), "../src/test/test-unit-file.c", 843, __PRETTY_FUNCTION__);
} while (0)
;
844
845 assert_se(config_parse_rlimit(NULL, "fake", 1, "section", 1, "LimitRTTIME", RLIMIT_RTTIME, "2345ms", rl, NULL) >= 0)do { if ((__builtin_expect(!!(!(config_parse_rlimit(((void*)0
), "fake", 1, "section", 1, "LimitRTTIME", __RLIMIT_RTTIME, "2345ms"
, rl, ((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("config_parse_rlimit(NULL, \"fake\", 1, \"section\", 1, \"LimitRTTIME\", RLIMIT_RTTIME, \"2345ms\", rl, NULL) >= 0"
), "../src/test/test-unit-file.c", 845, __PRETTY_FUNCTION__);
} while (0)
;
846 assert_se(rl[RLIMIT_RTTIME])do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME])),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]"), "../src/test/test-unit-file.c"
, 846, __PRETTY_FUNCTION__); } while (0)
;
847 assert_se(rl[RLIMIT_RTTIME]->rlim_cur == 2345 * USEC_PER_MSEC)do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME]->rlim_cur
== 2345 * ((usec_t) 1000ULL))),0))) log_assert_failed_realm(
LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]->rlim_cur == 2345 * USEC_PER_MSEC"
), "../src/test/test-unit-file.c", 847, __PRETTY_FUNCTION__);
} while (0)
;
848 assert_se(rl[RLIMIT_RTTIME]->rlim_cur == rl[RLIMIT_RTTIME]->rlim_max)do { if ((__builtin_expect(!!(!(rl[__RLIMIT_RTTIME]->rlim_cur
== rl[__RLIMIT_RTTIME]->rlim_max)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rl[RLIMIT_RTTIME]->rlim_cur == rl[RLIMIT_RTTIME]->rlim_max"
), "../src/test/test-unit-file.c", 848, __PRETTY_FUNCTION__);
} while (0)
;
849
850 rl[RLIMIT_RTTIME__RLIMIT_RTTIME] = mfree(rl[RLIMIT_RTTIME__RLIMIT_RTTIME]);
851}
852
853static void test_config_parse_pass_environ(void) {
854 /* int config_parse_pass_environ(
855 const char *unit,
856 const char *filename,
857 unsigned line,
858 const char *section,
859 unsigned section_line,
860 const char *lvalue,
861 int ltype,
862 const char *rvalue,
863 void *data,
864 void *userdata) */
865 int r;
866 _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **passenv = NULL((void*)0);
867
868 r = config_parse_pass_environ(NULL((void*)0), "fake", 1, "section", 1,
869 "PassEnvironment", 0, "A B",
870 &passenv, NULL((void*)0));
871 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 871, __PRETTY_FUNCTION__); } while (0)
;
872 assert_se(strv_length(passenv) == 2)do { if ((__builtin_expect(!!(!(strv_length(passenv) == 2)),0
))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("strv_length(passenv) == 2"
), "../src/test/test-unit-file.c", 872, __PRETTY_FUNCTION__);
} while (0)
;
873 assert_se(streq(passenv[0], "A"))do { if ((__builtin_expect(!!(!((strcmp((passenv[0]),("A")) ==
0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(passenv[0], \"A\")"
), "../src/test/test-unit-file.c", 873, __PRETTY_FUNCTION__);
} while (0)
;
874 assert_se(streq(passenv[1], "B"))do { if ((__builtin_expect(!!(!((strcmp((passenv[1]),("B")) ==
0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(passenv[1], \"B\")"
), "../src/test/test-unit-file.c", 874, __PRETTY_FUNCTION__);
} while (0)
;
875
876 r = config_parse_pass_environ(NULL((void*)0), "fake", 1, "section", 1,
877 "PassEnvironment", 0, "",
878 &passenv, NULL((void*)0));
879 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 879, __PRETTY_FUNCTION__); } while (0)
;
880 assert_se(strv_isempty(passenv))do { if ((__builtin_expect(!!(!(strv_isempty(passenv))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("strv_isempty(passenv)"), "../src/test/test-unit-file.c"
, 880, __PRETTY_FUNCTION__); } while (0)
;
881
882 r = config_parse_pass_environ(NULL((void*)0), "fake", 1, "section", 1,
883 "PassEnvironment", 0, "'invalid name' 'normal_name' A=1 \\",
884 &passenv, NULL((void*)0));
885 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/test/test-unit-file.c"
, 885, __PRETTY_FUNCTION__); } while (0)
;
886 assert_se(strv_length(passenv) == 1)do { if ((__builtin_expect(!!(!(strv_length(passenv) == 1)),0
))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("strv_length(passenv) == 1"
), "../src/test/test-unit-file.c", 886, __PRETTY_FUNCTION__);
} while (0)
;
887 assert_se(streq(passenv[0], "normal_name"))do { if ((__builtin_expect(!!(!((strcmp((passenv[0]),("normal_name"
)) == 0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(passenv[0], \"normal_name\")"
), "../src/test/test-unit-file.c", 887, __PRETTY_FUNCTION__);
} while (0)
;
888
889}
890
891static void test_unit_dump_config_items(void) {
892 unit_dump_config_items(stdoutstdout);
893}
894
895int main(int argc, char *argv[]) {
896 _cleanup_(rm_rf_physical_and_freep)__attribute__((cleanup(rm_rf_physical_and_freep))) char *runtime_dir = NULL((void*)0);
897 int r;
898
899 log_parse_environment()log_parse_environment_realm(LOG_REALM_SYSTEMD);
900 log_open();
901
902 r = enter_cgroup_subroot();
903 if (r == -ENOMEDIUM123) {
904 log_notice_errno(r, "Skipping test: cgroupfs not available")({ int _level = ((5)), _e = ((r)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/test/test-unit-file.c", 904, __func__, "Skipping test: cgroupfs not available"
) : -abs(_e); })
;
905 return EXIT_TEST_SKIP77;
906 }
907
908 assert_se(runtime_dir = setup_fake_runtime_dir())do { if ((__builtin_expect(!!(!(runtime_dir = setup_fake_runtime_dir
())),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("runtime_dir = setup_fake_runtime_dir()"
), "../src/test/test-unit-file.c", 908, __PRETTY_FUNCTION__);
} while (0)
;
909
910 r = test_unit_file_get_set();
911 test_config_parse_exec();
912 test_config_parse_log_extra_fields();
913 test_config_parse_capability_set();
914 test_config_parse_rlimit();
915 test_config_parse_pass_environ();
916 test_load_env_file_1();
917 test_load_env_file_2();
918 test_load_env_file_3();
919 test_load_env_file_4();
920 test_load_env_file_5();
921 TEST_REQ_RUNNING_SYSTEMD(test_install_printf())if (sd_booted() > 0) { test_install_printf(); } else { printf
("systemd not booted skipping '%s'\n", "test_install_printf()"
); }
;
922 test_unit_dump_config_items();
923
924 return r;
925}