<feed xmlns='http://www.w3.org/2005/Atom'>
<title>sdbusplus/test, branch master</title>
<subtitle>OpenBMC systemd DBUS binding API sources</subtitle>
<id>https://git.raptorcs.com/git/sdbusplus/atom?h=master</id>
<link rel='self' href='https://git.raptorcs.com/git/sdbusplus/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/'/>
<updated>2020-02-13T06:49:15+00:00</updated>
<entry>
<title>Emit adding/removing interfaces for object server</title>
<updated>2020-02-13T06:49:15+00:00</updated>
<author>
<name>Lei YU</name>
<email>mine260309@gmail.com</email>
</author>
<published>2019-09-20T09:38:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=e57c38e9dd64e0a5bc12bac5b6d3199c7baa9595'/>
<id>urn:sha1:e57c38e9dd64e0a5bc12bac5b6d3199c7baa9595</id>
<content type='text'>
The object server currently either creats the objects and interfaces, or
defer the signal by not adding objects.

In practice, we have situations that the code would like to add
interfaces to an existing object, and it's not supported, or needs
tricky code to workaround.
Exmaples:
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-bmc-code-mgmt/+/5820
https://gerrit.openbmc-project.xyz/c/openbmc/openpower-pnor-code-mgmt/+/5346

This commit adds the support by:
1. Adding emit_added() in interface.hpp and the generated server.hpp
2. Adding a enum class in object's constructor to indicate which action
   to do, to create the object, or adding the interface, or defer signal
   as before.

So the user of object&lt;&gt; could pass `action::emit_interface_added` to the
constructor to tell the object server *only* emit interface added to
DBus, without emitting object added.
The previous code stays the same behavior:
* If `true` is passed in object's constructor, it defers emitting object
  added signal;
* If no extra parameter is passed in object's constructor, it emits
  object added signal as before.

Tested: 1. Make sure the openbmc builds fine with
        https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-logging/+/25089
        because phosphor-logging uses its own server.hpp for interface, the
        above patch removes that.
        2. Manually write a small service to verify the interfaces are
        added and removed by using the `emit_interface_added` action.
        3. Added the unit test cases for object.hpp to check the
        ctor/dtor with different actions.

Signed-off-by: Lei YU &lt;mine260309@gmail.com&gt;
Change-Id: I178c5bed3c9ff39ee2ac8d143fbe9131b0753dfa
</content>
</entry>
<entry>
<title>Add valgrind suppression</title>
<updated>2020-01-15T06:57:54+00:00</updated>
<author>
<name>Lei YU</name>
<email>mine260309@gmail.com</email>
</author>
<published>2019-09-25T09:58:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=199b3b1299ff66b9ea7e0fadb66d5338087eee1a'/>
<id>urn:sha1:199b3b1299ff66b9ea7e0fadb66d5338087eee1a</id>
<content type='text'>
On latest OpenBMC, sdbusplus CI fails due to valgrind check like below
on ppc64le systems:

    ==5290== Syscall param epoll_ctl(event) points to uninitialised byte(s)
    ==5290==    at 0x4F2FB08: epoll_ctl (syscall-template.S:79)
    ==5290==    by 0x493A8F7: UnknownInlinedFun (sd-event.c:961)
    ==5290==    by 0x493A8F7: sd_event_add_time (sd-event.c:1019)
    ==5290==    by 0x190BB3: phosphor::Timer::Timer(sd_event*, std::function&lt;void ()&gt;) (timer.hpp:62)
    ==5290==    by 0x192B93: TimerTest::TimerTest() (timer.cpp:25)
    ==5290==    by 0x193A13: TimerTest_timerExpiresAfter2seconds_Test::TimerTest_timerExpiresAfter2seconds_Test() (timer.cpp:85)
    ==5290==    by 0x19E11F: testing::internal::TestFactoryImpl&lt;TimerTest_timerExpiresAfter2seconds_Test&gt;::CreateTest() (gtest-internal.h:472)
    ==5290==    by 0x4A52D3B: HandleSehExceptionsInMethodIfSupported&lt;testing::internal::TestFactoryBase, testing::Test*&gt; (gtest.cc:2447)
    ==5290==    by 0x4A52D3B: testing::Test* testing::internal::HandleExceptionsInMethodIfSupported&lt;testing::internal::TestFactoryBase, testing::Test*&gt;(testing::internal::TestFactoryBase*, testing::Test
    * (testing::internal::TestFactoryBase::*)(), char const*) (gtest.cc:2483)
    ==5290==    by 0x4A40BCB: Run (gtest.cc:2693)
    ==5290==    by 0x4A40BCB: testing::TestInfo::Run() (gtest.cc:2676)
    ==5290==    by 0x4A40DC3: Run (gtest.cc:2825)
    ==5290==    by 0x4A40DC3: testing::TestCase::Run() (gtest.cc:2810)
    ==5290==    by 0x4A414AF: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:5216)
    ==5290==    by 0x4A5329B: HandleSehExceptionsInMethodIfSupported&lt;testing::internal::UnitTestImpl, bool&gt; (gtest.cc:2447)
    ==5290==    by 0x4A5329B: bool testing::internal::HandleExceptionsInMethodIfSupported&lt;testing::internal::UnitTestImpl, bool&gt;(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::
    *)(), char const*) (gtest.cc:2483)
    ==5290==    by 0x4A416AF: testing::UnitTest::Run() (gtest.cc:4824)
    ==5290==    by 0x4A90917: RUN_ALL_TESTS (gtest.h:2370)
    ==5290==    by 0x4A90917: main (gmock_main.cc:69)
    ==5290==  Address 0x1fff00eafc is on thread 1's stack
    ==5290==  in frame #0, created by epoll_ctl (syscall-template.S:78)
    ==5290==

The root cause is:
1. GCC has a bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77992,
   that the padding bytes are not initialized.
2. In systemd, the code in [libsystemd/sd-event/sd-event.c][1] using
   epoll_event hit the above bug:

       typedef union epoll_data
       {
         void *ptr;
         int fd;
         uint32_t u32;
         uint64_t u64;
       } epoll_data_t;

       struct epoll_event
       {
         uint32_t events;      /* Epoll events */
         epoll_data_t data;    /* User data variable */
       } __EPOLL_PACKED;

   In glibc, on x86, `__EPOLL_PACKED` is defined as `__attribute__
   ((__packed__))`[2], so it's packed and there are no internal padding
   bytes;
   On other architectures (e.g. ppc64le), __EPOLL_PACKED is not defined
   and thus there are 4 internal padding bytes between `events` and
   `data`, that are not initialized.
3. When epoll_ctl() is invoked, in [Linux kernel][3], it does a
   copy_from_user() to copy the whole struct into kernel space. That's
   why Valgrind reports "epoll_ctl(event) points to uninitialised
   byte(s)", only for non-x86 platforms.
4. The timer test in this repo invokes sd_event_add_time() and
   eventually hit the above code.

The GCC bug is not resolved from 2016.
The systemd code is actually correct. There is a [PR][4] sent to systemd
trying to workaround the issue, and it is being discussed.

Before GCC bug is resolved or systemd PR is accepted, suppress the
valgrind error to make it pass the CI.

[1]: https://github.com/systemd/systemd/blob/v242/src/libsystemd/sd-event/sd-event.c#L961
[2]: https://github.com/bminor/glibc/blob/f1a0eb5b6762b315517469da47735c51bde6f4ad/sysdeps/unix/sysv/linux/x86/bits/epoll.h#L29
[3]: https://github.com/torvalds/linux/blob/d1eef1c619749b2a57e514a3fa67d9a516ffa919/fs/eventpoll.c#L2095
[4]: https://github.com/systemd/systemd/pull/14353

Signed-off-by: Lei YU &lt;mine260309@gmail.com&gt;
Change-Id: I3a29fd0e28e5c7b69037a7ef2ef9571f93d80df7
</content>
</entry>
<entry>
<title>Fix vtable CI error</title>
<updated>2020-01-15T06:57:52+00:00</updated>
<author>
<name>Lei YU</name>
<email>mine260309@gmail.com</email>
</author>
<published>2019-12-13T06:48:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=d35c85239a85a101e866a7bd60aff4f40bf77401'/>
<id>urn:sha1:d35c85239a85a101e866a7bd60aff4f40bf77401</id>
<content type='text'>
The CI reports failure in VtableTest.SameContent, where the case is
comparing the binary of example vtables constructed from sdbusplus and
macros defined in systemd.

The root cause has two parts.

Part I:
When systemd is updated, the members in struct
sd_bus_vtable is updated, e.g.
* From v239 to v242, sd_bus_vtable.x.start is updated from
      struct {
              size_t element_size;
      } start;
  to:
      struct {
              size_t element_size;
              uint64_t features;
      } start;
  and sd_bus_vtable.x.method is updated from
      struct {
              const char *member;
              const char *signature;
              const char *result;
              sd_bus_message_handler_t handler;
              size_t offset;
      } method;
  to:
      struct {
              const char *member;
              const char *signature;
              const char *result;
              sd_bus_message_handler_t handler;
              size_t offset;
              const char *names;
      } method;
* From v242 to v243, sd_bus_vtable.x.start is updated to
      struct {
              size_t element_size;
              uint64_t features;
              const unsigned *vtable_format_reference;
      } start;

The code in vtable.hpp only assign the members in v239, the new
members are intialized with 0, so it differs from the vtable
constructed from macros defined by systemd.

The fix is to use macros from systemd in vtable.hpp as well,
which is suggested by systemd:

&gt; Please do not initialize this structure directly, use the
&gt; macros below instead

Part II:
The `const char *names` in struct method and signal introduced
between systemd v239 and v242 is a pointer to const strings.

By default they are "empty" strings, but there is no guarantee
that the compiler will use the same pointer for the same string.

So the test case can not assume the binaries are the same for
two vtables even they are constructed with the same parameters.

Update the test case to use real `const char*` and handler/get/set
functions and check each member of the struct instead of comparing the
binary data by memcmp.

Tested: Verify the CI passes.

Change-Id: I9e94ff16075dd3f12d73e96438c0d864203bdcf4
Signed-off-by: Lei YU &lt;mine260309@gmail.com&gt;
</content>
</entry>
<entry>
<title>native_types: Fix string_wrapper overloads</title>
<updated>2019-06-14T17:56:25+00:00</updated>
<author>
<name>William A. Kennington III</name>
<email>wak@google.com</email>
</author>
<published>2019-05-30T23:12:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=f8bbf17c3db879359b0984b40250e4db3d274be1'/>
<id>urn:sha1:f8bbf17c3db879359b0984b40250e4db3d274be1</id>
<content type='text'>
We should only coalesce to an r-value reference to our internal string if our
object is a move reference. This fixes ambiguous overloads with gcc9.
This also ensures that const references cannot be ambiguous with move
references by requiring a const volatile reference.

Change-Id: I31ed529c015cc311c9933acbc0f0a4aa50fed3a6
Signed-off-by: William A. Kennington III &lt;wak@google.com&gt;
</content>
</entry>
<entry>
<title>std::variant: Remove uses of the variant_ns</title>
<updated>2019-04-05T22:14:52+00:00</updated>
<author>
<name>William A. Kennington III</name>
<email>wak@google.com</email>
</author>
<published>2018-11-26T17:50:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=4274c117dd2866ac60508f438e7427f99dee6be4'/>
<id>urn:sha1:4274c117dd2866ac60508f438e7427f99dee6be4</id>
<content type='text'>
Now that we are using std::variant we should reference it directly
instead of using our own namespace alias.

Tested:
    Built and ran through unit tests.

Change-Id: Ic3fd62ea74cf808b85ad7b7ffcce8c0a0bfb125d
Signed-off-by: William A. Kennington III &lt;wak@google.com&gt;
</content>
</entry>
<entry>
<title>autotools: Fix for autoconf-archive 2019.01.19</title>
<updated>2019-03-15T20:48:24+00:00</updated>
<author>
<name>William A. Kennington III</name>
<email>wak@google.com</email>
</author>
<published>2019-03-15T20:42:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=ebdc37143a209db3eb7463406f17ba1ac6046f02'/>
<id>urn:sha1:ebdc37143a209db3eb7463406f17ba1ac6046f02</id>
<content type='text'>
The code coverage macros from the archive changed in a backward
incompatible way. This adds a workaround to autodetect either version
and do the right thing.

Change-Id: Ibb95188264f3fece4a18dbcb98f3e90f8350ff21
Signed-off-by: William A. Kennington III &lt;wak@google.com&gt;
</content>
</entry>
<entry>
<title>bus: Only close connections we own</title>
<updated>2019-01-14T22:57:24+00:00</updated>
<author>
<name>William A. Kennington III</name>
<email>wak@google.com</email>
</author>
<published>2018-12-20T01:34:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=062205d78d7fd0209e3438807a28c428823ed145'/>
<id>urn:sha1:062205d78d7fd0209e3438807a28c428823ed145</id>
<content type='text'>
If we have multiple code segments in the same thread acquiring the
default bus, we end up with the potential for one of those handles to be
destroyed, calling sd_event_flush_close_unref(). This terminates the bus
for all users of the same reference. Any of the reference which still
exist after the first destroy will then return ENOTCONN for all bus
operations since it is now closed. This behavior is undesirable as we
expect to be able to have transient bus references.

However, we do want to make sure we clean up any buses created by
sd_bus_open().

See openbmc/phosphor-time-manager@4e84539349dac086ce2a58e5b9900ed4e40a2eaf
for a specific example of this behavior being unwanted.

Change-Id: I8aad7e282e9d66993b63e85532dce37c179ad5dc
Signed-off-by: William A. Kennington III &lt;wak@google.com&gt;
</content>
</entry>
<entry>
<title>message: Fix variant api usage</title>
<updated>2018-10-05T22:02:59+00:00</updated>
<author>
<name>William A. Kennington III</name>
<email>wak@google.com</email>
</author>
<published>2018-10-04T21:56:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=81fa02eeb854d41cc20a641d35a027665d2f6133'/>
<id>urn:sha1:81fa02eeb854d41cc20a641d35a027665d2f6133</id>
<content type='text'>
This makes our use of the mapbox variant consistent with std::variant.
We need this cleanup for the conversion to std::variant.

Tested:
    Ran unit tests to make sure they still pass.

Change-Id: I990013eaaa2ec27f2fda71bfadd9a5369d50c187
Signed-off-by: William A. Kennington III &lt;wak@google.com&gt;
</content>
</entry>
<entry>
<title>exception: Add .get_errno() method</title>
<updated>2018-09-21T19:29:24+00:00</updated>
<author>
<name>Adriana Kobylak</name>
<email>anoo@us.ibm.com</email>
</author>
<published>2018-09-21T16:50:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=33335b35533cc1e08096bc74f09283e68eb36205'/>
<id>urn:sha1:33335b35533cc1e08096bc74f09283e68eb36205</id>
<content type='text'>
Add the .get_errno() method to provide the errno value from SdBusError.

Closes openbmc/sdbusplus#22

Tested: Added check for the new method to the exception
unit test suite. Also verified external callers get the right
errno value with:
    catch (const SdBusError&amp; e)
    {
        int errno = e.get_errno());
    }

Change-Id: Idddfa7f1bd9cfabfaf89e4d6c83146b4b9af211f
Signed-off-by: Adriana Kobylak &lt;anoo@us.ibm.com&gt;
</content>
</entry>
<entry>
<title>add common timer.hpp unit tests</title>
<updated>2018-09-17T14:09:45+00:00</updated>
<author>
<name>Vernon Mauery</name>
<email>vernon.mauery@linux.intel.com</email>
</author>
<published>2018-09-06T13:34:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=7efcdaeb2d6608548c206f132f3586613012c774'/>
<id>urn:sha1:7efcdaeb2d6608548c206f132f3586613012c774</id>
<content type='text'>
Add unit tests for timer.hpp class. These are the unit tests copied from
the phosphor-host-ipmid/softoff/test directory.

Change-Id: I9d74c6eb528f652965f43a3a4b973368ed782bf0
Signed-off-by: Vernon Mauery &lt;vernon.mauery@linux.intel.com&gt;
</content>
</entry>
</feed>
