summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* sdbusplus/ sort headersPatrick Venture2018-07-091-5/+5
| | | | | Change-Id: Ica77cc28ad21b06f00f15d2aecca400ead13a5f1 Signed-off-by: Patrick Venture <venture@google.com>
* Support to skip property changed signalRichard Marian Thomaiyar2018-07-093-8/+25
| | | | | | | | | | PropertyChanged signals are sent out, even before InterfacesAdded signals (if deferSignal is set to true in Object) are sent. This patch provides an option, to skip sending out PropertiesChanged signal for proper initialization sequence. Change-Id: I1678d80cc382fce420dda9f0dd9413d43c1c711d Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
* test/message/read: Test that our error handling cases workWilliam A. Kennington III2018-07-091-6/+236
| | | | | | | | | | | | 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>
* test/message/read: Add missing variant skipWilliam A. Kennington III2018-07-091-0/+18
| | | | | | | | | | | | | 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>
* gitignore: Add all autogenerated filesWilliam A. Kennington III2018-07-091-0/+61
| | | | | | | | | | | | | Our gitignore is lacking definitions for most of the autogenerated files by the project. This patch aims to clean up the gitignore by adding all of the currently generated files / types to the list. Tested: Ran through a full unit test suite and none of the files are picked up anymore. Change-Id: I015776222f1750d200cc4beac13e1ac4329dd519 Signed-off-by: William A. Kennington III <wak@google.com>
* test/message/read: Use googletest and mocksWilliam A. Kennington III2018-07-092-435/+301
| | | | | | | | | | | | | | | | 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>
* test/message/append: Use googletest and mocksWilliam A. Kennington III2018-07-092-606/+306
| | | | | | | | | | | | | | | | | | | | | The current test case depends on the system running a dbus daemon that our test case can register and run a service with. It runs in multiple threads and requires using raw sd_bus_message calls to determine if the appends worked correctly. When systemd 237 becomes the minimum version we could rely on message sealing and other new public members to deal with the daemon issues. However, it will be a while before we can make that the default version. Lets mock out the expectations for the underlying sd_bus_message calls to validate that we will build correct objects when using our message.append() calls. Tested: Converted the tests from the old test cases to this new format keeping very similar test functionality. Tests still pass. Change-Id: Iafc8662389fe60ca2d519abfe472c61292f3239a Signed-off-by: William A. Kennington III <wak@google.com>
* test/type_traits: Convert to gtestWilliam A. Kennington III2018-07-092-12/+17
| | | | | | | | | This is a fairly minimal and non-invasive change. This test doesn't really require the googletest framework since it is just using static_asserts. However, this moves us toward uniform testing. Change-Id: I35d507cf6c97384146120d4f8f1b5a2e52834a6d Signed-off-by: William A. Kennington III <wak@google.com>
* bootstrap: Error out on failuresWilliam A. Kennington III2018-07-091-0/+2
| | | | | | | | | | | | | | If we introduce any issues into our autotools scripts the ./bootstrap.sh script doesn't error out. This allows our build scripts to continue on potentially out of date copies of the Makefile.in and configure script since the autoreconf didn't actually get to rewrite them successfully. Tested: bootstrapping works as expected and introducing an error into configure.ac returns the correct error code. Change-Id: I9f0976bbe88c89e7c436896703558c86cee19a9f Signed-off-by: William A. Kennington III <wak@google.com>
* SdBusError: Add test casesWilliam A. Kennington III2018-07-092-0/+157
| | | | | | | | | | | | This adds basic unit testing to the SdBusError class so we have full coverage of all the functionality. Tested: Ran through the unit test suite including the changes that build valgrind runs and code coverage suppport. Change-Id: I6d3bdbd2e0332ae5372796cb2a380ccddbee10ec Signed-off-by: William A. Kennington III <wak@google.com>
* SdBusError: Fix missing moveWilliam A. Kennington III2018-07-091-1/+3
| | | | | | | | | | | | Our move operator and constructor currently forgets that it needs to also move the value of the system_error. It also needs to initialize the error member since the move function will first free the current error. Tested: Builds still work and existing tests pass. Change-Id: I72fcd2d10eeedf6edf6f83c10ddaf15bb42c8b0d Signed-off-by: William A. Kennington III <wak@google.com>
* SdBusError: Fix initialization checksWilliam A. Kennington III2018-07-091-3/+10
| | | | | | | | | | | | | | | sd_bus_error_set_errno() is semantically useful in C for returning the errno and constructing the error in a single call. However, since successful population of the error can not be distinguished due to the collapsed return value, we need another way to ensure the error was built correctly. Don't check for the return of sd_bus_error_set_errno() and instead use sd_bus_error_is_set(). Tested: Builds still work and tests still pass. Change-Id: Ib7546d7bb19eb2ebbaf6e2cab79a8ecd8960f280 Signed-off-by: William A. Kennington III <wak@google.com>
* SdBusError: Really own the sd_bus_errorWilliam A. Kennington III2018-07-093-6/+9
| | | | | | | | | | | | | | The sd_bus_error constructor claims to own the sd_bus_error pointer but it doesn't prevent the user from trivially re-using it in a broken way. Instead of accepting the argument by value, take the old value and overwrite the caller's copy to NULL it out. This way future calls to sd_bus_error_free() by the caller will do the right thing. Tested: Builds still work and tests are passing. Change-Id: I0afd856f0a2a08a08f25fd43c051aae4b2a645f4 Signed-off-by: William A. Kennington III <wak@google.com>
* SdBusError: Add Dependency Injection for the SdBusInterfaceWilliam A. Kennington III2018-07-092-10/+24
| | | | | | | | | | | | | We want to be able to mock some of the sd_bus_error* calls for testing the SdBusError class. This work makes that possible in the future while retaining the same behavior. Tested: Errors still work fine and are backward compatible. New test cases are now able to build against this class. Change-Id: Ib125dc48eed60ac2bbdfadc4f1a81c52ab047cd4 Signed-off-by: William A. Kennington III <wak@google.com>
* sdbus: Add some sd_bus_error_* functions for mockingWilliam A. Kennington III2018-07-092-0/+28
| | | | | | | | | | | This is needed for a future commit which implements dependency injection on the SdBusError class. Tested: Functions can be used and mocked as expected. Change-Id: I15ae9643b2e1fad0abb1fa08483032502d0f623f Signed-off-by: William A. Kennington III <wak@google.com>
* sdbus_mock: Fix missing bus includeWilliam A. Kennington III2018-07-091-0/+1
| | | | | | | | | | | | The SdBusMock header uses the bus object but doesn't include the header with it. Fix this so we can compile in files that don't include the bus. Tested: Files not previously including the bus can now build against this header. Change-Id: I2cb7f2b9758d82570e95bb3187f5aef639ac96bf Signed-off-by: William A. Kennington III <wak@google.com>
* test: Support mocking with googletestWilliam A. Kennington III2018-07-092-2/+28
| | | | | | | | | | | | | | We should include gmock in our gtest dependencies so that we can use it in future test cases. There is no harm in adding this depdency as we should always build it with googletest and doesnt interfere with current gtests. Tested: All of the tests still pass and newer tests using gmock will now work. Change-Id: Ie53f63f4926b88178c384cc1150b98555dafd7ec Signed-off-by: William A. Kennington III <wak@google.com>
* tests: Add code coverageWilliam A. Kennington III2018-07-093-5/+26
| | | | | | | | | | | | | | | | | | | | | | | | | We want to be able to measure code coverage for our test cases. This patch adds initial support for measuring the coverage of all of the files in the repo when running the test cases. Simply run: `make check-code-coverage` and an lcov report will be generated NOTE: This doesn't yet add any filtering to throw out the results for system headers and tests cases, but the list of results isn't long so it is easy to see the relevant coverage results and we don't want to add any false negatives. Tested: Sdbuplus plus still builds fine without the code coverage utilities by default. sdbusplus now builds with `./configure --enable-code-coverage` and corrects the libs and cflags accordingly to enable coverage. Make then succeeds to generate a report when run with `make check-code-coverage` Change-Id: I7f640b82e771bc9043abf381d14393be54c3e672 Signed-off-by: William A. Kennington III <wak@google.com>
* SdBusInterface: Add missing methodsWilliam A. Kennington III2018-07-094-2/+16
| | | | | | | | | | | | | The methods sd_bus_get_fd() and sd_bus_message_get_errno() were added to their respective wrapped functions but are not mockable. This was due to an older commit that got merged prior to building mock interface. Clean this up. Tested: Builds and passes all unit tests. Change-Id: I5929c25c70b025a972fe8e9011b6bc9ce810efb6 Signed-off-by: William A. Kennington III <wak@google.com>
* SdBusImpl: Expose the global sdbus_implWilliam A. Kennington III2018-07-094-5/+6
| | | | | | | | | | | | | Ultimately we want to use this throughout the sdbusplus headers for dependency injection in the default case. We are already defining it manually in <sdbusplus/bus.hpp> and <sdbusplus/message.hpp>. It would make more sense to export it from <sdbusplus/sdbus.hpp> so do that. Tested: Test suite still builds and passes. Change-Id: I126864c6ff0c35e37f2e002247f94fea0688d918 Signed-off-by: William A. Kennington III <wak@google.com>
* Allow public access to raw message objectEd Tanous2018-07-091-1/+4
| | | | | | | | | | | | | | | | | There are certain cases where one would like to access the raw message object under certain contexts. In general, these are contexts where you need runtime access to the message type information, rather than compile time template typing that the existing message object gives you. It is still desirable to use the message object itself for exception safety and RAII usage semantics. Specifically, this came up when attempting to replicate the actions interface in phosphor-rest, where types and conversions are determined at runtime via introspect, and the type hierarchies are not known at compile time. Change-Id: I1e93af30992ffedbf470c1024eefe10cc5e21031 Signed-off-by: Ed Tanous <ed.tanous@intel.com>
* configure: Fix googletest depedenceWilliam A. Kennington III2018-06-291-1/+1
| | | | | | | | | | | | | | | | b4b3247afc020843ebea278bf3c4e1cbebc54968 accidentally added a hard dependency on googletest. The behavior of PKG_CHECK_MODULES is to fail if the package is not found if no [action-if-not-found] is provided. This change provides a no-op [action-if-not-found] so that autodetection does not fail if not required. Tested: Ran through the unit test suite. Ran through the openbmc build process without the googletest dependency to make sure it builds now. Change-Id: I81492833cc88b269a6d9ac1cb55b95da1975d40b Signed-off-by: William A. Kennington III <wak@google.com>
* Add sbusplus properties serverJames Feist2018-06-275-0/+593
| | | | | | | | | | | | | | | | | Add properties server similar to boost-dbus that allows for creating dbus interfaces during runtime. This adds support for creating methods and get / set properties. Get / set property callbacks are stored in flat_maps of std::function allowing custom get / set functions. Methods are also stored in this way allowing for creating of interfaces without using any yaml. There is one C level callback for properties get, properties set, and method calls that lookup the correct std::function in the flat_map to call. Tested: Ran asio-example on bmc, and updated fru-device. Change-Id: I19881049f4307fe9c68f78df8854f14afdd6c362 Signed-off-by: James Feist <james.feist@linux.intel.com>
* Add boost asio async connectionJames Feist2018-06-2710-2/+380
| | | | | | | | | | | Add an async connection and example of usage. This connection inherits the bus object and allows async method calls using boost asio. Most of these concepts are from boost-dbus. Change-Id: I33b5349d543c9ff4b6ee1ce15346c709c052e1ae Tested: Compiled and ran asio-example on bmc. Signed-off-by: James Feist <james.feist@linux.intel.com>
* tests: Write our own assert()William A. Kennington III2018-06-272-152/+177
| | | | | | | | | | | | | | | | The cassert `assert()` function is only provided when NDEBUG is not defined. Otherwise `assert()` becomes a no-op breaking our test cases. Since we rely on the behavior of assert to validate the tests, we always want to provide one for the test implementation. This functionality will be useful once code coverage is added since that forces NDEBUG to be passed to the preprocessor. Tested: Test cases still work correctly if unmodified, and any changes that should cause the asserts to fail still fail as expected. Change-Id: I8d4132058308566310c58b7ae3e121eae55d37f5 Signed-off-by: William A. Kennington III <wak@google.com>
* tests: Makefile flags cleanupWilliam A. Kennington III2018-06-271-24/+16
| | | | | | | | | | | | | | | This makes sure the correct flags are passed for each stage of compilation and simplifies the logic for each different test case by providing uniform flags for all of them. This also makes us link against libsdbusplus instead of the individual object files so that we don't need to track object implementation details from the source base of the project. Tested: Test cases still build and pass. Change-Id: I8474d93d2c3f72a4b500c93016f3b7d7afe07b3c Signed-off-by: William A. Kennington III <wak@google.com>
* configure: Make gtest detection more flexibleWilliam A. Kennington III2018-06-272-4/+51
| | | | | | | | | | This modifies the configure script to pull the googletest information from pkgconfig. Now we don't have to manually configure GTEST specific flags, we gain the correct library and header paths automatically. It still understands how to detect googletest without pkgconfig if needed. Change-Id: I7add3ee3073252adac7199415154c6805221e362 Signed-off-by: William A. Kennington III <wak@google.com>
* tests: Fix memory leak from sd_bus callsWilliam A. Kennington III2018-06-272-4/+13
| | | | | | | | | | | | Some of the calls into sd_bus leak memory because they never unreference the bus or messages. Fix this so we can eventually enable leak checking from valgrind. Tested: Ran through valgrind and the errors went away. Change-Id: Icc3d5d0860b3852401219c1ca511a1bc26aa1c48 Signed-off-by: William A. Kennington III <wak@google.com>
* autotools: Simple changes for uniformityWilliam A. Kennington III2018-06-273-1/+5
| | | | | | | | | | | Add build-aux and m4 directories so libtool can be vendored correctly when doing a dist. Also reference the m4 directory from the automake script to silence any warnings by autoreconf. Add verbose and force flags to autoreconf to make sure it regenerates everything and gives us useful feedback about where it is in the process. Change-Id: I8ea5184d1ae4098c2122d3e4043128b6731f7e87 Signed-off-by: William A. Kennington III <wak@google.com>
* test: Makefile.am: add missing exception dependencyPatrick Venture2018-06-271-4/+11
| | | | | | | | The read header includes references to the SdBusError object but doesn't link against anything providing it. Change-Id: Id3e9f88557c1b4eeaedd095cb50515f08055e685 Signed-off-by: Patrick Venture <venture@google.com>
* bus/new_{method,signal}: Implement error handling for underlying errorsWilliam A. Kennington III2018-06-221-4/+12
| | | | | | | | | | | | More improvements to error handling coverage to ensure new message creation doesn't silently fail and cause corruption in our daemons. Tested: Builds for zaius and boots on a fully power cycled machine all the way up into the host. Change-Id: Iff9e04b7fb05859f5ab8b171dafda7332d5ead99 Signed-off-by: William A. Kennington III <wak@google.com>
* bus/process: Implement error handling for sd_bus_process callsWilliam A. Kennington III2018-06-221-2/+10
| | | | | | | | | | | | This improves error coverage to make sure we aren't silently ignoring errors when processing incoming sd_bus messages. Tested: Builds for zaius and boots successfully from a cold boot and through a host reboot. Change-Id: I045ce4c31c0e5580d8fa1329136a1963bb0dd0a5 Signed-off-by: William A. Kennington III <wak@google.com>
* bus/call: Implement exception handling on call failuresWilliam A. Kennington III2018-06-221-2/+15
| | | | | | | | | | | | | | | The benefit of these exceptions over the current message error handling is that we populate an sd_bus_error struct with the error data from the sd_bus_call. In the cases where there is an underlying dbus error, we will get more information from the sd_bus_error that is plumbed through the exception message. Tested: Built and booted a BMC + Host from a full tray poweroff with no failed units. Change-Id: If55b9e380815bc2ac02eb3683af19a6510c4f4cf Signed-off-by: William A. Kennington III <wak@google.com>
* property: Add errors supportAdriana Kobylak2018-06-126-2/+53
| | | | | | | | | | | | | Add errors support for properties. Closes openbmc/openbmc#1641 Tested: Verified that when an interface threw a defined property error, the generated code caught it and returned an error to the REST call. Change-Id: I8cb8c77995026f12e373291822e4e0a623a84d81 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* property: Move property template to its own fileAdriana Kobylak2018-06-124-99/+112
| | | | | | | | | | | | | Move the template that generates the property-related code to its own file out of the interface.mako file so that it's easier/cleaner to add additional features to the property template such as error handling. Tested: Verified the generated code for the example Calculator remained the same. Change-Id: Idee37d4b1db6701ffc22de84a7a7ea07a2006d61 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* Adding Richard as reviewerRichard Marian Thomaiyar2018-06-121-1/+2
| | | | | | | Adding Richard Thomaiyar as reviewer for sdbusplus repository. Change-Id: Iaef5cad2e5adfe5a50aedcf2ed3aa0da9fb48f7e Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
* sdbusplus:: dbus-interfaces generated use intefacePatrick Venture2018-05-304-8/+27
| | | | | | | | | The generated dbus-interface server objects now pass their sd-bus library calls through whatever interface was provided in the sdbusplus::bus::bus they received. Change-Id: Ib57a0f7c87c3cad9920cb4427b833cc66932afa2 Signed-off-by: Patrick Venture <venture@google.com>
* sdbusplus::server::object Add sdbus interfacePatrick Venture2018-05-301-6/+12
| | | | | | | | | This object which is part of the composed object for the phosphor-dbus-interfaces, now supports testing through the interface as exposed from the sdbusplus::bus::bus object. Change-Id: I70061e3d1f1ffa027800a2d3e70407a5038f3e07 Signed-off-by: Patrick Venture <venture@google.com>
* sdbusplus::server::interface:: Add sdbus interfacePatrick Venture2018-05-303-6/+45
| | | | | | | | Adds the SdBusInterface without requiring a new injection point, by leveraging that the bus carries that information with it. Change-Id: I55eb6bb8343791ac11980a5669a8a4726f16d591 Signed-off-by: Patrick Venture <venture@google.com>
* sdbusplus testing add new_mock methodPatrick Venture2018-05-301-0/+11
| | | | | | | | | This method returns an sdbusplus::bus::bus using the mock provided and adds the necessary EXPECT_CALL ahead saving a line of code in all unit-tests using this. Change-Id: Icc07405eb0bd4e4dca6c28fdb71e7ff2e5c06c3f Signed-off-by: Patrick Venture <venture@google.com>
* message: Add error handling to sd_bus_message callsWilliam A. Kennington III2018-05-291-25/+119
| | | | | | | | | | | Previously, any errors decoding messages could cause the application to just crash instead of being able to handle the exception. The sd_bus_message methods provide error statuses that were just being thrown away. Make use of any returned error information to ensure application correctness. Change-Id: If9c04b1ce4f6e1f1f6ce441d02e3497fe47b7f3b Signed-off-by: William A. Kennington III <wak@google.com>
* Fix test/Makefile.am to pass build on x86-64 SDKLei YU2018-05-291-3/+11
| | | | | | | | | | | | | | Modify test/Makefile.am to link against pthread, otherwise it gets link failures related to pthread. Add OESDK flags, otherwise the binaries fails to execute on host. Tested: Building the tests well on x86-64 SDK. Executing of the tests are OK. But several test cases fail or stuck at running. Change-Id: I649d7ec566a44fe51d2b8c852cb20d8769b28d30 Signed-off-by: Lei YU <mine260309@gmail.com>
* exception: Add an exception for holding sd_bus_errorsWilliam A. Kennington III2018-05-292-0/+111
| | | | | | | | | | This enables us to return more error information about the underlying sd_bus api call that failed. This will make error output more verbose and enable us to apply more granular filters to specific dbus related errors. Change-Id: I3811139011753d7bd596b46cb69da68f7826ed7b Signed-off-by: William A. Kennington III <wak@google.com>
* sdbusplus::server::manager:: leverage getInterfacePatrick Venture2018-05-293-2/+16
| | | | | | | | | | To allow testing, the sdbusplus::server::manager object needs to grab the SdBusInterface the bus passed in uses, and then use that for its sdbus library calls. This will work in every case, testing or none. Change-Id: I255a6a286f37a8b193932f56c109cf4105a62a20 Signed-off-by: Patrick Venture <venture@google.com>
* sdbusplus::bus::bus Add getInterface() methodPatrick Venture2018-05-291-0/+9
| | | | | | | | | | Added a getInterface() method to allow objects that interact with this bus to grab the SdBusInterface, such that they can be injected with a mock without changing how they are created or behave. Change-Id: Ia733dd7ba1b89280421d06fe5a3b390ea8e9f06f Signed-off-by: Patrick Venture <venture@google.com>
* sdbusplus::bus::bus Add sdbus interface injectionPatrick Venture2018-05-294-67/+297
| | | | | | | | | By default it'll use the sdbus singleton that points to the real library calls, however you can now pass in an interface pointer for it to use instead. Change-Id: Ib23f6b01c43937d2cc84ff3afea79dd1ef28f1e5 Signed-off-by: Patrick Venture <venture@google.com>
* sdbusplus::message::message Add sdbus interface injectionPatrick Venture2018-05-295-172/+266
| | | | | | | | | | | | By default message will use the sdbus singleton that points to the real library calls, however you can now pass in an interface pointer for it to use instead. This is handled automatically when the message is created by the sdbusplus::bus::bus as it will pass in its own interface upon creation (via a later CL). Note: This was originally part of another patchset. Change-Id: Iad49164f1a648e6d3af7d288a8953b5a5ab051bf Signed-off-by: Patrick Venture <venture@google.com>
* Added sdbusplus::sdbus Interface and MockPatrick Venture2018-05-294-1/+268
| | | | | | | | | This is meant to be used as an interface to sd-bus. It sets up a singleton to the default interface and a mock for use in testing. Note: This was originally part of another patchset. Change-Id: I133770fdeec327e018b6c587a7992cbccc7b3f10 Signed-off-by: Patrick Venture <venture@google.com>
* Add MAINTAINERS fileAndrew Jeffery2018-05-211-0/+49
| | | | | Change-Id: I09bd87b8c8cbdfe8f0f13850785236eabf04c1a3 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* Spelling fixesGunnar Mills2018-04-270-0/+0
| | | | | | | | | 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: I53c92d93deda556a4eabb88080ce7967e5bce119 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
OpenPOWER on IntegriCloud