manager: explicitly pass deferSignal
Explicitly pass the deferSignal parameter to the dbus bindings to enable
creating objects without emitting signals.
The patch does not introduce any functional change - only future
capability; the dbus binding argument is defaulted to emit a signal
(deferSignal = false) and that logic is preserved - moved from the
binding call site to higher up the call stack (updateInterfaces).
A careful observer may notice this patch highlights that interfaces are
constructed with the map-of-properties constructor with signals enabled.
This is arguably a bug in the bindings - it would never make sense to
construct an interface in this fashion and send PropertiesChanged
signals while the interface is in the process of being constructed.
This patch retains the current broken behavior, with a fix to be
provided in a later patch.
Change-Id: I0d9ef93651595b751e96cae07d9f1095770c05a6
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/test/interface_ops_test.cpp b/test/interface_ops_test.cpp
index 68c5e95..a308a55 100644
--- a/test/interface_ops_test.cpp
+++ b/test/interface_ops_test.cpp
@@ -33,10 +33,10 @@
MockInterface& operator=(MockInterface&&) = delete;
// We'll be getting calls proxyed through other objects.
- MOCK_METHOD2(constructWithProperties,
- void(const char*, const InterfaceVariant& i));
+ MOCK_METHOD3(constructWithProperties,
+ void(const char*, const InterfaceVariant& i, bool));
MOCK_METHOD1(constructWithoutProperties, void(const char*));
- MOCK_METHOD2(setPropertyByName, void(std::string, FakeVariantType));
+ MOCK_METHOD3(setPropertyByName, void(std::string, FakeVariantType, bool));
MOCK_METHOD2(serializeTwoArgs,
void(const std::string&, const std::string&));
@@ -63,14 +63,15 @@
using PropertiesVariant = FakeVariantType;
DummyInterfaceWithProperties(sdbusplus::bus::bus&, const char* name,
- const InterfaceVariant& i)
+ const InterfaceVariant& i, bool skipSignal)
{
- g_currentMock->constructWithProperties(name, i);
+ g_currentMock->constructWithProperties(name, i, skipSignal);
}
- void setPropertyByName(std::string name, PropertiesVariant val)
+ void setPropertyByName(std::string name, PropertiesVariant val,
+ bool skipSignal)
{
- g_currentMock->setPropertyByName(name, val);
+ g_currentMock->setPropertyByName(name, val, skipSignal);
}
};
@@ -116,10 +117,11 @@
sdbusplus::SdBusMock interface;
EXPECT_CALL(mock, constructWithoutProperties("foo")).Times(1);
- EXPECT_CALL(mock, constructWithProperties(_, _)).Times(0);
+ EXPECT_CALL(mock, constructWithProperties(_, _, _)).Times(0);
auto b = sdbusplus::get_mocked_new(&interface);
- auto r = MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i);
+ auto r =
+ MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
EXPECT_NO_THROW(
std::any_cast<std::shared_ptr<DummyInterfaceWithoutProperties>>(r));
@@ -132,10 +134,11 @@
sdbusplus::SdBusMock interface;
EXPECT_CALL(mock, constructWithoutProperties("foo")).Times(1);
- EXPECT_CALL(mock, constructWithProperties(_, _)).Times(0);
+ EXPECT_CALL(mock, constructWithProperties(_, _, _)).Times(0);
auto b = sdbusplus::get_mocked_new(&interface);
- auto r = MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i);
+ auto r =
+ MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
EXPECT_NO_THROW(
std::any_cast<std::shared_ptr<DummyInterfaceWithoutProperties>>(r));
@@ -148,10 +151,11 @@
sdbusplus::SdBusMock interface;
EXPECT_CALL(mock, constructWithoutProperties(_)).Times(0);
- EXPECT_CALL(mock, constructWithProperties("bar", _)).Times(1);
+ EXPECT_CALL(mock, constructWithProperties("bar", _, _)).Times(1);
auto b = sdbusplus::get_mocked_new(&interface);
- auto r = MakeInterface<DummyInterfaceWithProperties>::op(b, "bar", i);
+ auto r =
+ MakeInterface<DummyInterfaceWithProperties>::op(b, "bar", i, false);
EXPECT_NO_THROW(
std::any_cast<std::shared_ptr<DummyInterfaceWithProperties>>(r));
@@ -164,10 +168,11 @@
sdbusplus::SdBusMock interface;
EXPECT_CALL(mock, constructWithoutProperties(_)).Times(0);
- EXPECT_CALL(mock, constructWithProperties("foo", _)).Times(1);
+ EXPECT_CALL(mock, constructWithProperties("foo", _, _)).Times(1);
auto b = sdbusplus::get_mocked_new(&interface);
- auto r = MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i);
+ auto r =
+ MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i, false);
EXPECT_NO_THROW(
std::any_cast<std::shared_ptr<DummyInterfaceWithProperties>>(r));
@@ -179,12 +184,13 @@
Interface i;
sdbusplus::SdBusMock interface;
- EXPECT_CALL(mock, setPropertyByName(_, _)).Times(0);
+ EXPECT_CALL(mock, setPropertyByName(_, _, _)).Times(0);
auto b = sdbusplus::get_mocked_new(&interface);
- auto r = MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i);
+ auto r =
+ MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
- AssignInterface<DummyInterfaceWithoutProperties>::op(i, r);
+ AssignInterface<DummyInterfaceWithoutProperties>::op(i, r, false);
}
TEST(InterfaceOpsTest, TestAssignPropertylessInterfaceWithOneArgument)
@@ -193,12 +199,13 @@
Interface i{{"foo"s, static_cast<int64_t>(1ll)}};
sdbusplus::SdBusMock interface;
- EXPECT_CALL(mock, setPropertyByName(_, _)).Times(0);
+ EXPECT_CALL(mock, setPropertyByName(_, _, _)).Times(0);
auto b = sdbusplus::get_mocked_new(&interface);
- auto r = MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i);
+ auto r =
+ MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
- AssignInterface<DummyInterfaceWithoutProperties>::op(i, r);
+ AssignInterface<DummyInterfaceWithoutProperties>::op(i, r, false);
}
TEST(InterfaceOpsTest, TestAssignInterfaceWithoutArguments)
@@ -207,12 +214,13 @@
Interface i;
sdbusplus::SdBusMock interface;
- EXPECT_CALL(mock, setPropertyByName(_, _)).Times(0);
+ EXPECT_CALL(mock, setPropertyByName(_, _, _)).Times(0);
auto b = sdbusplus::get_mocked_new(&interface);
- auto r = MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i);
+ auto r =
+ MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i, false);
- AssignInterface<DummyInterfaceWithProperties>::op(i, r);
+ AssignInterface<DummyInterfaceWithProperties>::op(i, r, false);
}
TEST(InterfaceOpsTest, TestAssignInterfaceWithOneArgument)
@@ -221,12 +229,13 @@
Interface i{{"foo"s, static_cast<int64_t>(1ll)}};
sdbusplus::SdBusMock interface;
- EXPECT_CALL(mock, setPropertyByName("foo"s, 1ll)).Times(1);
+ EXPECT_CALL(mock, setPropertyByName("foo"s, 1ll, _)).Times(1);
auto b = sdbusplus::get_mocked_new(&interface);
- auto r = MakeInterface<DummyInterfaceWithProperties>::op(b, "bar", i);
+ auto r =
+ MakeInterface<DummyInterfaceWithProperties>::op(b, "bar", i, false);
- AssignInterface<DummyInterfaceWithProperties>::op(i, r);
+ AssignInterface<DummyInterfaceWithProperties>::op(i, r, false);
}
TEST(InterfaceOpsTest, TestSerializePropertylessInterfaceWithoutArguments)
@@ -236,7 +245,8 @@
sdbusplus::SdBusMock interface;
auto b = sdbusplus::get_mocked_new(&interface);
- auto r = MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i);
+ auto r =
+ MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
EXPECT_CALL(mock, serializeTwoArgs("/foo"s, "bar"s)).Times(1);
@@ -251,7 +261,8 @@
sdbusplus::SdBusMock interface;
auto b = sdbusplus::get_mocked_new(&interface);
- auto r = MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i);
+ auto r =
+ MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
EXPECT_CALL(mock, serializeTwoArgs("/foo"s, "bar"s)).Times(1);
@@ -266,7 +277,8 @@
sdbusplus::SdBusMock interface;
auto b = sdbusplus::get_mocked_new(&interface);
- auto r = MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i);
+ auto r =
+ MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i, false);
EXPECT_CALL(mock, serializeThreeArgs("/foo"s, "bar"s, _)).Times(1);
@@ -281,7 +293,8 @@
sdbusplus::SdBusMock interface;
auto b = sdbusplus::get_mocked_new(&interface);
- auto r = MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i);
+ auto r =
+ MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i, false);
EXPECT_CALL(mock, serializeThreeArgs("/foo"s, "bar"s, _)).Times(1);
@@ -296,7 +309,8 @@
sdbusplus::SdBusMock interface;
auto b = sdbusplus::get_mocked_new(&interface);
- auto r = MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i);
+ auto r =
+ MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
EXPECT_CALL(mock, deserializeNoop()).Times(1);
@@ -311,7 +325,8 @@
sdbusplus::SdBusMock interface;
auto b = sdbusplus::get_mocked_new(&interface);
- auto r = MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i);
+ auto r =
+ MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
EXPECT_CALL(mock, deserializeNoop()).Times(1);
@@ -326,7 +341,8 @@
sdbusplus::SdBusMock interface;
auto b = sdbusplus::get_mocked_new(&interface);
- auto r = MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i);
+ auto r =
+ MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i, false);
EXPECT_CALL(mock, deserializeThreeArgs("/foo"s, "bar"s, _)).Times(1);
@@ -341,7 +357,8 @@
sdbusplus::SdBusMock interface;
auto b = sdbusplus::get_mocked_new(&interface);
- auto r = MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i);
+ auto r =
+ MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i, false);
EXPECT_CALL(mock, deserializeThreeArgs("/foo"s, "bar"s, _)).Times(1);