clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.
See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.
Change-Id: I21d2ca8065f24fd73509229c517f5caf48934b60
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/test/openpower-pels/device_callouts_test.cpp b/test/openpower-pels/device_callouts_test.cpp
index e02360a..ec8e182 100644
--- a/test/openpower-pels/device_callouts_test.cpp
+++ b/test/openpower-pels/device_callouts_test.cpp
@@ -519,9 +519,9 @@
"slave@01:00/01:01:00:06/sbefifo2-dev0/occ-hwmon.2",
systemTypes);
- std::vector<Callout> expected{{"H", "P1-C19",
- "/chassis/motherboard/cpu0", "core",
- "FSI: links: 0-1 dest: proc-0 target"}};
+ std::vector<Callout> expected{
+ {"H", "P1-C19", "/chassis/motherboard/cpu0", "core",
+ "FSI: links: 0-1 dest: proc-0 target"}};
EXPECT_EQ(callouts, expected);
diff --git a/test/openpower-pels/failing_mtms_test.cpp b/test/openpower-pels/failing_mtms_test.cpp
index e377482..68355e2 100644
--- a/test/openpower-pels/failing_mtms_test.cpp
+++ b/test/openpower-pels/failing_mtms_test.cpp
@@ -84,10 +84,10 @@
TEST(FailingMTMSTest, StreamConstructorTest)
{
- std::vector<uint8_t> data{0x4D, 0x54, 0x00, 0x1C, 0x01, 0x00, 0x20,
- 0x00, 'T', 'T', 'T', 'T', '-', 'M',
- 'M', 'M', '1', '2', '3', '4', '5',
- '6', '7', '8', '9', 'A', 'B', 'C'};
+ std::vector<uint8_t> data{
+ 0x4D, 0x54, 0x00, 0x1C, 0x01, 0x00, 0x20, 0x00, 'T', 'T',
+ 'T', 'T', '-', 'M', 'M', 'M', '1', '2', '3', '4',
+ '5', '6', '7', '8', '9', 'A', 'B', 'C'};
Stream stream{data};
FailingMTMS fm{stream};
@@ -117,10 +117,10 @@
TEST(FailingMTMSTest, FlattenTest)
{
- std::vector<uint8_t> data{0x4D, 0x54, 0x00, 0x1C, 0x01, 0x00, 0x20,
- 0x00, 'T', 'T', 'T', 'T', '-', 'M',
- 'M', 'M', '1', '2', '3', '4', '5',
- '6', '7', '8', '9', 'A', 'B', 'C'};
+ std::vector<uint8_t> data{
+ 0x4D, 0x54, 0x00, 0x1C, 0x01, 0x00, 0x20, 0x00, 'T', 'T',
+ 'T', 'T', '-', 'M', 'M', 'M', '1', '2', '3', '4',
+ '5', '6', '7', '8', '9', 'A', 'B', 'C'};
Stream stream{data};
FailingMTMS fm{stream};
diff --git a/test/openpower-pels/host_notifier_test.cpp b/test/openpower-pels/host_notifier_test.cpp
index 121254c..8e7380e 100644
--- a/test/openpower-pels/host_notifier_test.cpp
+++ b/test/openpower-pels/host_notifier_test.cpp
@@ -47,8 +47,8 @@
ON_CALL(dataIface, getHostPELEnablement).WillByDefault(Return(true));
- hostIface = std::make_unique<NiceMock<MockHostInterface>>(event,
- dataIface);
+ hostIface =
+ std::make_unique<NiceMock<MockHostInterface>>(event, dataIface);
mockHostIface = reinterpret_cast<MockHostInterface*>(hostIface.get());
@@ -121,11 +121,11 @@
{
bool hostState = false;
bool called = false;
- DataInterfaceBase::HostStateChangeFunc func = [&hostState,
- &called](bool state) {
- hostState = state;
- called = true;
- };
+ DataInterfaceBase::HostStateChangeFunc func =
+ [&hostState, &called](bool state) {
+ hostState = state;
+ called = true;
+ };
dataIface.subscribeToHostStateChange("test", func);
diff --git a/test/openpower-pels/mocks.hpp b/test/openpower-pels/mocks.hpp
index 2e06627..dd9e3c1 100644
--- a/test/openpower-pels/mocks.hpp
+++ b/test/openpower-pels/mocks.hpp
@@ -202,10 +202,10 @@
int fd = open(_fifo.c_str(), O_NONBLOCK | O_RDWR);
EXPECT_TRUE(fd >= 0) << "Unable to open FIFO";
- auto callback = [this](sdeventplus::source::IO& source, int fd,
- uint32_t events) {
- this->receive(source, fd, events, nullptr);
- };
+ auto callback =
+ [this](sdeventplus::source::IO& source, int fd, uint32_t events) {
+ this->receive(source, fd, events, nullptr);
+ };
try
{
diff --git a/test/openpower-pels/pel_manager_test.cpp b/test/openpower-pels/pel_manager_test.cpp
index f1bc57a..3689bdf 100644
--- a/test/openpower-pels/pel_manager_test.cpp
+++ b/test/openpower-pels/pel_manager_test.cpp
@@ -392,11 +392,11 @@
std::unique_ptr<JournalBase> journal = std::make_unique<MockJournal>();
- Manager manager{logManager, std::move(dataIface),
- std::bind(std::mem_fn(&TestLogger::log), &logger,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3),
- std::move(journal)};
+ Manager manager{
+ logManager, std::move(dataIface),
+ std::bind(std::mem_fn(&TestLogger::log), &logger, std::placeholders::_1,
+ std::placeholders::_2, std::placeholders::_3),
+ std::move(journal)};
// Create a PEL, write it to a file, and pass that filename into
// the create function so there's one in the repo.
diff --git a/test/openpower-pels/pel_test.cpp b/test/openpower-pels/pel_test.cpp
index cf54e9c..8369b05 100644
--- a/test/openpower-pels/pel_test.cpp
+++ b/test/openpower-pels/pel_test.cpp
@@ -211,9 +211,10 @@
// in the registry, so the constructor should set them.
regEntry.actionFlags = std::nullopt;
- PEL pel2{
- regEntry, 42, timestamp, phosphor::logging::Entry::Level::Error,
- ad, ffdc, dataIface, journal};
+ PEL pel2{regEntry, 42,
+ timestamp, phosphor::logging::Entry::Level::Error,
+ ad, ffdc,
+ dataIface, journal};
EXPECT_EQ(pel2.userHeader().actionFlags(), 0xA800);
}
@@ -251,11 +252,11 @@
// Make sure that there are still 2 UD sections.
const auto& optSections = pel.optionalSections();
- auto udCount = std::count_if(optSections.begin(), optSections.end(),
- [](const auto& section) {
- return section->header().id ==
- static_cast<uint16_t>(SectionID::userData);
- });
+ auto udCount = std::count_if(
+ optSections.begin(), optSections.end(), [](const auto& section) {
+ return section->header().id ==
+ static_cast<uint16_t>(SectionID::userData);
+ });
EXPECT_EQ(udCount, 2); // AD section and sysInfo section
}
@@ -266,15 +267,15 @@
{
auto data = pelDataFactory(TestPELType::pelSimple);
- std::vector<uint8_t> section1{0x58, 0x58, // ID 'XX'
- 0x00, 0x18, // Size
- 0x01, 0x02, // version, subtype
- 0x03, 0x04, // comp ID
+ std::vector<uint8_t> section1{
+ 0x58, 0x58, // ID 'XX'
+ 0x00, 0x18, // Size
+ 0x01, 0x02, // version, subtype
+ 0x03, 0x04, // comp ID
- // some data
- 0x20, 0x30, 0x05, 0x09, 0x11, 0x1E, 0x1, 0x63,
- 0x20, 0x31, 0x06, 0x0F, 0x09, 0x22, 0x3A,
- 0x00};
+ // some data
+ 0x20, 0x30, 0x05, 0x09, 0x11, 0x1E, 0x1, 0x63, 0x20, 0x31, 0x06, 0x0F,
+ 0x09, 0x22, 0x3A, 0x00};
std::vector<uint8_t> section2{
0x59, 0x59, // ID 'YY'
@@ -848,10 +849,10 @@
.WillOnce(Return(std::vector<std::string>{
"/xyz/openbmc_project/inventory/chassis/motherboard/cpu0"}));
- EXPECT_CALL(
- dataIface,
- getHWCalloutFields(
- "/xyz/openbmc_project/inventory/chassis/motherboard/cpu0", _, _, _))
+ EXPECT_CALL(dataIface,
+ getHWCalloutFields(
+ "/xyz/openbmc_project/inventory/chassis/motherboard/cpu0",
+ _, _, _))
.WillOnce(DoAll(SetArgReferee<1>("1234567"), SetArgReferee<2>("CCCC"),
SetArgReferee<3>("123456789ABC")));
@@ -868,9 +869,10 @@
AdditionalData ad{data};
- PEL pel{
- regEntry, 42, timestamp, phosphor::logging::Entry::Level::Error,
- ad, ffdc, dataIface, journal};
+ PEL pel{regEntry, 42,
+ timestamp, phosphor::logging::Entry::Level::Error,
+ ad, ffdc,
+ dataIface, journal};
ASSERT_TRUE(pel.primarySRC().value()->callouts());
auto& callouts = pel.primarySRC().value()->callouts()->callouts();
@@ -918,9 +920,10 @@
AdditionalData ad{data};
- PEL pel{
- regEntry, 42, timestamp, phosphor::logging::Entry::Level::Error,
- ad, ffdc, dataIface, journal};
+ PEL pel{regEntry, 42,
+ timestamp, phosphor::logging::Entry::Level::Error,
+ ad, ffdc,
+ dataIface, journal};
// no callouts
EXPECT_FALSE(pel.primarySRC().value()->callouts());
@@ -1157,9 +1160,10 @@
EXPECT_CALL(journal, getMessages("", 5)).WillOnce(Return(msgs));
- PEL pel{
- regEntry, 42, timestamp, phosphor::logging::Entry::Level::Error,
- ad, ffdc, dataIface, journal};
+ PEL pel{regEntry, 42,
+ timestamp, phosphor::logging::Entry::Level::Error,
+ ad, ffdc,
+ dataIface, journal};
// Check the generated UserData section
std::string expected{"test1 test2\ntest3 test4\ntest5 test6\n4\n5\n"};
@@ -1183,9 +1187,10 @@
.WillOnce(
Return(std::vector<std::string>{std::string(20000, 'x')}));
- PEL pel{
- regEntry, 42, timestamp, phosphor::logging::Entry::Level::Error,
- ad, ffdc, dataIface, journal};
+ PEL pel{regEntry, 42,
+ timestamp, phosphor::logging::Entry::Level::Error,
+ ad, ffdc,
+ dataIface, journal};
// Check for 1 fewer sections than in the previous PEL
EXPECT_EQ(pel.privateHeader().sectionCount(), pelSectsWithOneUD - 1);
@@ -1214,9 +1219,10 @@
EXPECT_CALL(journal, getMessages("app2", 4)).WillOnce(Return(app2));
EXPECT_CALL(journal, getMessages("app3", 1)).WillOnce(Return(app3));
- PEL pel{
- regEntry, 42, timestamp, phosphor::logging::Entry::Level::Error,
- ad, ffdc, dataIface, journal};
+ PEL pel{regEntry, 42,
+ timestamp, phosphor::logging::Entry::Level::Error,
+ ad, ffdc,
+ dataIface, journal};
// Two more sections than the 1 extra UD section in the first testcase
ASSERT_EQ(pel.privateHeader().sectionCount(), pelSectsWithOneUD + 2);
@@ -1250,9 +1256,10 @@
.WillOnce(
Return(std::vector<std::string>{std::string(20000, 'x')}));
- PEL pel{
- regEntry, 42, timestamp, phosphor::logging::Entry::Level::Error,
- ad, ffdc, dataIface, journal};
+ PEL pel{regEntry, 42,
+ timestamp, phosphor::logging::Entry::Level::Error,
+ ad, ffdc,
+ dataIface, journal};
// The last section should have been dropped, so same as first TC
ASSERT_EQ(pel.privateHeader().sectionCount(), pelSectsWithOneUD);
diff --git a/test/openpower-pels/registry_test.cpp b/test/openpower-pels/registry_test.cpp
index 1646a49..ce17e9b 100644
--- a/test/openpower-pels/registry_test.cpp
+++ b/test/openpower-pels/registry_test.cpp
@@ -269,8 +269,8 @@
auto path = RegistryTest::writeData(registryData);
Registry registry{path};
- auto entry = registry.lookup("xyz.openbmc_project.Power.Fault",
- LookupType::name);
+ auto entry =
+ registry.lookup("xyz.openbmc_project.Power.Fault", LookupType::name);
ASSERT_TRUE(entry);
EXPECT_EQ(entry->name, "xyz.openbmc_project.Power.Fault");
EXPECT_EQ(entry->subsystem, 0x61);
@@ -407,8 +407,8 @@
using namespace openpower::pels::message::helper;
// Get it from the JSON
- auto id = getComponentID(0xBD, 0x4200, R"({"ComponentID":"0x4200"})"_json,
- "foo");
+ auto id =
+ getComponentID(0xBD, 0x4200, R"({"ComponentID":"0x4200"})"_json, "foo");
EXPECT_EQ(id, 0x4200);
// Get it from the reason code on a 0xBD SRC
diff --git a/test/openpower-pels/src_callout_test.cpp b/test/openpower-pels/src_callout_test.cpp
index a03b9b0..4f77bde 100644
--- a/test/openpower-pels/src_callout_test.cpp
+++ b/test/openpower-pels/src_callout_test.cpp
@@ -284,9 +284,9 @@
Callout callout{CalloutPriority::high, "U99-P5", "1234567", "ABCD",
"123456789ABC", mruList};
- EXPECT_EQ(callout.flags(), Callout::calloutType |
- Callout::fruIdentIncluded |
- Callout::mruIncluded);
+ EXPECT_EQ(callout.flags(),
+ Callout::calloutType | Callout::fruIdentIncluded |
+ Callout::mruIncluded);
EXPECT_EQ(callout.priority(), 'H');
EXPECT_EQ(callout.locationCode(), "U99-P5");
diff --git a/test/openpower-pels/src_test.cpp b/test/openpower-pels/src_test.cpp
index 4a85bee..2fb8770 100644
--- a/test/openpower-pels/src_test.cpp
+++ b/test/openpower-pels/src_test.cpp
@@ -624,9 +624,9 @@
"/xyz/openbmc_project/inventory/chassis/motherboard/cpu0", _, _,
_))
.Times(1)
- .WillOnce(DoAll(SetArgReferee<1>("1234567"),
- SetArgReferee<2>("CCCC"),
- SetArgReferee<3>("123456789ABC")));
+ .WillOnce(
+ DoAll(SetArgReferee<1>("1234567"), SetArgReferee<2>("CCCC"),
+ SetArgReferee<3>("123456789ABC")));
EXPECT_CALL(
dataIface,
@@ -634,9 +634,9 @@
"/xyz/openbmc_project/inventory/chassis/motherboard/cpu1", _, _,
_))
.Times(1)
- .WillOnce(DoAll(SetArgReferee<1>("2345678"),
- SetArgReferee<2>("DDDD"),
- SetArgReferee<3>("23456789ABCD")));
+ .WillOnce(
+ DoAll(SetArgReferee<1>("2345678"), SetArgReferee<2>("DDDD"),
+ SetArgReferee<3>("23456789ABCD")));
SRC src{entry, ad, dataIface};
@@ -843,30 +843,30 @@
.Times(3)
.WillRepeatedly(Return("Ufcs-P1-C15"));
- EXPECT_CALL(
- dataIface,
- getHWCalloutFields(
- "/xyz/openbmc_project/inventory/chassis/motherboard/cpu0", _, _, _))
+ EXPECT_CALL(dataIface,
+ getHWCalloutFields(
+ "/xyz/openbmc_project/inventory/chassis/motherboard/cpu0",
+ _, _, _))
.Times(3)
- .WillRepeatedly(DoAll(SetArgReferee<1>("1234567"),
- SetArgReferee<2>("CCCC"),
- SetArgReferee<3>("123456789ABC")));
+ .WillRepeatedly(
+ DoAll(SetArgReferee<1>("1234567"), SetArgReferee<2>("CCCC"),
+ SetArgReferee<3>("123456789ABC")));
EXPECT_CALL(
dataIface,
getHWCalloutFields("/xyz/openbmc_project/inventory/chassis/motherboard",
_, _, _))
.Times(3)
- .WillRepeatedly(DoAll(SetArgReferee<1>("7654321"),
- SetArgReferee<2>("MMMM"),
- SetArgReferee<3>("CBA987654321")));
- EXPECT_CALL(
- dataIface,
- getHWCalloutFields(
- "/xyz/openbmc_project/inventory/chassis/motherboard/bmc", _, _, _))
+ .WillRepeatedly(
+ DoAll(SetArgReferee<1>("7654321"), SetArgReferee<2>("MMMM"),
+ SetArgReferee<3>("CBA987654321")));
+ EXPECT_CALL(dataIface,
+ getHWCalloutFields(
+ "/xyz/openbmc_project/inventory/chassis/motherboard/bmc", _,
+ _, _))
.Times(3)
- .WillRepeatedly(DoAll(SetArgReferee<1>("7123456"),
- SetArgReferee<2>("BBBB"),
- SetArgReferee<3>("C123456789AB")));
+ .WillRepeatedly(
+ DoAll(SetArgReferee<1>("7123456"), SetArgReferee<2>("BBBB"),
+ SetArgReferee<3>("C123456789AB")));
// Call this below with different AdditionalData values that
// result in the same callouts.
@@ -1042,9 +1042,9 @@
dataIface,
getHWCalloutFields("/inv/system/chassis/motherboard/bmc", _, _, _))
.Times(1)
- .WillOnce(DoAll(SetArgReferee<1>("1234567"),
- SetArgReferee<2>("CCCC"),
- SetArgReferee<3>("123456789ABC")));
+ .WillOnce(
+ DoAll(SetArgReferee<1>("1234567"), SetArgReferee<2>("CCCC"),
+ SetArgReferee<3>("123456789ABC")));
}
// Callout 1 mock calls
{
@@ -1055,9 +1055,9 @@
dataIface,
getHWCalloutFields("/inv/system/chassis/motherboard/cpu0", _, _, _))
.Times(1)
- .WillOnce(DoAll(SetArgReferee<1>("2345678"),
- SetArgReferee<2>("DDDD"),
- SetArgReferee<3>("23456789ABCD")));
+ .WillOnce(
+ DoAll(SetArgReferee<1>("2345678"), SetArgReferee<2>("DDDD"),
+ SetArgReferee<3>("23456789ABCD")));
}
// Callout 3 mock calls
{
@@ -1230,9 +1230,9 @@
dataIface,
getHWCalloutFields("/inv/system/chassis/motherboard/bmc", _, _, _))
.Times(1)
- .WillOnce(DoAll(SetArgReferee<1>("1234567"),
- SetArgReferee<2>("CCCC"),
- SetArgReferee<3>("123456789ABC")));
+ .WillOnce(
+ DoAll(SetArgReferee<1>("1234567"), SetArgReferee<2>("CCCC"),
+ SetArgReferee<3>("123456789ABC")));
}
// Callout 1 mock calls
diff --git a/test/openpower-pels/user_data_test.cpp b/test/openpower-pels/user_data_test.cpp
index 863d36a..9aae466 100644
--- a/test/openpower-pels/user_data_test.cpp
+++ b/test/openpower-pels/user_data_test.cpp
@@ -20,14 +20,14 @@
using namespace openpower::pels;
-std::vector<uint8_t> udSectionData{0x55, 0x44, // ID 'UD'
- 0x00, 0x10, // Size
- 0x01, 0x02, // version, subtype
- 0x03, 0x04, // comp ID
+std::vector<uint8_t> udSectionData{
+ 0x55, 0x44, // ID 'UD'
+ 0x00, 0x10, // Size
+ 0x01, 0x02, // version, subtype
+ 0x03, 0x04, // comp ID
- // Data
- 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18};
+ // Data
+ 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18};
TEST(UserDataTest, UnflattenFlattenTest)
{