add .clang-format
Change-Id: I2c36b7886a25d0b235693b0776019d29608e1d52
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/test/elog_errorwrap_test.cpp b/test/elog_errorwrap_test.cpp
index f341447..c94c638 100644
--- a/test/elog_errorwrap_test.cpp
+++ b/test/elog_errorwrap_test.cpp
@@ -16,7 +16,7 @@
// Max num of Info( and below Sev) errors can be created is qual to
// ERROR_INFO_CAP
- EXPECT_EQ(ERROR_INFO_CAP , manager.getInfoErrSize());
+ EXPECT_EQ(ERROR_INFO_CAP, manager.getInfoErrSize());
for (auto i = 0; i < ERROR_CAP + 20; i++)
{
@@ -24,9 +24,8 @@
}
// Max num of high severity errors can be created is qual to ERROR_CAP
EXPECT_EQ(ERROR_CAP, manager.getRealErrSize());
-
}
-}// namespace internal
-}// namespace logging
-}// namespace phosphor
+} // namespace internal
+} // namespace logging
+} // namespace phosphor
diff --git a/test/elog_errorwrap_test.hpp b/test/elog_errorwrap_test.hpp
index 7c673b6..537a7ff 100644
--- a/test/elog_errorwrap_test.hpp
+++ b/test/elog_errorwrap_test.hpp
@@ -1,14 +1,17 @@
+#include "config.h"
+
+#include "elog_serialize.hpp"
#include "log_manager.hpp"
#include "xyz/openbmc_project/Common/error.hpp"
-#include <gtest/gtest.h>
-#include <gmock/gmock.h>
-#include <sdbusplus/bus.hpp>
+
#include <experimental/filesystem>
+#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
-#include <phosphor-logging/elog-errors.hpp>
-#include "elog_serialize.hpp"
-#include "config.h"
+#include <sdbusplus/bus.hpp>
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
namespace phosphor
{
@@ -21,30 +24,24 @@
class journalInterface
{
- public:
- virtual void journalSync() = 0;
- virtual int sd_journal_open(sd_journal** j, int k) = 0;
- virtual int sd_journal_get_data(sd_journal* j,
- const char* transactionIdVar,
- const void** data,
- size_t length) = 0;
- virtual void sd_journal_close(sd_journal* j) = 0;
+ public:
+ virtual void journalSync() = 0;
+ virtual int sd_journal_open(sd_journal** j, int k) = 0;
+ virtual int sd_journal_get_data(sd_journal* j, const char* transactionIdVar,
+ const void** data, size_t length) = 0;
+ virtual void sd_journal_close(sd_journal* j) = 0;
};
class journalImpl : public journalInterface
{
- public:
- void journalSync();
- int sd_journal_open(sd_journal** j, int k);
- int sd_journal_get_data(sd_journal* j,
- const char* transactionIdVar,
- const void** data,
- size_t length);
- void sd_journal_close(sd_journal* j);
+ public:
+ void journalSync();
+ int sd_journal_open(sd_journal** j, int k);
+ int sd_journal_get_data(sd_journal* j, const char* transactionIdVar,
+ const void** data, size_t length);
+ void sd_journal_close(sd_journal* j);
};
-
-
int journalImpl::sd_journal_open(sd_journal** j, int k)
{
return 1;
@@ -57,8 +54,7 @@
int journalImpl::sd_journal_get_data(sd_journal* j,
const char* transactionIdVar,
- const void** data,
- size_t length)
+ const void** data, size_t length)
{
return 1;
}
@@ -68,42 +64,36 @@
return;
}
-
-class MockJournal : public Manager
+class MockJournal : public Manager
{
- public:
- MockJournal(sdbusplus::bus::bus& bus,
- const char* objPath): Manager(bus, objPath) {};
- MOCK_METHOD0(journalSync, void());
- MOCK_METHOD2(sd_journal_open, int(sd_journal**, int));
- MOCK_METHOD4(sd_journal_get_data, int(sd_journal*,
- const char*,
- const void**, size_t));
- MOCK_METHOD1(sd_journal_close, void(sd_journal*));
+ public:
+ MockJournal(sdbusplus::bus::bus& bus, const char* objPath) :
+ Manager(bus, objPath){};
+ MOCK_METHOD0(journalSync, void());
+ MOCK_METHOD2(sd_journal_open, int(sd_journal**, int));
+ MOCK_METHOD4(sd_journal_get_data,
+ int(sd_journal*, const char*, const void**, size_t));
+ MOCK_METHOD1(sd_journal_close, void(sd_journal*));
};
-
-
class TestLogManager : public testing::Test
{
- public:
- sdbusplus::bus::bus bus;
- MockJournal manager;
- TestLogManager()
- : bus(sdbusplus::bus::new_default()),
- manager(bus, "/xyz/openbmc_test/abc")
- {
- fs::create_directories(ERRLOG_PERSIST_PATH);
- }
+ public:
+ sdbusplus::bus::bus bus;
+ MockJournal manager;
+ TestLogManager() :
+ bus(sdbusplus::bus::new_default()),
+ manager(bus, "/xyz/openbmc_test/abc")
+ {
+ fs::create_directories(ERRLOG_PERSIST_PATH);
+ }
- ~TestLogManager()
- {
- fs::remove_all(ERRLOG_PERSIST_PATH);
- }
-
+ ~TestLogManager()
+ {
+ fs::remove_all(ERRLOG_PERSIST_PATH);
+ }
};
-
-}// nmaespace internal
-}// namespace logging
-}// namespace phosphor
+} // namespace internal
+} // namespace logging
+} // namespace phosphor
diff --git a/test/remote_logging_test_address.cpp b/test/remote_logging_test_address.cpp
index 1291a2e..5c8794e 100644
--- a/test/remote_logging_test_address.cpp
+++ b/test/remote_logging_test_address.cpp
@@ -21,6 +21,6 @@
EXPECT_THROW(config->address("not_an_IP"), InvalidArgument);
}
-}// namespace test
-}// namespace logging
-}// namespace phosphor
+} // namespace test
+} // namespace logging
+} // namespace phosphor
diff --git a/test/remote_logging_test_config.cpp b/test/remote_logging_test_config.cpp
index 8c3a98a..59feedd 100644
--- a/test/remote_logging_test_config.cpp
+++ b/test/remote_logging_test_config.cpp
@@ -1,4 +1,5 @@
#include "remote_logging_tests.hpp"
+
#include <fstream>
namespace phosphor
@@ -53,6 +54,6 @@
EXPECT_EQ(getConfig(configFilePath.c_str()), "#*.* @@remote-host:port");
}
-}// namespace test
-}// namespace logging
-}// namespace phosphor
+} // namespace test
+} // namespace logging
+} // namespace phosphor
diff --git a/test/remote_logging_test_port.cpp b/test/remote_logging_test_port.cpp
index a9d3bc3..cf1a42e 100644
--- a/test/remote_logging_test_port.cpp
+++ b/test/remote_logging_test_port.cpp
@@ -13,6 +13,6 @@
EXPECT_EQ(config->port(), 100);
}
-}// namespace test
-}// namespace logging
-}// namespace phosphor
+} // namespace test
+} // namespace logging
+} // namespace phosphor
diff --git a/test/remote_logging_tests.hpp b/test/remote_logging_tests.hpp
index 3606f5a..936e3bb 100644
--- a/test/remote_logging_tests.hpp
+++ b/test/remote_logging_tests.hpp
@@ -1,9 +1,12 @@
-#include <gtest/gtest.h>
+#include "config.h"
+
+#include "phosphor-rsyslog-config/server-conf.hpp"
+
#include <experimental/filesystem>
#include <sdbusplus/bus.hpp>
-#include "config.h"
-#include "phosphor-rsyslog-config/server-conf.hpp"
+
#include "gmock/gmock.h"
+#include <gtest/gtest.h>
namespace phosphor
{
@@ -20,45 +23,40 @@
class MockServer : public phosphor::rsyslog_config::Server
{
- public:
- MockServer(sdbusplus::bus::bus& bus,
- const std::string& path,
+ public:
+ MockServer(sdbusplus::bus::bus& bus, const std::string& path,
const char* filePath) :
- phosphor::rsyslog_config::Server(bus, path, filePath)
- {
- }
+ phosphor::rsyslog_config::Server(bus, path, filePath)
+ {
+ }
- MOCK_METHOD0(restart, void());
+ MOCK_METHOD0(restart, void());
};
class TestRemoteLogging : public testing::Test
{
- public:
- TestRemoteLogging()
- {
- configFilePath = std::string(dir.c_str()) + "/server.conf";
- config =
- new MockServer(bus,
- BUSPATH_REMOTE_LOGGING_CONFIG,
- configFilePath.c_str());
- }
+ public:
+ TestRemoteLogging()
+ {
+ configFilePath = std::string(dir.c_str()) + "/server.conf";
+ config = new MockServer(bus, BUSPATH_REMOTE_LOGGING_CONFIG,
+ configFilePath.c_str());
+ }
- ~TestRemoteLogging()
- {
- delete config;
- }
+ ~TestRemoteLogging()
+ {
+ delete config;
+ }
- static void TearDownTestCase()
- {
- fs::remove_all(dir);
- }
+ static void TearDownTestCase()
+ {
+ fs::remove_all(dir);
+ }
- MockServer* config;
- std::string configFilePath;
+ MockServer* config;
+ std::string configFilePath;
};
} // namespace test
} // namespace logging
} // namespace phosphor
-
-
diff --git a/test/serialization_test_path.cpp b/test/serialization_test_path.cpp
index 50e7d08..379b124 100644
--- a/test/serialization_test_path.cpp
+++ b/test/serialization_test_path.cpp
@@ -1,6 +1,6 @@
-#include "serialization_tests.hpp"
#include "elog_entry.hpp"
#include "elog_serialize.hpp"
+#include "serialization_tests.hpp"
namespace phosphor
{
@@ -13,10 +13,7 @@
{
auto id = 99;
auto e = std::make_unique<Entry>(
- bus,
- std::string(OBJ_ENTRY) + '/' + std::to_string(id),
- id,
- manager);
+ bus, std::string(OBJ_ENTRY) + '/' + std::to_string(id), id, manager);
auto path = serialize(*e, TestSerialization::dir);
EXPECT_EQ(path.c_str(), TestSerialization::dir / std::to_string(id));
}
@@ -24,5 +21,3 @@
} // namespace test
} // namespace logging
} // namespace phosphor
-
-
diff --git a/test/serialization_test_properties.cpp b/test/serialization_test_properties.cpp
index be9a7c7..8c92024 100644
--- a/test/serialization_test_properties.cpp
+++ b/test/serialization_test_properties.cpp
@@ -1,6 +1,6 @@
-#include "serialization_tests.hpp"
#include "elog_entry.hpp"
#include "elog_serialize.hpp"
+#include "serialization_tests.hpp"
namespace phosphor
{
@@ -18,25 +18,15 @@
std::string message{"test error"};
std::string fwLevel{"level42"};
auto input = std::make_unique<Entry>(
- bus,
- std::string(OBJ_ENTRY) + '/' + std::to_string(id),
- id,
- timestamp,
- Entry::Level::Informational,
- std::move(message),
- std::move(testData),
- std::move(assocations),
- fwLevel,
- manager);
+ bus, std::string(OBJ_ENTRY) + '/' + std::to_string(id), id, timestamp,
+ Entry::Level::Informational, std::move(message), std::move(testData),
+ std::move(assocations), fwLevel, manager);
auto path = serialize(*input, TestSerialization::dir);
auto idStr = path.filename().c_str();
id = std::stol(idStr);
auto output = std::make_unique<Entry>(
- bus,
- std::string(OBJ_ENTRY) + '/' + idStr,
- id,
- manager);
+ bus, std::string(OBJ_ENTRY) + '/' + idStr, id, manager);
deserialize(path, *output);
EXPECT_EQ(input->id(), output->id());
@@ -53,5 +43,3 @@
} // namespace test
} // namespace logging
} // namespace phosphor
-
-
diff --git a/test/serialization_tests.hpp b/test/serialization_tests.hpp
index a8054d3..6e41379 100644
--- a/test/serialization_tests.hpp
+++ b/test/serialization_tests.hpp
@@ -1,10 +1,14 @@
-#include <gtest/gtest.h>
-#include <experimental/filesystem>
-#include <stdlib.h>
-#include <sdbusplus/bus.hpp>
-#include "log_manager.hpp"
#include "config.h"
+#include "log_manager.hpp"
+
+#include <stdlib.h>
+
+#include <experimental/filesystem>
+#include <sdbusplus/bus.hpp>
+
+#include <gtest/gtest.h>
+
namespace phosphor
{
namespace logging
@@ -20,22 +24,19 @@
class TestSerialization : public testing::Test
{
- public:
- TestSerialization() :
- dir(fs::path(mkdtemp(tmplt)))
- {
- }
+ public:
+ TestSerialization() : dir(fs::path(mkdtemp(tmplt)))
+ {
+ }
- ~TestSerialization()
- {
- fs::remove_all(dir);
- }
+ ~TestSerialization()
+ {
+ fs::remove_all(dir);
+ }
- fs::path dir;
+ fs::path dir;
};
} // namespace test
} // namespace logging
} // namespace phosphor
-
-