]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/test-condition.c
Merge pull request #7675 from shawnl/unaligned
[thirdparty/systemd.git] / src / test / test-condition.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 /***
3 This file is part of systemd
4
5 Copyright 2014 Ronny Chevalier
6
7 systemd is free software; you can redistribute it and/or modify it
8 under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation; either version 2.1 of the License, or
10 (at your option) any later version.
11
12 systemd is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with systemd; If not, see <http://www.gnu.org/licenses/>.
19 ***/
20
21 #include <stdio.h>
22 #include <sys/types.h>
23 #include <sys/utsname.h>
24 #include <unistd.h>
25
26 #include "sd-id128.h"
27
28 #include "alloc-util.h"
29 #include "apparmor-util.h"
30 #include "architecture.h"
31 #include "audit-util.h"
32 #include "cgroup-util.h"
33 #include "condition.h"
34 #include "hostname-util.h"
35 #include "id128-util.h"
36 #include "ima-util.h"
37 #include "log.h"
38 #include "macro.h"
39 #include "selinux-util.h"
40 #include "set.h"
41 #include "smack-util.h"
42 #include "string-util.h"
43 #include "strv.h"
44 #include "user-util.h"
45 #include "util.h"
46 #include "virt.h"
47
48 static void test_condition_test_path(void) {
49 Condition *condition;
50
51 condition = condition_new(CONDITION_PATH_EXISTS, "/bin/sh", false, false);
52 assert_se(condition);
53 assert_se(condition_test(condition));
54 condition_free(condition);
55
56 condition = condition_new(CONDITION_PATH_EXISTS, "/bin/s?", false, false);
57 assert_se(condition);
58 assert_se(!condition_test(condition));
59 condition_free(condition);
60
61 condition = condition_new(CONDITION_PATH_EXISTS_GLOB, "/bin/s?", false, false);
62 assert_se(condition);
63 assert_se(condition_test(condition));
64 condition_free(condition);
65
66 condition = condition_new(CONDITION_PATH_EXISTS_GLOB, "/bin/s?", false, true);
67 assert_se(condition);
68 assert_se(!condition_test(condition));
69 condition_free(condition);
70
71 condition = condition_new(CONDITION_PATH_EXISTS, "/thiscertainlywontexist", false, false);
72 assert_se(condition);
73 assert_se(!condition_test(condition));
74 condition_free(condition);
75
76 condition = condition_new(CONDITION_PATH_EXISTS, "/thiscertainlywontexist", false, true);
77 assert_se(condition);
78 assert_se(condition_test(condition));
79 condition_free(condition);
80
81 condition = condition_new(CONDITION_PATH_IS_DIRECTORY, "/bin", false, false);
82 assert_se(condition);
83 assert_se(condition_test(condition));
84 condition_free(condition);
85
86 condition = condition_new(CONDITION_DIRECTORY_NOT_EMPTY, "/bin", false, false);
87 assert_se(condition);
88 assert_se(condition_test(condition));
89 condition_free(condition);
90
91 condition = condition_new(CONDITION_FILE_NOT_EMPTY, "/bin/sh", false, false);
92 assert_se(condition);
93 assert_se(condition_test(condition));
94 condition_free(condition);
95
96 condition = condition_new(CONDITION_FILE_IS_EXECUTABLE, "/bin/sh", false, false);
97 assert_se(condition);
98 assert_se(condition_test(condition));
99 condition_free(condition);
100
101 condition = condition_new(CONDITION_FILE_IS_EXECUTABLE, "/etc/passwd", false, false);
102 assert_se(condition);
103 assert_se(!condition_test(condition));
104 condition_free(condition);
105
106 condition = condition_new(CONDITION_PATH_IS_MOUNT_POINT, "/proc", false, false);
107 assert_se(condition);
108 assert_se(condition_test(condition));
109 condition_free(condition);
110
111 condition = condition_new(CONDITION_PATH_IS_MOUNT_POINT, "/", false, false);
112 assert_se(condition);
113 assert_se(condition_test(condition));
114 condition_free(condition);
115
116 condition = condition_new(CONDITION_PATH_IS_MOUNT_POINT, "/bin", false, false);
117 assert_se(condition);
118 assert_se(!condition_test(condition));
119 condition_free(condition);
120
121 condition = condition_new(CONDITION_PATH_IS_READ_WRITE, "/tmp", false, false);
122 assert_se(condition);
123 assert_se(condition_test(condition));
124 condition_free(condition);
125
126 condition = condition_new(CONDITION_PATH_IS_SYMBOLIC_LINK, "/dev/stdout", false, false);
127 assert_se(condition);
128 assert_se(condition_test(condition));
129 condition_free(condition);
130 }
131
132 static int test_condition_test_control_group_controller(void) {
133 Condition *condition;
134 CGroupMask system_mask;
135 CGroupController controller;
136 _cleanup_free_ char *controller_name = NULL;
137 int r;
138
139 r = cg_unified_flush();
140 if (r < 0) {
141 log_notice_errno(r, "Skipping ConditionControlGroupController tests: %m");
142 return EXIT_TEST_SKIP;
143 }
144
145 /* Invalid controllers are ignored */
146 condition = condition_new(CONDITION_CONTROL_GROUP_CONTROLLER, "thisisnotarealcontroller", false, false);
147 assert_se(condition);
148 assert_se(condition_test(condition));
149 condition_free(condition);
150
151 condition = condition_new(CONDITION_CONTROL_GROUP_CONTROLLER, "thisisnotarealcontroller", false, true);
152 assert_se(condition);
153 assert_se(!condition_test(condition));
154 condition_free(condition);
155
156 assert_se(cg_mask_supported(&system_mask) >= 0);
157
158 /* Individual valid controllers one by one */
159 for (controller = 0; controller < _CGROUP_CONTROLLER_MAX; controller++) {
160 const char *local_controller_name = cgroup_controller_to_string(controller);
161 log_info("chosen controller is '%s'", local_controller_name);
162 if (system_mask & CGROUP_CONTROLLER_TO_MASK(controller)) {
163 log_info("this controller is available");
164 condition = condition_new(CONDITION_CONTROL_GROUP_CONTROLLER, local_controller_name, false, false);
165 assert_se(condition);
166 assert_se(condition_test(condition));
167 condition_free(condition);
168
169 condition = condition_new(CONDITION_CONTROL_GROUP_CONTROLLER, local_controller_name, false, true);
170 assert_se(condition);
171 assert_se(!condition_test(condition));
172 condition_free(condition);
173 } else {
174 log_info("this controller is unavailable");
175 condition = condition_new(CONDITION_CONTROL_GROUP_CONTROLLER, local_controller_name, false, false);
176 assert_se(condition);
177 assert_se(!condition_test(condition));
178 condition_free(condition);
179
180 condition = condition_new(CONDITION_CONTROL_GROUP_CONTROLLER, local_controller_name, false, true);
181 assert_se(condition);
182 assert_se(condition_test(condition));
183 condition_free(condition);
184 }
185 }
186
187 /* Multiple valid controllers at the same time */
188 assert_se(cg_mask_to_string(system_mask, &controller_name) >= 0);
189
190 condition = condition_new(CONDITION_CONTROL_GROUP_CONTROLLER, strempty(controller_name), false, false);
191 assert_se(condition);
192 assert_se(condition_test(condition));
193 condition_free(condition);
194
195 condition = condition_new(CONDITION_CONTROL_GROUP_CONTROLLER, strempty(controller_name), false, true);
196 assert_se(condition);
197 assert_se(!condition_test(condition));
198 condition_free(condition);
199
200 return EXIT_SUCCESS;
201 }
202
203 static void test_condition_test_ac_power(void) {
204 Condition *condition;
205
206 condition = condition_new(CONDITION_AC_POWER, "true", false, false);
207 assert_se(condition);
208 assert_se(condition_test(condition) == on_ac_power());
209 condition_free(condition);
210
211 condition = condition_new(CONDITION_AC_POWER, "false", false, false);
212 assert_se(condition);
213 assert_se(condition_test(condition) != on_ac_power());
214 condition_free(condition);
215
216 condition = condition_new(CONDITION_AC_POWER, "false", false, true);
217 assert_se(condition);
218 assert_se(condition_test(condition) == on_ac_power());
219 condition_free(condition);
220 }
221
222 static void test_condition_test_host(void) {
223 _cleanup_free_ char *hostname = NULL;
224 char sid[SD_ID128_STRING_MAX];
225 Condition *condition;
226 sd_id128_t id;
227 int r;
228
229 r = sd_id128_get_machine(&id);
230 assert_se(r >= 0);
231 assert_se(sd_id128_to_string(id, sid));
232
233 condition = condition_new(CONDITION_HOST, sid, false, false);
234 assert_se(condition);
235 assert_se(condition_test(condition));
236 condition_free(condition);
237
238 condition = condition_new(CONDITION_HOST, "garbage value jjjjjjjjjjjjjj", false, false);
239 assert_se(condition);
240 assert_se(!condition_test(condition));
241 condition_free(condition);
242
243 condition = condition_new(CONDITION_HOST, sid, false, true);
244 assert_se(condition);
245 assert_se(!condition_test(condition));
246 condition_free(condition);
247
248 hostname = gethostname_malloc();
249 assert_se(hostname);
250
251 /* if hostname looks like an id128 then skip testing it */
252 if (id128_is_valid(hostname))
253 log_notice("hostname is an id128, skipping test");
254 else {
255 condition = condition_new(CONDITION_HOST, hostname, false, false);
256 assert_se(condition);
257 assert_se(condition_test(condition));
258 condition_free(condition);
259 }
260 }
261
262 static void test_condition_test_architecture(void) {
263 Condition *condition;
264 const char *sa;
265 int a;
266
267 a = uname_architecture();
268 assert_se(a >= 0);
269
270 sa = architecture_to_string(a);
271 assert_se(sa);
272
273 condition = condition_new(CONDITION_ARCHITECTURE, sa, false, false);
274 assert_se(condition);
275 assert_se(condition_test(condition) > 0);
276 condition_free(condition);
277
278 condition = condition_new(CONDITION_ARCHITECTURE, "garbage value", false, false);
279 assert_se(condition);
280 assert_se(condition_test(condition) == 0);
281 condition_free(condition);
282
283 condition = condition_new(CONDITION_ARCHITECTURE, sa, false, true);
284 assert_se(condition);
285 assert_se(condition_test(condition) == 0);
286 condition_free(condition);
287 }
288
289 static void test_condition_test_kernel_command_line(void) {
290 Condition *condition;
291
292 condition = condition_new(CONDITION_KERNEL_COMMAND_LINE, "thisreallyshouldntbeonthekernelcommandline", false, false);
293 assert_se(condition);
294 assert_se(!condition_test(condition));
295 condition_free(condition);
296
297 condition = condition_new(CONDITION_KERNEL_COMMAND_LINE, "andthis=neither", false, false);
298 assert_se(condition);
299 assert_se(!condition_test(condition));
300 condition_free(condition);
301 }
302
303 static void test_condition_test_kernel_version(void) {
304 Condition *condition;
305 struct utsname u;
306 const char *v;
307
308 condition = condition_new(CONDITION_KERNEL_VERSION, "*thisreallyshouldntbeinthekernelversion*", false, false);
309 assert_se(condition);
310 assert_se(!condition_test(condition));
311 condition_free(condition);
312
313 condition = condition_new(CONDITION_KERNEL_VERSION, "*", false, false);
314 assert_se(condition);
315 assert_se(condition_test(condition));
316 condition_free(condition);
317
318 condition = condition_new(CONDITION_KERNEL_VERSION, "", false, false);
319 assert_se(condition);
320 assert_se(!condition_test(condition));
321 condition_free(condition);
322
323 assert_se(uname(&u) >= 0);
324
325 condition = condition_new(CONDITION_KERNEL_VERSION, u.release, false, false);
326 assert_se(condition);
327 assert_se(condition_test(condition));
328 condition_free(condition);
329
330 strshorten(u.release, 4);
331 strcpy(strchr(u.release, 0), "*");
332
333 condition = condition_new(CONDITION_KERNEL_VERSION, u.release, false, false);
334 assert_se(condition);
335 assert_se(condition_test(condition));
336 condition_free(condition);
337
338 /* 0.1.2 would be a very very very old kernel */
339 condition = condition_new(CONDITION_KERNEL_VERSION, "> 0.1.2", false, false);
340 assert_se(condition);
341 assert_se(condition_test(condition));
342 condition_free(condition);
343
344 condition = condition_new(CONDITION_KERNEL_VERSION, ">= 0.1.2", false, false);
345 assert_se(condition);
346 assert_se(condition_test(condition));
347 condition_free(condition);
348
349 condition = condition_new(CONDITION_KERNEL_VERSION, "< 0.1.2", false, false);
350 assert_se(condition);
351 assert_se(!condition_test(condition));
352 condition_free(condition);
353
354 condition = condition_new(CONDITION_KERNEL_VERSION, "<= 0.1.2", false, false);
355 assert_se(condition);
356 assert_se(!condition_test(condition));
357 condition_free(condition);
358
359 condition = condition_new(CONDITION_KERNEL_VERSION, "= 0.1.2", false, false);
360 assert_se(condition);
361 assert_se(!condition_test(condition));
362 condition_free(condition);
363
364 /* 4711.8.15 is a very very very future kernel */
365 condition = condition_new(CONDITION_KERNEL_VERSION, "< 4711.8.15", false, false);
366 assert_se(condition);
367 assert_se(condition_test(condition));
368 condition_free(condition);
369
370 condition = condition_new(CONDITION_KERNEL_VERSION, "<= 4711.8.15", false, false);
371 assert_se(condition);
372 assert_se(condition_test(condition));
373 condition_free(condition);
374
375 condition = condition_new(CONDITION_KERNEL_VERSION, "= 4711.8.15", false, false);
376 assert_se(condition);
377 assert_se(!condition_test(condition));
378 condition_free(condition);
379
380 condition = condition_new(CONDITION_KERNEL_VERSION, "> 4711.8.15", false, false);
381 assert_se(condition);
382 assert_se(!condition_test(condition));
383 condition_free(condition);
384
385 condition = condition_new(CONDITION_KERNEL_VERSION, ">= 4711.8.15", false, false);
386 assert_se(condition);
387 assert_se(!condition_test(condition));
388 condition_free(condition);
389
390 assert_se(uname(&u) >= 0);
391
392 v = strjoina(">=", u.release);
393 condition = condition_new(CONDITION_KERNEL_VERSION, v, false, false);
394 assert_se(condition);
395 assert_se(condition_test(condition));
396 condition_free(condition);
397
398 v = strjoina("= ", u.release);
399 condition = condition_new(CONDITION_KERNEL_VERSION, v, false, false);
400 assert_se(condition);
401 assert_se(condition_test(condition));
402 condition_free(condition);
403
404 v = strjoina("<=", u.release);
405 condition = condition_new(CONDITION_KERNEL_VERSION, v, false, false);
406 assert_se(condition);
407 assert_se(condition_test(condition));
408 condition_free(condition);
409
410 v = strjoina("> ", u.release);
411 condition = condition_new(CONDITION_KERNEL_VERSION, v, false, false);
412 assert_se(condition);
413 assert_se(!condition_test(condition));
414 condition_free(condition);
415
416 v = strjoina("< ", u.release);
417 condition = condition_new(CONDITION_KERNEL_VERSION, v, false, false);
418 assert_se(condition);
419 assert_se(!condition_test(condition));
420 condition_free(condition);
421 }
422
423 static void test_condition_test_null(void) {
424 Condition *condition;
425
426 condition = condition_new(CONDITION_NULL, NULL, false, false);
427 assert_se(condition);
428 assert_se(condition_test(condition));
429 condition_free(condition);
430
431 condition = condition_new(CONDITION_NULL, NULL, false, true);
432 assert_se(condition);
433 assert_se(!condition_test(condition));
434 condition_free(condition);
435 }
436
437 static void test_condition_test_security(void) {
438 Condition *condition;
439
440 condition = condition_new(CONDITION_SECURITY, "garbage oifdsjfoidsjoj", false, false);
441 assert_se(condition);
442 assert_se(!condition_test(condition));
443 condition_free(condition);
444
445 condition = condition_new(CONDITION_SECURITY, "selinux", false, true);
446 assert_se(condition);
447 assert_se(condition_test(condition) != mac_selinux_use());
448 condition_free(condition);
449
450 condition = condition_new(CONDITION_SECURITY, "ima", false, false);
451 assert_se(condition);
452 assert_se(condition_test(condition) == use_ima());
453 condition_free(condition);
454
455 condition = condition_new(CONDITION_SECURITY, "apparmor", false, false);
456 assert_se(condition);
457 assert_se(condition_test(condition) == mac_apparmor_use());
458 condition_free(condition);
459
460 condition = condition_new(CONDITION_SECURITY, "smack", false, false);
461 assert_se(condition);
462 assert_se(condition_test(condition) == mac_smack_use());
463 condition_free(condition);
464
465 condition = condition_new(CONDITION_SECURITY, "audit", false, false);
466 assert_se(condition);
467 assert_se(condition_test(condition) == use_audit());
468 condition_free(condition);
469 }
470
471 static void test_condition_test_virtualization(void) {
472 Condition *condition;
473 const char *virt;
474 int r;
475
476 condition = condition_new(CONDITION_VIRTUALIZATION, "garbage oifdsjfoidsjoj", false, false);
477 assert_se(condition);
478 r = condition_test(condition);
479 log_info("ConditionVirtualization=garbage → %i", r);
480 assert_se(r == 0);
481 condition_free(condition);
482
483 condition = condition_new(CONDITION_VIRTUALIZATION, "container", false, false);
484 assert_se(condition);
485 r = condition_test(condition);
486 log_info("ConditionVirtualization=container → %i", r);
487 assert_se(r == !!detect_container());
488 condition_free(condition);
489
490 condition = condition_new(CONDITION_VIRTUALIZATION, "vm", false, false);
491 assert_se(condition);
492 r = condition_test(condition);
493 log_info("ConditionVirtualization=vm → %i", r);
494 assert_se(r == (detect_vm() && !detect_container()));
495 condition_free(condition);
496
497 condition = condition_new(CONDITION_VIRTUALIZATION, "private-users", false, false);
498 assert_se(condition);
499 r = condition_test(condition);
500 log_info("ConditionVirtualization=private-users → %i", r);
501 assert_se(r == !!running_in_userns());
502 condition_free(condition);
503
504 NULSTR_FOREACH(virt,
505 "kvm\0"
506 "qemu\0"
507 "bochs\0"
508 "xen\0"
509 "uml\0"
510 "vmware\0"
511 "oracle\0"
512 "microsoft\0"
513 "zvm\0"
514 "parallels\0"
515 "bhyve\0"
516 "vm_other\0") {
517
518 condition = condition_new(CONDITION_VIRTUALIZATION, virt, false, false);
519 assert_se(condition);
520 r = condition_test(condition);
521 log_info("ConditionVirtualization=%s → %i", virt, r);
522 assert_se(r >= 0);
523 condition_free(condition);
524 }
525 }
526
527 static void test_condition_test_user(void) {
528 Condition *condition;
529 char* uid;
530 char* username;
531 int r;
532
533 condition = condition_new(CONDITION_USER, "garbage oifdsjfoidsjoj", false, false);
534 assert_se(condition);
535 r = condition_test(condition);
536 log_info("ConditionUser=garbage → %i", r);
537 assert_se(r == 0);
538 condition_free(condition);
539
540 assert_se(asprintf(&uid, "%"PRIu32, UINT32_C(0xFFFF)) > 0);
541 condition = condition_new(CONDITION_USER, uid, false, false);
542 assert_se(condition);
543 r = condition_test(condition);
544 log_info("ConditionUser=%s → %i", uid, r);
545 assert_se(r == 0);
546 condition_free(condition);
547 free(uid);
548
549 assert_se(asprintf(&uid, "%u", (unsigned)getuid()) > 0);
550 condition = condition_new(CONDITION_USER, uid, false, false);
551 assert_se(condition);
552 r = condition_test(condition);
553 log_info("ConditionUser=%s → %i", uid, r);
554 assert_se(r > 0);
555 condition_free(condition);
556 free(uid);
557
558 assert_se(asprintf(&uid, "%u", (unsigned)getuid()+1) > 0);
559 condition = condition_new(CONDITION_USER, uid, false, false);
560 assert_se(condition);
561 r = condition_test(condition);
562 log_info("ConditionUser=%s → %i", uid, r);
563 assert_se(r == 0);
564 condition_free(condition);
565 free(uid);
566
567 username = getusername_malloc();
568 assert_se(username);
569 condition = condition_new(CONDITION_USER, username, false, false);
570 assert_se(condition);
571 r = condition_test(condition);
572 log_info("ConditionUser=%s → %i", username, r);
573 assert_se(r > 0);
574 condition_free(condition);
575 free(username);
576
577 username = (char*)(geteuid() == 0 ? NOBODY_USER_NAME : "root");
578 condition = condition_new(CONDITION_USER, username, false, false);
579 assert_se(condition);
580 r = condition_test(condition);
581 log_info("ConditionUser=%s → %i", username, r);
582 assert_se(r == 0);
583 condition_free(condition);
584
585 condition = condition_new(CONDITION_USER, "@system", false, false);
586 assert_se(condition);
587 r = condition_test(condition);
588 log_info("ConditionUser=@system → %i", r);
589 if (uid_is_system(getuid()) || uid_is_system(geteuid()))
590 assert_se(r > 0);
591 else
592 assert_se(r == 0);
593 condition_free(condition);
594 }
595
596 static void test_condition_test_group(void) {
597 Condition *condition;
598 char* gid;
599 char* groupname;
600 gid_t *gids, max_gid;
601 int ngroups_max, ngroups, r, i;
602
603 assert_se(0 < asprintf(&gid, "%u", UINT32_C(0xFFFF)));
604 condition = condition_new(CONDITION_GROUP, gid, false, false);
605 assert_se(condition);
606 r = condition_test(condition);
607 log_info("ConditionGroup=%s → %i", gid, r);
608 assert_se(r == 0);
609 condition_free(condition);
610 free(gid);
611
612 assert_se(0 < asprintf(&gid, "%u", getgid()));
613 condition = condition_new(CONDITION_GROUP, gid, false, false);
614 assert_se(condition);
615 r = condition_test(condition);
616 log_info("ConditionGroup=%s → %i", gid, r);
617 assert_se(r > 0);
618 condition_free(condition);
619 free(gid);
620
621 ngroups_max = sysconf(_SC_NGROUPS_MAX);
622 assert(ngroups_max > 0);
623
624 gids = alloca(sizeof(gid_t) * ngroups_max);
625
626 ngroups = getgroups(ngroups_max, gids);
627 assert(ngroups >= 0);
628
629 max_gid = getgid();
630 for (i = 0; i < ngroups; i++) {
631 assert_se(0 < asprintf(&gid, "%u", gids[i]));
632 condition = condition_new(CONDITION_GROUP, gid, false, false);
633 assert_se(condition);
634 r = condition_test(condition);
635 log_info("ConditionGroup=%s → %i", gid, r);
636 assert_se(r > 0);
637 condition_free(condition);
638 free(gid);
639 max_gid = gids[i] > max_gid ? gids[i] : max_gid;
640
641 groupname = gid_to_name(gids[i]);
642 assert_se(groupname);
643 condition = condition_new(CONDITION_GROUP, groupname, false, false);
644 assert_se(condition);
645 r = condition_test(condition);
646 log_info("ConditionGroup=%s → %i", groupname, r);
647 assert_se(r > 0);
648 condition_free(condition);
649 free(groupname);
650 max_gid = gids[i] > max_gid ? gids[i] : max_gid;
651 }
652
653 assert_se(0 < asprintf(&gid, "%u", max_gid+1));
654 condition = condition_new(CONDITION_GROUP, gid, false, false);
655 assert_se(condition);
656 r = condition_test(condition);
657 log_info("ConditionGroup=%s → %i", gid, r);
658 assert_se(r == 0);
659 condition_free(condition);
660 free(gid);
661
662 groupname = (char*)(geteuid() == 0 ? NOBODY_GROUP_NAME : "root");
663 condition = condition_new(CONDITION_GROUP, groupname, false, false);
664 assert_se(condition);
665 r = condition_test(condition);
666 log_info("ConditionGroup=%s → %i", groupname, r);
667 assert_se(r == 0);
668 condition_free(condition);
669 }
670
671 int main(int argc, char *argv[]) {
672 log_set_max_level(LOG_DEBUG);
673 log_parse_environment();
674 log_open();
675
676 test_condition_test_path();
677 test_condition_test_ac_power();
678 test_condition_test_host();
679 test_condition_test_architecture();
680 test_condition_test_kernel_command_line();
681 test_condition_test_kernel_version();
682 test_condition_test_null();
683 test_condition_test_security();
684 test_condition_test_virtualization();
685 test_condition_test_user();
686 test_condition_test_group();
687 test_condition_test_control_group_controller();
688
689 return 0;
690 }