#include <stdlib.h>
#include "coredump-vacuum.h"
+#include "tests.h"
int main(int argc, char *argv[]) {
+ test_setup_logging(LOG_DEBUG);
if (coredump_vacuum(-1, UINT64_MAX, 70 * 1024) < 0)
return EXIT_FAILURE;
#include "fd-util.h"
#include "log.h"
#include "qcow2-util.h"
+#include "tests.h"
int main(int argc, char *argv[]) {
_cleanup_close_ int sfd = -EBADF, dfd = -EBADF;
int r;
+ test_setup_logging(LOG_DEBUG);
+
if (argc != 3) {
log_error("Needs two arguments.");
return EXIT_FAILURE;
#include "journald-server.h"
#include "test-tables.h"
+#include "tests.h"
int main(int argc, char **argv) {
+ test_setup_logging(LOG_DEBUG);
+
test_table(split_mode, SPLIT);
test_table(storage, STORAGE);
#include "ether-addr-util.h"
#include "macro.h"
#include "memory-util.h"
+#include "tests.h"
struct option_desc {
uint8_t sname[64];
}
int main(int argc, char *argv[]) {
+ test_setup_logging(LOG_DEBUG);
+
test_invalid_buffer_length();
test_message_init();
#include "fd-util.h"
#include "missing_resource.h"
#include "string-util.h"
+#include "tests.h"
#include "time-util.h"
#define MAX_SIZE (2*1024*1024)
pid_t pid;
int r;
+ test_setup_logging(LOG_DEBUG);
+
for (i = 1; i < argc; i++) {
if (streq(argv[i], "chart")) {
mode = MODE_CHART;
#include "log.h"
#include "macro.h"
#include "strv.h"
+#include "tests.h"
struct context {
int fds[2];
void *p;
int r, q;
+ test_setup_logging(LOG_DEBUG);
+
c.automatic_integer_property = 4711;
assert_se(c.automatic_string_property = strdup("dudeldu"));
#include "macro.h"
#include "memory-util.h"
#include "string-util.h"
+#include "tests.h"
struct context {
int fds[2];
int main(int argc, char *argv[]) {
int r;
+ test_setup_logging(LOG_DEBUG);
+
r = test_one(true, true, false, false);
assert_se(r >= 0);
#include "bus-signature.h"
#include "log.h"
#include "string-util.h"
+#include "tests.h"
int main(int argc, char *argv[]) {
char prefix[256];
int r;
+ test_setup_logging(LOG_DEBUG);
+
assert_se(signature_is_single("y", false));
assert_se(signature_is_single("u", false));
assert_se(signature_is_single("v", false));
#include "fd-util.h"
#include "macro.h"
#include "mmap-cache.h"
+#include "tests.h"
#include "tmpfile-util.h"
int main(int argc, char *argv[]) {
MMapCache *m;
void *p, *q;
+ test_setup_logging(LOG_DEBUG);
+
assert_se(m = mmap_cache_new());
x = mkostemp_safe(px);
#include "macro.h"
#include "socket-util.h"
#include "string-util.h"
+#include "tests.h"
#include "time-util.h"
#define TEST_TIMEOUT_USEC (20*USEC_PER_SEC)
.in.sin_port = htobe16(80),
};
+ test_setup_logging(LOG_DEBUG);
+
assert_se(sd_resolve_default(&resolve) >= 0);
/* Test a floating resolver query */
#include "bus-util.h"
#include "fd-util.h"
#include "macro.h"
+#include "tests.h"
static int inhibit(sd_bus *bus, const char *what) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
int fd1, fd2;
int r;
+ test_setup_logging(LOG_DEBUG);
+
r = sd_bus_open_system(&bus);
assert_se(r >= 0);
#include "logind-action.h"
#include "logind-session.h"
#include "test-tables.h"
+#include "tests.h"
int main(int argc, char **argv) {
+ test_setup_logging(LOG_DEBUG);
+
test_table(handle_action, HANDLE_ACTION);
test_table(inhibit_mode, INHIBIT_MODE);
test_table(kill_who, KILL_WHO);
#include "machine.h"
#include "test-tables.h"
+#include "tests.h"
int main(int argc, char **argv) {
+ test_setup_logging(LOG_DEBUG);
+
test_table(kill_who, KILL_WHO);
test_table(machine_class, MACHINE_CLASS);
test_table(machine_state, MACHINE_STATE);
#include "macro.h"
#include "network-generator.h"
#include "string-util.h"
+#include "tests.h"
static void test_network_one(const char *ifname, const char *key, const char *value, const char *expected) {
_cleanup_(context_clear) Context context = {};
}
int main(int argc, char *argv[]) {
+ test_setup_logging(LOG_DEBUG);
+
test_network_one("", "ip", "dhcp6",
"[Match]\n"
"Kind=!*\n"
#include "networkd-network.h"
#include "networkd-util.h"
#include "test-tables.h"
+#include "tests.h"
#include "tunnel.h"
int main(int argc, char **argv) {
+ test_setup_logging(LOG_DEBUG);
+
test_table(bond_ad_select, NETDEV_BOND_AD_SELECT);
test_table(bond_arp_all_targets, NETDEV_BOND_ARP_ALL_TARGETS);
test_table(bond_arp_validate, NETDEV_BOND_ARP_VALIDATE);
#include "nspawn-settings.h"
#include "test-tables.h"
+#include "tests.h"
int main(int argc, char **argv) {
+ test_setup_logging(LOG_DEBUG);
+
test_table(resolv_conf_mode, RESOLV_CONF_MODE);
test_table(timezone_mode, TIMEZONE_MODE);
_cleanup_globfree_ glob_t g = {};
char **fnames;
- log_parse_environment();
+ test_setup_logging(LOG_DEBUG);
if (argc >= 2) {
N = argc - 1;
#include "random-util.h"
#include "resolved-def.h"
#include "string-util.h"
+#include "tests.h"
#include "time-util.h"
static void prefix_random(const char *name, char **ret) {
* That zones contacted are still set up as they were when I wrote this.
*/
+ test_setup_logging(LOG_DEBUG);
+
assert_se(sd_bus_open_system(&bus) >= 0);
/* Normally signed */
#include "resolved-dns-dnssec.h"
#include "resolved-dns-packet.h"
#include "test-tables.h"
+#include "tests.h"
int main(int argc, char **argv) {
uint16_t i;
+ test_setup_logging(LOG_DEBUG);
+
test_table(dns_protocol, DNS_PROTOCOL);
test_table(dnssec_result, DNSSEC_RESULT);
test_table(dnssec_verdict, DNSSEC_VERDICT);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bitmap.h"
+#include "tests.h"
int main(int argc, const char *argv[]) {
_cleanup_bitmap_free_ Bitmap *b = NULL, *b2 = NULL;
unsigned n = UINT_MAX, i = 0;
+ test_setup_logging(LOG_DEBUG);
+
b = bitmap_new();
assert_se(b);
#include "format-util.h"
#include "log.h"
#include "memory-util.h"
+#include "tests.h"
int main(int argc, char *argv[]) {
_cleanup_close_ int fd = -EBADF;
assert(argc == 2);
assert(!isempty(argv[1]));
+ test_setup_logging(LOG_DEBUG);
+
fd = open(argv[1], O_RDONLY|O_CLOEXEC|O_NOCTTY);
if (fd < 0) {
log_error_errno(errno, "Failed to open '%s': %m", argv[1]);
#include "format-util.h"
#include "log.h"
#include "string-util.h"
+#include "tests.h"
int main(int argc, char *argv[]) {
BtrfsQuotaInfo quota;
int r, fd;
+ test_setup_logging(LOG_DEBUG);
+
fd = open("/", O_RDONLY|O_CLOEXEC|O_DIRECTORY);
if (fd < 0)
log_error_errno(errno, "Failed to open root directory: %m");
#include "fd-util.h"
#include "log.h"
#include "main-func.h"
+#include "tests.h"
static char *arg_root = NULL;
static int arg_flags = 0;
static int run(int argc, char **argv) {
int r;
- log_setup();
+ test_setup_logging(LOG_DEBUG);
r = parse_argv(argc, argv);
if (r <= 0)
#include "parse-util.h"
#include "strv.h"
#include "time-util.h"
+#include "tests.h"
int main(int argc, char *argv[]) {
_cleanup_strv_free_ char **l = NULL;
int n, i;
usec_t duration = USEC_PER_SEC / 10;
+ test_setup_logging(LOG_DEBUG);
+
if (argc >= 2) {
unsigned x;
const char *f;
struct stat st;
+ test_setup_logging(LOG_DEBUG);
+
if (have_effective_cap(CAP_DAC_OVERRIDE) <= 0)
return log_tests_skipped("missing capability (CAP_DAC_OVERRIDE)");
#include "stdio-util.h"
#include "string-util.h"
#include "strv.h"
-#include "time-util.h"
#include "tests.h"
+#include "time-util.h"
TEST(hashmap_replace) {
_cleanup_hashmap_free_ Hashmap *m = NULL;
#include <stdio.h>
#include "service.h"
+#include "tests.h"
#include "unit.h"
int main(int argc, char *argv[]) {
const ServiceState test_states[] = { SERVICE_DEAD, SERVICE_RUNNING };
+ test_setup_logging(LOG_DEBUG);
+
for (size_t i = 0; i < ELEMENTSOF(test_states); i++) {
/* fake a unit */
Service s = {
#include "alloc-util.h"
#include "list.h"
+#include "tests.h"
int main(int argc, const char *argv[]) {
+ test_setup_logging(LOG_DEBUG);
+
size_t i;
typedef struct list_item {
LIST_FIELDS(struct list_item, item_list);
#include "process-util.h"
#include "string-util.h"
#include "strv.h"
+#include "tests.h"
assert_cc(IS_SYNTHETIC_ERRNO(SYNTHETIC_ERRNO(EINVAL)));
assert_cc(!IS_SYNTHETIC_ERRNO(EINVAL));
}
int main(int argc, char* argv[]) {
+ test_setup_logging(LOG_DEBUG);
+
test_file();
assert_se(log_info_errno(SYNTHETIC_ERRNO(EUCLEAN), "foo") == -EUCLEAN);
uint64_t v, pid_max, threads_max, limit;
int r;
- log_parse_environment();
- log_open();
+ test_setup_logging(LOG_DEBUG);
assert_se(procfs_cpu_get_usage(&nsec) >= 0);
log_info("Current system CPU time: %s", FORMAT_TIMESPAN(nsec/NSEC_PER_USEC, 1));
#include "swap.h"
#include "target.h"
#include "test-tables.h"
+#include "tests.h"
#include "timer.h"
#include "unit-name.h"
#include "unit.h"
#include "virt.h"
int main(int argc, char **argv) {
+ test_setup_logging(LOG_DEBUG);
+
test_table(architecture, ARCHITECTURE);
test_table(assert_type, CONDITION_TYPE);
test_table(automount_result, AUTOMOUNT_RESULT);
#include "json.h"
#include "rm-rf.h"
#include "strv.h"
+#include "tests.h"
#include "tmpfile-util.h"
#include "user-util.h"
#include "varlink.h"
pthread_t t;
const char *sp;
- log_set_max_level(LOG_DEBUG);
- log_open();
+ test_setup_logging(LOG_DEBUG);
assert_se(mkdtemp_malloc("/tmp/varlink-test-XXXXXX", &tmpdir) >= 0);
sp = strjoina(tmpdir, "/socket");
#include "alloc-util.h"
#include "string-util.h"
+#include "tests.h"
#include "xml.h"
static void test_one(const char *data, ...) {
int main(int argc, char *argv[]) {
+ test_setup_logging(LOG_DEBUG);
+
test_one("", XML_END);
test_one("<foo></foo>",
#include "link-config.h"
#include "test-tables.h"
+#include "tests.h"
int main(int argc, char **argv) {
+ test_setup_logging(LOG_DEBUG);
+
test_table(mac_address_policy, MAC_ADDRESS_POLICY);
return EXIT_SUCCESS;