bus: Consistently leverage mock

We have some project generating matches that are using the mock.
Previously, we never checked the return value of this function and it
allowed our match creations to silently fail. With error checking added,
this was breaking unit tests.

This change makes sure that all users of slot generating functions have
their calls properly mocked.

Change-Id: I5dab3e3ae73e8516db21c928fc39bc00d4218c82
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/async/match.cpp b/src/async/match.cpp
index ae8ed73..ed5237b 100644
--- a/src/async/match.cpp
+++ b/src/async/match.cpp
@@ -3,7 +3,7 @@
 namespace sdbusplus::async
 {
 
-match::match(context& ctx, const std::string_view& pattern)
+slot_t match::makeMatch(context& ctx, const std::string_view& pattern)
 {
     // C-style callback to redirect into this::handle_match.
     static auto match_cb =
@@ -12,7 +12,7 @@
         return 0;
     };
 
-    sd_bus_slot* s = nullptr;
+    sd_bus_slot* s;
     auto r = sd_bus_add_match(get_busp(ctx.get_bus()), &s, pattern.data(),
                               match_cb, this);
     if (r < 0)
@@ -20,9 +20,13 @@
         throw exception::SdBusError(-r, "sd_bus_add_match (async::match)");
     }
 
-    slot = std::move(s);
+    return slot_t{s, &sdbus_impl};
 }
 
+match::match(context& ctx, const std::string_view& pattern) :
+    slot(makeMatch(ctx, pattern))
+{}
+
 match::~match()
 {
     match_ns::match_completion* c = nullptr;