summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDeepak Kodihalli <dkodihal@in.ibm.com>2019-01-11 03:47:25 -0600
committerDeepak Kodihalli <dkodihal@in.ibm.com>2019-01-11 06:53:33 -0600
commite165ea956c5557c2b470869d252c80744227b00f (patch)
tree3cf4331915cf21ac40ce4ea0e5c1f8560ab4d609 /test
parent3f9cb09427ddb0d4e885db2f81da65b724e0285e (diff)
downloadphosphor-logging-e165ea956c5557c2b470869d252c80744227b00f.tar.gz
phosphor-logging-e165ea956c5557c2b470869d252c80744227b00f.zip
rsyslogd: don't start without actions
Rsyslog is currently used only for remote logging. The daemon would run though (started by systemd) even when remote logging has not been configured. In other words, it would run without any actions. With Yocto 2.6, rsyslogd won't run without any actions. Hence, rsyslogd is now started only on the condition that the remote logging config file is present. Change-Id: Iae11d6912e60765ecb774b663d44b4e3c6f381a3 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Diffstat (limited to 'test')
-rw-r--r--test/remote_logging_test_config.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/test/remote_logging_test_config.cpp b/test/remote_logging_test_config.cpp
index a4c6207..b34a43f 100644
--- a/test/remote_logging_test_config.cpp
+++ b/test/remote_logging_test_config.cpp
@@ -3,6 +3,19 @@
#include <fstream>
#include <string>
+#if __has_include(<filesystem>)
+#include <filesystem>
+#elif __has_include(<experimental/filesystem>)
+#include <experimental/filesystem>
+namespace std
+{
+// splice experimental::filesystem into std
+namespace filesystem = std::experimental::filesystem;
+} // namespace std
+#else
+#error filesystem not available
+#endif
+
namespace phosphor
{
namespace logging
@@ -21,13 +34,13 @@ std::string getConfig(const char* filePath)
TEST_F(TestRemoteLogging, testOnlyAddress)
{
config->address("1.1.1.1");
- EXPECT_EQ(getConfig(configFilePath.c_str()), "#*.* @@remote-host:port");
+ EXPECT_EQ(fs::exists(configFilePath.c_str()), false);
}
TEST_F(TestRemoteLogging, testOnlyPort)
{
config->port(100);
- EXPECT_EQ(getConfig(configFilePath.c_str()), "#*.* @@remote-host:port");
+ EXPECT_EQ(fs::exists(configFilePath.c_str()), false);
}
TEST_F(TestRemoteLogging, testGoodConfig)
@@ -43,7 +56,7 @@ TEST_F(TestRemoteLogging, testClearAddress)
config->port(100);
EXPECT_EQ(getConfig(configFilePath.c_str()), "*.* @@1.1.1.1:100");
config->address("");
- EXPECT_EQ(getConfig(configFilePath.c_str()), "#*.* @@remote-host:port");
+ EXPECT_EQ(fs::exists(configFilePath.c_str()), false);
}
TEST_F(TestRemoteLogging, testClearPort)
@@ -52,7 +65,7 @@ TEST_F(TestRemoteLogging, testClearPort)
config->port(100);
EXPECT_EQ(getConfig(configFilePath.c_str()), "*.* @@1.1.1.1:100");
config->port(0);
- EXPECT_EQ(getConfig(configFilePath.c_str()), "#*.* @@remote-host:port");
+ EXPECT_EQ(fs::exists(configFilePath.c_str()), false);
}
} // namespace test
OpenPOWER on IntegriCloud