mirror of
https://github.com/systemd/systemd
synced 2024-10-04 15:21:01 +00:00
test: always call test_setup_logging()
This commit is contained in:
parent
48bfc6791d
commit
965040d811
|
@ -3,8 +3,10 @@
|
|||
#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;
|
||||
|
|
|
@ -7,11 +7,14 @@
|
|||
#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;
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
|
||||
#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);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "ether-addr-util.h"
|
||||
#include "macro.h"
|
||||
#include "memory-util.h"
|
||||
#include "tests.h"
|
||||
|
||||
struct option_desc {
|
||||
uint8_t sname[64];
|
||||
|
@ -362,6 +363,8 @@ static void test_option_set(void) {
|
|||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
test_invalid_buffer_length();
|
||||
test_message_init();
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#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)
|
||||
|
@ -221,6 +222,8 @@ int main(int argc, char *argv[]) {
|
|||
pid_t pid;
|
||||
int r;
|
||||
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (streq(argv[i], "chart")) {
|
||||
mode = MODE_CHART;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "log.h"
|
||||
#include "macro.h"
|
||||
#include "strv.h"
|
||||
#include "tests.h"
|
||||
|
||||
struct context {
|
||||
int fds[2];
|
||||
|
@ -646,6 +647,8 @@ int main(int argc, char *argv[]) {
|
|||
void *p;
|
||||
int r, q;
|
||||
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
c.automatic_integer_property = 4711;
|
||||
assert_se(c.automatic_string_property = strdup("dudeldu"));
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "macro.h"
|
||||
#include "memory-util.h"
|
||||
#include "string-util.h"
|
||||
#include "tests.h"
|
||||
|
||||
struct context {
|
||||
int fds[2];
|
||||
|
@ -157,6 +158,8 @@ static int test_one(bool client_negotiate_unix_fds, bool server_negotiate_unix_f
|
|||
int main(int argc, char *argv[]) {
|
||||
int r;
|
||||
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
r = test_one(true, true, false, false);
|
||||
assert_se(r >= 0);
|
||||
|
||||
|
|
|
@ -4,11 +4,14 @@
|
|||
#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));
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "fd-util.h"
|
||||
#include "macro.h"
|
||||
#include "mmap-cache.h"
|
||||
#include "tests.h"
|
||||
#include "tmpfile-util.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
@ -17,6 +18,8 @@ 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);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#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)
|
||||
|
@ -67,6 +68,8 @@ int main(int argc, char *argv[]) {
|
|||
.in.sin_port = htobe16(80),
|
||||
};
|
||||
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
assert_se(sd_resolve_default(&resolve) >= 0);
|
||||
|
||||
/* Test a floating resolver query */
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#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;
|
||||
|
@ -57,6 +58,8 @@ int main(int argc, char *argv[]) {
|
|||
int fd1, fd2;
|
||||
int r;
|
||||
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
r = sd_bus_open_system(&bus);
|
||||
assert_se(r >= 0);
|
||||
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
#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);
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
|
||||
#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);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#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 = {};
|
||||
|
@ -63,6 +64,8 @@ static void test_link_one(const char *filename, const char *key, const char *val
|
|||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
test_network_one("", "ip", "dhcp6",
|
||||
"[Match]\n"
|
||||
"Kind=!*\n"
|
||||
|
|
|
@ -12,9 +12,12 @@
|
|||
#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);
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
|
||||
#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);
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ int main(int argc, char **argv) {
|
|||
_cleanup_globfree_ glob_t g = {};
|
||||
char **fnames;
|
||||
|
||||
log_parse_environment();
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
if (argc >= 2) {
|
||||
N = argc - 1;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#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) {
|
||||
|
@ -105,6 +106,8 @@ int main(int argc, char* argv[]) {
|
|||
* 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 */
|
||||
|
|
|
@ -4,10 +4,13 @@
|
|||
#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);
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
/* 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);
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#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;
|
||||
|
@ -17,6 +18,8 @@ int main(int argc, char *argv[]) {
|
|||
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]);
|
||||
|
|
|
@ -10,11 +10,14 @@
|
|||
#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");
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "fd-util.h"
|
||||
#include "log.h"
|
||||
#include "main-func.h"
|
||||
#include "tests.h"
|
||||
|
||||
static char *arg_root = NULL;
|
||||
static int arg_flags = 0;
|
||||
|
@ -84,7 +85,7 @@ static int parse_argv(int argc, char *argv[]) {
|
|||
static int run(int argc, char **argv) {
|
||||
int r;
|
||||
|
||||
log_setup();
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
r = parse_argv(argc, argv);
|
||||
if (r <= 0)
|
||||
|
|
|
@ -7,12 +7,15 @@
|
|||
#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;
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@ int main(int argc, char *argv[]) {
|
|||
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)");
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#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;
|
||||
|
|
|
@ -3,11 +3,14 @@
|
|||
#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 = {
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
|
||||
#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);
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#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));
|
||||
|
@ -204,6 +205,8 @@ static void test_log_prefix(void) {
|
|||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
test_file();
|
||||
|
||||
assert_se(log_info_errno(SYNTHETIC_ERRNO(EUCLEAN), "foo") == -EUCLEAN);
|
||||
|
|
|
@ -14,8 +14,7 @@ int main(int argc, char *argv[]) {
|
|||
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));
|
||||
|
|
|
@ -33,12 +33,15 @@
|
|||
#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);
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "json.h"
|
||||
#include "rm-rf.h"
|
||||
#include "strv.h"
|
||||
#include "tests.h"
|
||||
#include "tmpfile-util.h"
|
||||
#include "user-util.h"
|
||||
#include "varlink.h"
|
||||
|
@ -330,8 +331,7 @@ int main(int argc, char *argv[]) {
|
|||
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");
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "alloc-util.h"
|
||||
#include "string-util.h"
|
||||
#include "tests.h"
|
||||
#include "xml.h"
|
||||
|
||||
static void test_one(const char *data, ...) {
|
||||
|
@ -36,6 +37,8 @@ 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>",
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
|
||||
#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;
|
||||
|
|
Loading…
Reference in a new issue