daandemeyer / rpms / systemd

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