richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
36e8a3
From ab6a1bdf3519d4344dee4e0225c74fc1198c8a60 Mon Sep 17 00:00:00 2001
36e8a3
From: Michal Sekletar <msekleta@redhat.com>
36e8a3
Date: Mon, 15 Oct 2018 10:54:11 +0000
36e8a3
Subject: [PATCH] tests: backport test_setup_logging()
36e8a3
36e8a3
Related: #1635428
36e8a3
---
36e8a3
 src/shared/tests.c | 6 ++++++
36e8a3
 src/shared/tests.h | 1 +
36e8a3
 2 files changed, 7 insertions(+)
36e8a3
36e8a3
diff --git a/src/shared/tests.c b/src/shared/tests.c
4bff0a
index 6b3df0aa07..b10343650f 100644
36e8a3
--- a/src/shared/tests.c
36e8a3
+++ b/src/shared/tests.c
36e8a3
@@ -54,3 +54,9 @@ const char* get_testdata_dir(const char *suffix) {
36e8a3
         strncpy(testdir + strlen(testdir), suffix, sizeof(testdir) - strlen(testdir) - 1);
36e8a3
         return testdir;
36e8a3
 }
36e8a3
+
36e8a3
+void test_setup_logging(int level) {
36e8a3
+        log_set_max_level(level);
36e8a3
+        log_parse_environment();
36e8a3
+        log_open();
36e8a3
+}
36e8a3
diff --git a/src/shared/tests.h b/src/shared/tests.h
4bff0a
index b88135ed93..cad21169f8 100644
36e8a3
--- a/src/shared/tests.h
36e8a3
+++ b/src/shared/tests.h
36e8a3
@@ -3,3 +3,4 @@
36e8a3
 
36e8a3
 char* setup_fake_runtime_dir(void);
36e8a3
 const char* get_testdata_dir(const char *suffix);
36e8a3
+void test_setup_logging(int level);