#include "log.h"
#include "fileio.h"
#include "fuzz.h"
+#include "tests.h"
/* This is a test driver for the systemd fuzzers that provides main function
* for regression testing outside of oss-fuzz (https://github.com/google/oss-fuzz)
size_t size;
char *name;
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
for (i = 1; i < argc; i++) {
_cleanup_free_ char *buf = NULL;
setlocale(LC_ALL, "de_DE.UTF-8");
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
/* If test-catalog is located at the build directory, then use catalogs in that.
* If it is not, e.g. installed by systemd-tests package, then use installed catalogs. */
int main(int argc, char *argv[]) {
#if HAVE_XZ || HAVE_LZ4
- const char *i;
-
- log_set_max_level(LOG_INFO);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_INFO);
if (argc >= 2) {
unsigned x;
else
arg_start = getpid_cached();
+ const char *i;
NULSTR_FOREACH(i, "zeros\0simple\0random\0") {
#if HAVE_XZ
test_compress_decompress("XZ", i, compress_blob_xz, decompress_blob_xz);
#include "macro.h"
#include "path-util.h"
#include "random-util.h"
+#include "tests.h"
#include "util.h"
#if HAVE_XZ
memcpy(huge, "HUGE=", 5);
char_array_0(huge);
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
random_bytes(data + 7, sizeof(data) - 7);
#include "journal-internal.h"
#include "log.h"
#include "macro.h"
+#include "tests.h"
int main(int argc, char *argv[]) {
unsigned n = 0;
_cleanup_(sd_journal_closep) sd_journal*j = NULL;
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
assert_se(sd_journal_open(&j, SD_JOURNAL_LOCAL_ONLY) >= 0);
#include "log.h"
#include "parse-util.h"
#include "rm-rf.h"
+#include "tests.h"
#include "util.h"
int main(int argc, char *argv[]) {
int r, i, I = 100;
char t[] = "/tmp/journal-stream-XXXXXX";
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
if (argc >= 2) {
r = safe_atoi(argv[1], &I);
}
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
/* journal_file_open requires a valid machine id */
if (access("/etc/machine-id", F_OK) != 0)
#include "journal-internal.h"
#include "log.h"
#include "string-util.h"
+#include "tests.h"
#include "util.h"
int main(int argc, char *argv[]) {
_cleanup_(sd_journal_closep) sd_journal*j = NULL;
_cleanup_free_ char *t;
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
assert_se(sd_journal_open(&j, 0) >= 0);
if (access("/etc/machine-id", F_OK) != 0)
return log_tests_skipped("/etc/machine-id not found");
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
assert_se(mkdtemp(t));
assert_se(chdir(t) >= 0);
if (access("/etc/machine-id", F_OK) != 0)
return log_tests_skipped("/etc/machine-id not found");
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
assert_se(mkdtemp(t));
assert_se(chdir(t) >= 0);
sd_id128_t fake_boot_id;
char t[] = "/tmp/journal-XXXXXX";
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
assert_se(mkdtemp(t));
assert_se(chdir(t) >= 0);
JournalFile *f1, *f2, *f3, *f4;
char t[] = "/tmp/journal-XXXXXX";
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
assert_se(mkdtemp(t));
assert_se(chdir(t) >= 0);
assert_se(data_size <= sizeof(data));
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
assert_se(mkdtemp(t));
assert_se(chdir(t) >= 0);
int main(int argc, char *argv[]) {
arg_keep = argc > 1;
+ test_setup_logging(LOG_INFO);
+
/* journal_file_open requires a valid machine id */
if (access("/etc/machine-id", F_OK) != 0)
return log_tests_skipped("/etc/machine-id not found");
#include "in-addr-util.h"
#include "netlink-util.h"
+#include "tests.h"
#include "util.h"
static void acd_handler(sd_ipv4acd *acd, int event, void *userdata) {
}
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
if (argc == 3)
return test_acd(argv[1], argv[2]);
#include "dhcp-internal.h"
#include "dhcp-protocol.h"
#include "fd-util.h"
+#include "tests.h"
#include "util.h"
static uint8_t mac_addr[] = {'A', 'B', 'C', '1', '2', '3'};
int main(int argc, char *argv[]) {
_cleanup_(sd_event_unrefp) sd_event *e;
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
assert_se(sd_event_new(&e) >= 0);
_cleanup_(sd_event_unrefp) sd_event *e;
int r;
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
assert_se(sd_event_new(&e) >= 0);
#include "fd-util.h"
#include "macro.h"
#include "socket-util.h"
+#include "tests.h"
#include "virt.h"
static struct ether_addr mac_addr = {
assert_se(sd_event_new(&e) >= 0);
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_client_basic(e);
test_option(e);
#include "netlink-util.h"
#include "parse-util.h"
#include "string-util.h"
+#include "tests.h"
#include "util.h"
static void ll_handler(sd_ipv4ll *ll, int event, void *userdata) {
}
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
if (argc == 2)
return test_ll(argv[1], NULL);
#include "arp-util.h"
#include "fd-util.h"
#include "socket-util.h"
+#include "tests.h"
#include "util.h"
static bool verbose = false;
int main(int argc, char *argv[]) {
_cleanup_(sd_event_unrefp) sd_event *e = NULL;
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
assert_se(sd_event_new(&e) >= 0);
#include "icmp6-util.h"
#include "socket-util.h"
#include "strv.h"
+#include "tests.h"
static struct ether_addr mac_addr = {
.ether_addr_octet = { 0x78, 0x2b, 0xcb, 0xb3, 0x6d, 0x53 }
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_radv_prefix();
test_radv();
#include "socket-util.h"
#include "strv.h"
#include "ndisc-internal.h"
+#include "tests.h"
static struct ether_addr mac_addr = {
.ether_addr_octet = {'A', 'B', 'C', '1', '2', '3'}
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_rs();
test_timeout();
void *p;
int q, r;
+ test_setup_logging(LOG_INFO);
+
r = server_init(&bus);
if (r < 0)
return log_tests_skipped("Failed to connect to bus");
}
int main(int argc, char **argv) {
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_INFO);
test_bus_new();
_cleanup_(sd_bus_creds_unrefp) sd_bus_creds *creds = NULL;
int r;
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
if (cg_unified_flush() == -ENOMEDIUM)
return log_tests_skipped("/sys/fs/cgroup/ not available");
#include "bus-message.h"
#include "bus-util.h"
#include "macro.h"
+#include "tests.h"
#include "util.h"
static void test_bus_gvariant_is_fixed_size(void) {
}
int main(int argc, char *argv[]) {
+ test_setup_logging(LOG_INFO);
test_bus_gvariant_is_fixed_size();
test_bus_gvariant_get_size();
double dbl;
uint64_t u64;
+ test_setup_logging(LOG_INFO);
+
r = sd_bus_default_user(&bus);
if (r < 0)
return log_tests_skipped("Failed to connect to bus");
sd_bus_slot slots[19];
int r;
+ test_setup_logging(LOG_INFO);
+
r = sd_bus_open_user(&bus);
if (r < 0)
return log_tests_skipped("Failed to connect to bus");
const char *unique;
int r;
+ test_setup_logging(LOG_INFO);
+
r = sd_event_default(&event);
assert_se(r >= 0);
#include "signal-util.h"
#include "stdio-util.h"
#include "string-util.h"
+#include "tests.h"
#include "util.h"
static int prepare_handler(sd_event_source *s, void *userdata) {
}
int main(int argc, char *argv[]) {
-
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
+ test_setup_logging(LOG_DEBUG);
test_basic();
test_sd_event_now();
#include "alloc-util.h"
#include "in-addr-util.h"
#include "local-addresses.h"
+#include "tests.h"
static void print_local_addresses(struct local_address *a, unsigned n) {
unsigned i;
struct local_address *a;
int n;
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
a = NULL;
n = local_addresses(NULL, 0, AF_UNSPEC, &a);
_cleanup_(sd_device_unrefp) sd_device *loopback = NULL;
int ifindex, r;
+ test_setup_logging(LOG_INFO);
+
test_deserialize_in_addr();
test_deserialize_dhcp_routes();
test_address_equality();
#include "network-internal.h"
#include "networkd-manager.h"
#include "string-util.h"
+#include "tests.h"
static void test_rule_serialization(const char *title, const char *ruleset, const char *expected) {
char pattern[] = "/tmp/systemd-test-routing-policy-rule.XXXXXX",
int main(int argc, char **argv) {
_cleanup_free_ char *p = NULL;
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_rule_serialization("basic parsing",
"RULE=from=1.2.3.4/32 to=2.3.4.5/32 tos=5 fwmark=1/2 table=10", NULL);
#include "log.h"
#include "nspawn-patch-uid.h"
#include "user-util.h"
+#include "tests.h"
#include "util.h"
int main(int argc, char *argv[]) {
uid_t shift, range;
int r;
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
if (argc != 4) {
log_error("Expected PATH SHIFT RANGE parameters.");
return SYSTEMD_SLOW_TESTS_DEFAULT;
}
+void test_setup_logging(int level) {
+ log_set_max_level(level);
+ log_parse_environment();
+ log_open();
+}
+
int log_tests_skipped(const char *message) {
log_notice("%s: %s, skipping tests.",
program_invocation_short_name, message);
const char* get_testdata_dir(void);
const char* get_catalog_dir(void);
bool slow_tests_enabled(void);
+void test_setup_logging(int level);
int log_tests_skipped(const char *message);
int a, v;
const char *p;
+ test_setup_logging(LOG_INFO);
+
assert_se(architecture_from_string("") < 0);
assert_se(architecture_from_string(NULL) < 0);
assert_se(architecture_from_string("hoge") < 0);
TEST_BARRIER_WAIT_SUCCESS(pid2));
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_INFO);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_INFO);
if (!slow_tests_enabled())
return log_tests_skipped("slow tests are disabled");
int main(int argc, char* argv[]) {
int p, q, r;
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
+ test_setup_logging(LOG_DEBUG);
p = test_acpi_fpdt();
assert(p >= 0);
char log_buf[65535];
int r;
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
r = enter_cgroup_subroot();
if (r == -ENOMEDIUM)
#include "bus-util.h"
#include "log.h"
+#include "tests.h"
static void test_name_async(unsigned n_messages) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
}
int main(int argc, char **argv) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_name_async(0);
test_name_async(20);
int main(int argc, char *argv[]) {
bool run_ambient;
+ test_setup_logging(LOG_INFO);
+
test_last_cap_file();
test_last_cap_probe();
- log_parse_environment();
- log_open();
-
log_info("have ambient caps: %s", yes_no(ambient_capabilities_supported()));
if (getuid() != 0)
int main(int argc, char* argv[]) {
int rc = EXIT_SUCCESS;
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_cg_mask_to_string();
TEST_REQ_RUNNING_SYSTEMD(rc = test_cgroup_mask());
#include "string-util.h"
#include "strv.h"
#include "test-helper.h"
+#include "tests.h"
#include "user-util.h"
#include "util.h"
}
int main(void) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_path_decode_unit();
test_path_get_unit();
#include "strv.h"
#include "tomoyo-util.h"
#include "user-util.h"
+#include "tests.h"
#include "util.h"
#include "virt.h"
}
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_condition_test_path();
test_condition_test_ac_power();
#include "rm-rf.h"
#include "string-util.h"
#include "strv.h"
+#include "tests.h"
#include "user-util.h"
#include "util.h"
}
int main(int argc, char **argv) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_conf_files_list(false);
test_conf_files_list(true);
#include "rm-rf.h"
#include "string-util.h"
#include "strv.h"
+#include "tests.h"
#include "user-util.h"
#include "util.h"
}
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
test_copy_file();
test_copy_file_fd();
#include "alloc-util.h"
#include "string-util.h"
+#include "tests.h"
#include "util.h"
static void test_should_pass(const char *p) {
}
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_one("17:41");
test_one("18:42:44");
#include "log.h"
#include "loop-util.h"
#include "string-util.h"
+#include "tests.h"
int main(int argc, char *argv[]) {
_cleanup_(loop_device_unrefp) LoopDevice *d = NULL;
_cleanup_(dissected_image_unrefp) DissectedImage *m = NULL;
int r, i;
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
if (argc < 2) {
log_error("Requires one command line argument.");
#include "dns-domain.h"
#include "macro.h"
#include "string-util.h"
+#include "tests.h"
static void test_dns_label_unescape_one(const char *what, const char *expect, size_t buffer_sz, int ret) {
char buffer[buffer_sz];
}
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_dns_label_unescape();
test_dns_label_unescape_suffix();
Job *j;
int r;
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
r = enter_cgroup_subroot();
if (r == -ENOMEDIUM)
#include "alloc-util.h"
#include "escape.h"
#include "macro.h"
+#include "tests.h"
static void test_cescape(void) {
_cleanup_free_ char *escaped;
}
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_cescape();
test_cunescape();
#include "rm-rf.h"
#include "string-util.h"
#include "strv.h"
+#include "tests.h"
static int here = 0, here2 = 0, here3 = 0;
void *ignore_stdout_args[] = {&here, &here2, &here3};
}
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_execute_directory(true);
test_execute_directory(false);
};
int r;
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
(void) unsetenv("USER");
(void) unsetenv("LOGNAME");
#include "random-util.h"
#include "string-util.h"
#include "util.h"
+#include "tests.h"
static void test_close_many(void) {
int fds[3];
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
test_close_many();
test_close_nointr();
#include "process-util.h"
#include "string-util.h"
#include "strv.h"
+#include "tests.h"
#include "util.h"
static void test_parse_env_file(void) {
}
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_parse_env_file();
test_parse_multiline_env_file();
#include "firewall-util.h"
#include "log.h"
+#include "tests.h"
#define MAKE_IN_ADDR_UNION(a,b,c,d) (union in_addr_union) { .in.s_addr = htobe32((uint32_t) (a) << 24 | (uint32_t) (b) << 16 | (uint32_t) (c) << 8 | (uint32_t) (d))}
int main(int argc, char *argv[]) {
int r;
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
r = fw_add_masquerade(true, AF_INET, 0, NULL, 0, "foobar", NULL, 0);
if (r < 0)
_cleanup_free_ char *s = NULL;
int r;
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
assert_se(khash_new(&h, NULL) == -EINVAL);
assert_se(khash_new(&h, "") == -EINVAL);
#include "rm-rf.h"
#include "special.h"
#include "string-util.h"
+#include "tests.h"
static void test_basic_mask_and_enable(const char *root) {
const char *p;
UnitFileChange *changes = NULL;
size_t n_changes = 0;
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "a.service", NULL) == -ENOENT);
assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "b.service", NULL) == -ENOENT);
#include <string.h>
#include "install.h"
+#include "tests.h"
static void dump_changes(UnitFileChange *c, unsigned n) {
unsigned i;
size_t n_changes = 0;
UnitFileState state = 0;
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
+ test_setup_logging(LOG_DEBUG);
h = hashmap_new(&string_hash_ops);
r = unit_file_get_list(UNIT_FILE_SYSTEM, NULL, h, NULL, NULL);
int r;
const char* name = argv[1] ?: NOBODY_USER_NAME;
+ test_setup_logging(LOG_INFO);
+
r = get_user_creds(&name, &uid, NULL, NULL, NULL, 0);
if (r == -ESRCH)
return log_tests_skipped("Failed to resolve user");
}
int main(int argc, char **argv) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
+ test_setup_logging(LOG_DEBUG);
test_basic_parsing();
test_bad_input();
#include "log.h"
#include "loopback-setup.h"
+#include "tests.h"
int main(int argc, char* argv[]) {
int r;
- log_open();
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
+ test_setup_logging(LOG_DEBUG);
r = loopback_setup();
if (r < 0)
#include "path-util.h"
#include "rm-rf.h"
#include "string-util.h"
+#include "tests.h"
static void test_mount_propagation_flags(const char *name, int ret, unsigned long expected) {
long unsigned flags;
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
test_mount_propagation_flags("shared", 0, MS_SHARED);
test_mount_propagation_flags("slave", 0, MS_SLAVE);
char boot_id[SD_ID128_STRING_MAX];
_cleanup_free_ char *x = NULL, *y = NULL, *z = NULL, *zz = NULL;
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_INFO);
assert_se(sd_id128_get_boot(&bid) >= 0);
sd_id128_to_string(bid, boot_id);
sd_netlink *rtnl;
int r;
+ test_setup_logging(LOG_INFO);
+
assert_se(sd_netlink_open(&rtnl) >= 0);
assert_se(rtnl);
#include "log.h"
#include "namespace.h"
+#include "tests.h"
int main(int argc, char *argv[]) {
const char * const writable[] = {
char tmp_dir[] = "/tmp/systemd-private-XXXXXX",
var_tmp_dir[] = "/var/tmp/systemd-private-XXXXXX";
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
assert_se(mkdtemp(tmp_dir));
assert_se(mkdtemp(var_tmp_dir));
#include "log.h"
#include "os-util.h"
+#include "tests.h"
static void test_path_is_os_tree(void) {
assert_se(path_is_os_tree("/") > 0);
}
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_path_is_os_tree();
#include "rm-rf.h"
#include "string-util.h"
#include "strv.h"
+#include "tests.h"
static void test_paths(UnitFileScope scope) {
char template[] = "/tmp/test-path-lookup.XXXXXXX";
}
int main(int argc, char **argv) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_paths(UNIT_FILE_SYSTEM);
test_paths(UNIT_FILE_USER);
#include "stat-util.h"
#include "string-util.h"
#include "strv.h"
+#include "tests.h"
#include "util.h"
#define test_path_compare(a, b, result) { \
}
int main(int argc, char **argv) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_path();
test_path_equal_root();
umask(022);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_INFO);
test_path = path_join(NULL, get_testdata_dir(), "test-path");
assert_se(set_unit_path(test_path) >= 0);
#include "string-util.h"
#include "terminal-util.h"
#include "test-helper.h"
+#include "tests.h"
#include "util.h"
#include "virt.h"
}
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
saved_argc = argc;
saved_argv = argv;
#include "hexdecoct.h"
#include "random-util.h"
#include "log.h"
+#include "tests.h"
static void test_acquire_random_bytes(bool high_quality_required) {
uint8_t buf[16] = {};
}
int main(int argc, char **argv) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_acquire_random_bytes(false);
test_acquire_random_bytes(true);
Service *ser;
int r;
+ test_setup_logging(LOG_INFO);
+
r = enter_cgroup_subroot();
if (r == -ENOMEDIUM)
return log_tests_skipped("cgroupfs not available");
#include "seccomp-util.h"
#include "set.h"
#include "string-util.h"
+#include "tests.h"
#include "util.h"
#include "virt.h"
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
test_seccomp_arch_to_string();
test_architecture_table();
#include "log.h"
#include "selinux-util.h"
#include "string-util.h"
+#include "tests.h"
#include "time-util.h"
#include "util.h"
if (argc >= 2)
path = argv[1];
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
+ test_setup_logging(LOG_DEBUG);
test_testing();
test_loading();
void *addr = NULL;
uint8_t *p;
+ test_setup_logging(LOG_INFO);
+
#ifdef __SANITIZE_ADDRESS__
return log_tests_skipped("address-sanitizer is enabled");
#endif
int main(int argc, char* argv[]) {
int i, r = 0, k;
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_INFO);
if (getuid() != 0)
log_warning("This program is unlikely to work for unprivileged users");
#include "socket-util.h"
#include "string-util.h"
#include "util.h"
+#include "tests.h"
static void test_ifname_valid(void) {
assert(ifname_valid("foo"));
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
test_ifname_valid();
#include "specifier.h"
#include "string-util.h"
#include "strv.h"
+#include "tests.h"
static void test_specifier_escape_one(const char *a, const char *b) {
_cleanup_free_ char *x = NULL;
}
int main(int argc, char *argv[]) {
- log_set_max_level(LOG_DEBUG);
+ test_setup_logging(LOG_DEBUG);
test_specifier_escape();
test_specifier_escape_strv();
#include "log.h"
#include "process-util.h"
#include "string-util.h"
+#include "tests.h"
#include "util.h"
int main(int argc, char** argv) {
const char *p = argv[1] ?: "/tmp";
char *pattern;
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
+ test_setup_logging(LOG_DEBUG);
pattern = strjoina(p, "/systemd-test-XXXXXX");
}
int main(int argc, char **argv) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_mount_points_list(NULL);
test_mount_points_list("/test-umount/empty.mountinfo");
_cleanup_(rm_rf_physical_and_freep) char *runtime_dir = NULL;
int r;
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_INFO);
r = enter_cgroup_subroot();
if (r == -ENOMEDIUM)
_cleanup_(rm_rf_physical_and_freep) char *runtime_dir = NULL;
int r, rc = 0;
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_INFO);
r = enter_cgroup_subroot();
if (r == -ENOMEDIUM)
Unit *a, *b, *c, *u;
int r;
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
if (getuid() != 0)
return log_tests_skipped("not root");
int r;
bool slow;
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
slow = slow_tests_enabled();
#include "fs-util.h"
#include "macro.h"
#include "string-util.h"
+#include "tests.h"
#include "xattr-util.h"
static void test_fgetxattrat_fake(void) {
}
int main(void) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
test_fgetxattrat_fake();
test_getcrtime();
#include "log.h"
#include "macro.h"
#include "timesyncd-conf.h"
+#include "tests.h"
static void test_manager_parse_string(void) {
/* Make sure that NTP_SERVERS is configured to something
}
int main(int argc, char **argv) {
- log_set_max_level(LOG_DEBUG);
- log_parse_environment();
+ test_setup_logging(LOG_DEBUG);
test_manager_parse_string();