d0285b92 | 01-Jun-2020 |
Patrick Williams <patrick@stwcx.xyz> |
meson: create structure for use as submodule
Some other openbmc projects have set up sdbusplus to use as a meson-subproject. When porting one of them (entity-manager) to use the meson build, I real
meson: create structure for use as submodule
Some other openbmc projects have set up sdbusplus to use as a meson-subproject. When porting one of them (entity-manager) to use the meson build, I realized we are not structuring our meson.build file according to best-practices for consumption as a submodule. Specifically, we are missing the 'sdbusplus_dep' variable as described in the meson reference: https://mesonbuild.com/Subprojects.html
Now that 'sdbusplus_dep' is defined, use it throughout the rest of the meson.build files as well for simplification.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I79ad586aa185f769c7ecc83ef06e1f3897e8db2d
show more ...
|
ad145e09 | 19-May-2020 |
Patrick Williams <patrick@stwcx.xyz> |
meson: feature match autotools support
Add support to build the example and test directories, which will get us feature match with the current autotools-based build.
Signed-off-by: Patrick Williams
meson: feature match autotools support
Add support to build the example and test directories, which will get us feature match with the current autotools-based build.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ib0789b6a715be366601eb639fd70ca3da9536a66
show more ...
|
4991d3be | 21-May-2020 |
Patrick Williams <patrick@stwcx.xyz> |
test: exception: suppress scan-build errors
We have a testcase that purposefully accesses a moved-from object and 'scan-build' complains about it. Suppress the warning.
Also remove a check on the
test: exception: suppress scan-build errors
We have a testcase that purposefully accesses a moved-from object and 'scan-build' complains about it. Suppress the warning.
Also remove a check on the moved-from string, because the std library is not required to reset a moved-from string.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I0307c82d38733e9b0b7ff30fc8167310ba49a429
show more ...
|
127b8abe | 21-May-2020 |
Patrick Williams <patrick@stwcx.xyz> |
clang-format: sync from docs master .clang-format
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I8077816a5ddf7a067bdf537cb46e4e32f5c4ef65 |
78b7803b | 20-May-2020 |
Patrick Williams <patrick@stwcx.xyz> |
clean up more pedantic compile warnings
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I84790e29a24c73a65c9770c6836b482386cc0ab7 |
e57c38e9 | 20-Sep-2019 |
Lei YU <mine260309@gmail.com> |
Emit adding/removing interfaces for object server
The object server currently either creats the objects and interfaces, or defer the signal by not adding objects.
In practice, we have situations th
Emit adding/removing interfaces for object server
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<> 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 <mine260309@gmail.com> Change-Id: I178c5bed3c9ff39ee2ac8d143fbe9131b0753dfa
show more ...
|
199b3b12 | 25-Sep-2019 |
Lei YU <mine260309@gmail.com> |
Add valgrind suppression
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) =
Add valgrind suppression
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<void ()>) (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<TimerTest_timerExpiresAfter2seconds_Test>::CreateTest() (gtest-internal.h:472) ==5290== by 0x4A52D3B: HandleSehExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*> (gtest.cc:2447) ==5290== by 0x4A52D3B: testing::Test* testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(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<testing::internal::UnitTestImpl, bool> (gtest.cc:2447) ==5290== by 0x4A5329B: bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(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 <mine260309@gmail.com> Change-Id: I3a29fd0e28e5c7b69037a7ef2ef9571f93d80df7
show more ...
|
d35c8523 | 13-Dec-2019 |
Lei YU <mine260309@gmail.com> |
Fix vtable CI error
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 ca
Fix vtable CI error
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:
> Please do not initialize this structure directly, use the > 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 <mine260309@gmail.com>
show more ...
|
f8bbf17c | 30-May-2019 |
William A. Kennington III <wak@google.com> |
native_types: Fix string_wrapper overloads
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 al
native_types: Fix string_wrapper overloads
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 <wak@google.com>
show more ...
|
4274c117 | 26-Nov-2018 |
William A. Kennington III <wak@google.com> |
std::variant: Remove uses of the variant_ns
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
std::variant: Remove uses of the variant_ns
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 <wak@google.com>
show more ...
|
ebdc3714 | 15-Mar-2019 |
William A. Kennington III <wak@google.com> |
autotools: Fix for autoconf-archive 2019.01.19
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
autotools: Fix for autoconf-archive 2019.01.19
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 <wak@google.com>
show more ...
|
062205d7 | 19-Dec-2018 |
William A. Kennington III <wak@google.com> |
bus: Only close connections we own
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_e
bus: Only close connections we own
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 <wak@google.com>
show more ...
|
81fa02ee | 04-Oct-2018 |
William A. Kennington III <wak@google.com> |
message: Fix variant api usage
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 sur
message: Fix variant api usage
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 <wak@google.com>
show more ...
|
33335b35 | 21-Sep-2018 |
Adriana Kobylak <anoo@us.ibm.com> |
exception: Add .get_errno() method
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
exception: Add .get_errno() method
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& e) { int errno = e.get_errno()); }
Change-Id: Idddfa7f1bd9cfabfaf89e4d6c83146b4b9af211f Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
show more ...
|
7efcdaeb | 06-Sep-2018 |
Vernon Mauery <vernon.mauery@linux.intel.com> |
add common timer.hpp unit tests
Add unit tests for timer.hpp class. These are the unit tests copied from the phosphor-host-ipmid/softoff/test directory.
Change-Id: I9d74c6eb528f652965f43a3a4b973368
add common timer.hpp unit tests
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 <vernon.mauery@linux.intel.com>
show more ...
|
e0d6965e | 31-Aug-2018 |
William A. Kennington III <wak@google.com> |
clang-format: Fix pointer alignment
Oenbmc documentation specifies a left alignment for pointers. Our current format tries to left align if neither alignment is strictly followed, but will allow rig
clang-format: Fix pointer alignment
Oenbmc documentation specifies a left alignment for pointers. Our current format tries to left align if neither alignment is strictly followed, but will allow right aligned files to exist. Lets make this more strict so that all of our files are consistent.
Change-Id: I3a50043d28a9c25d0cf1ffb752800d05eb7615e1 Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
2b238afb | 31-Aug-2018 |
Patrick Venture <venture@google.com> |
clang-format: always break template declarations
To better match the defined openbmc style.
Change-Id: I68cda43857768bae4c904c367942cb1f0efa3e0c Signed-off-by: Patrick Venture <venture@google.com> |
95269dbc | 31-Aug-2018 |
Patrick Venture <venture@google.com> |
update .clang-format header inclusion order
Added the header inclusion order to the .clang-format file generated these changes.
Change-Id: Ia31b21d7ea451cac0309828006bc17c27cbd5bd5 Signed-off-by: P
update .clang-format header inclusion order
Added the header inclusion order to the .clang-format file generated these changes.
Change-Id: Ia31b21d7ea451cac0309828006bc17c27cbd5bd5 Signed-off-by: Patrick Venture <venture@google.com>
show more ...
|
0b5d1e01 | 31-Aug-2018 |
Patrick Venture <venture@google.com> |
clang-format-6.0 bump fixes
The bump to use clang-format-6.0 now reports these issues.
Change-Id: Ice27766e161356f08c98923a256a98af787ac8a2 Signed-off-by: Patrick Venture <venture@google.com> |
31a4b137 | 14-Aug-2018 |
Gunnar Mills <gmills@us.ibm.com> |
Spelling fixes
Spelling errors found using github.com/lucasdemarchi/codespell A tool to fix common misspellings. This tool is licensed under GNU General Public License, version 2.
Change-Id: I99921
Spelling fixes
Spelling errors found using github.com/lucasdemarchi/codespell A tool to fix common misspellings. This tool is licensed under GNU General Public License, version 2.
Change-Id: I99921bb9541fb37cb8999337a72d540494fbb4d7 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
show more ...
|
fac43a65 | 01-Aug-2018 |
Vernon Mauery <vernon.mauery@linux.intel.com> |
Remove multiple inheritance from SdBusError
SdBusError now has a direct line of inheritance down to std::exception and will behave better when trying to catch it as a std::exception.
Add test cases
Remove multiple inheritance from SdBusError
SdBusError now has a direct line of inheritance down to std::exception and will behave better when trying to catch it as a std::exception.
Add test cases to check that SdBusError is actually caught by std::exception and all its other base classes.
Change-Id: I83e614219a1c47ec874ee0b4f14096a5e69ac17d Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
show more ...
|
6c17d3db | 19-Jun-2018 |
William A. Kennington III <wak@google.com> |
tests: Add valgrind memcheck support
This adds the ability to build sdbusplus test cases and run them through valgrind using the build system.
Simply run: `make check-valgrind` and the test cas
tests: Add valgrind memcheck support
This adds the ability to build sdbusplus test cases and run them through valgrind using the build system.
Simply run: `make check-valgrind` and the test cases will be run through valgrind
NOTE: This leaves out drd, helgrind, and sgcheck support as they would requires extensive test refactoring. We don't really use threading in the library code anyway so they are really only useful for proving the test cases don't have any races.
Tested: sdbusplus can still be built without valgrind and tests will still execute normally. If `./configure --enable-valgrind` is passed the configure script fails if valgrind is not present. Even with valgrind, tests are only run through valgrind with `make check-valgrind`. This succeeds as expected.
Change-Id: I08972feef2f32cf3ef912da4658e2d8920fb0275 Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
13367e49 | 26-Jun-2018 |
William A. Kennington III <wak@google.com> |
test/message/read: Test that our error handling cases work
This improves our test coverage of sd_bus_message read functionality to 100%.
Tested: Ran through the usual unit test scripts includin
test/message/read: Test that our error handling cases work
This improves our test coverage of sd_bus_message read functionality to 100%.
Tested: Ran through the usual unit test scripts including valgrind and code coverage.
Change-Id: Ifa849d05364349e27e39c6dda5e4cab4efa35476 Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
60a72835 | 26-Jun-2018 |
William A. Kennington III <wak@google.com> |
test/message/read: Add missing variant skip
We were missing a test of the variant code which is used when the type of the variant provided by the caller does not contain the type needed at runtime t
test/message/read: Add missing variant skip
We were missing a test of the variant code which is used when the type of the variant provided by the caller does not contain the type needed at runtime to store the data in the message. This tests to make sure that the skip is issued correctly when we can't read out the member.
Tested: Unit tests still build and pass
Change-Id: I41fdc3e40589f1feedfadc3ab33fe808ff3a6d16 Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
b4b4fa1f | 25-Jun-2018 |
William A. Kennington III <wak@google.com> |
test/message/read: Use googletest and mocks
Similar to the append test, this test case relied on an ad-hoc system using a separate daemon thread for echoing the messages back to each of the unit tes
test/message/read: Use googletest and mocks
Similar to the append test, this test case relied on an ad-hoc system using a separate daemon thread for echoing the messages back to each of the unit tests. We don't want to depend on a system dbus instance if we can avoid it. Instead, use the mocking system to make sure the correct dbus calls are made when reading messages and ensure the resulting output is built as expected.
Tested: Build still works and all test cases pass. Ensured that the coverage of the tests is the same as the old test cases.
Change-Id: I8d71c031391b962f1de6684d927b81e132c0886d Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|